Merge pull request #70 from dreamingofelectricsheep/jsdoc-update

Working automatic documentation generation with the newest version of jsdoc (3.2)
This commit is contained in:
Sean Colyer 2013-04-13 13:02:11 -07:00
commit 8da7578588
93 changed files with 21818 additions and 7594 deletions

View File

@ -7,6 +7,7 @@ help:
@echo "test - runs JavaScript unit tests" @echo "test - runs JavaScript unit tests"
@echo "example - creates a simple example" @echo "example - creates a simple example"
@echo "ext-chr-gmail - creates the Google Chrome / Google Mail extension" @echo "ext-chr-gmail - creates the Google Chrome / Google Mail extension"
@echo "documentation - generates documentation. Requires jsdoc (3.2) in PATH"
update: update-me update-deps update: update-me update-deps
@ -35,3 +36,6 @@ minify:
test: test:
@echo to be implemented @echo to be implemented
documentation:
@jsdoc src -r -d doc

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1275
doc/jsxcompressor.js.html Normal file

File diff suppressed because one or more lines are too long

253
doc/md5.js.html Normal file

File diff suppressed because one or more lines are too long

339
doc/openpgp.cfb.js.html Normal file

File diff suppressed because one or more lines are too long

139
doc/openpgp.config.js.html Normal file

File diff suppressed because one or more lines are too long

479
doc/openpgp.crypto.js.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

509
doc/openpgp.js.html Normal file

File diff suppressed because one or more lines are too long

313
doc/openpgp.keyring.js.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

456
doc/openpgp.packet.js.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

184
doc/rsa.js.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

View File

@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

View File

@ -216,13 +216,18 @@ h6
margin: 0; margin: 0;
} }
.sh_sourceCode .prettyprint
{ {
border: 1px solid #ddd; border: 1px solid #ddd;
width: 80%; width: 80%;
overflow: auto;
} }
.sh_sourceCode code .prettyprint.source {
width: inherit;
}
.prettyprint code
{ {
font-family: Consolas, 'Lucida Console', Monaco, monospace; font-family: Consolas, 'Lucida Console', Monaco, monospace;
font-size: 100%; font-size: 100%;

View File

@ -1,150 +0,0 @@
.sh_sourceCode {
background-color: #ffffff;
color: #000000;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_keyword {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_type {
color: #a52a2a;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_string {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_regexp {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_specialchar {
color: #2e8b57;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_comment {
color: #000000;
font-weight: normal;
font-style: italic;
}
.sh_sourceCode .sh_number {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_preproc {
color: #27408b;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_symbol {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_function {
color: #000000;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_cbracket {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_url {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_date {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_time {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_file {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_ip {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_name {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_variable {
color: #dda0dd;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_oldfile {
color: #2e8b57;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_newfile {
color: #006400;
font-weight: normal;
font-style: normal;
}
.sh_sourceCode .sh_difflines {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_selector {
color: #dda0dd;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_property {
color: #000000;
font-weight: bold;
font-style: normal;
}
.sh_sourceCode .sh_value {
color: #006400;
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,111 @@
/* JSDoc prettify.js theme */
/* plain text */
.pln {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* string content */
.str {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a keyword */
.kwd {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a comment */
.com {
font-weight: normal;
font-style: italic;
}
/* a type name */
.typ {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a literal value */
.lit {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* punctuation */
.pun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp open bracket */
.opn {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp close bracket */
.clo {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a markup tag name */
.tag {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute name */
.atn {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute value */
.atv {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a declaration */
.dec {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a variable name */
.var {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a function name */
.fun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0;
}

View File

@ -0,0 +1,132 @@
/* Tomorrow Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
/* plain text */
.pln {
color: #4d4d4c; }
@media screen {
/* string content */
.str {
color: #718c00; }
/* a keyword */
.kwd {
color: #8959a8; }
/* a comment */
.com {
color: #8e908c; }
/* a type name */
.typ {
color: #4271ae; }
/* a literal value */
.lit {
color: #f5871f; }
/* punctuation */
.pun {
color: #4d4d4c; }
/* lisp open bracket */
.opn {
color: #4d4d4c; }
/* lisp close bracket */
.clo {
color: #4d4d4c; }
/* a markup tag name */
.tag {
color: #c82829; }
/* a markup attribute name */
.atn {
color: #f5871f; }
/* a markup attribute value */
.atv {
color: #3e999f; }
/* a declaration */
.dec {
color: #f5871f; }
/* a variable name */
.var {
color: #c82829; }
/* a function name */
.fun {
color: #4271ae; } }
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str {
color: #060; }
.kwd {
color: #006;
font-weight: bold; }
.com {
color: #600;
font-style: italic; }
.typ {
color: #404;
font-weight: bold; }
.lit {
color: #044; }
.pun, .opn, .clo {
color: #440; }
.tag {
color: #006;
font-weight: bold; }
.atn {
color: #404; }
.atv {
color: #060; } }
/* Style */
/*
pre.prettyprint {
background: white;
font-family: Menlo, Monaco, Consolas, monospace;
font-size: 12px;
line-height: 1.5;
border: 1px solid #ccc;
padding: 10px; }
*/
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0; }
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L4,
li.L5,
li.L6,
li.L7,
li.L8,
li.L9 {
/* */ }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
/* */ }

336
doc/util.js.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -2,29 +2,7 @@ function DSA(){this.select_hash_algorithm=function(b){var a=openpgp.config.confi
e.subtract(BigInteger.ONE));c=c.modPow(a,d).mod(e);e=a.modInverse(e).multiply(b.add(f.multiply(c))).mod(e);f=[];f[0]=c.toMPI();f[1]=e.toMPI();return f};this.verify=function(b,a,c,d,e,f,g,h){b=util.getLeftNBits(openpgp_crypto_hashData(b,d),f.bitLength());b=new BigInteger(util.hexstrdump(b),16);if(0<BigInteger.ZERO.compareTo(a)||0<a.compareTo(f)||0<BigInteger.ZERO.compareTo(c)||0<c.compareTo(f))return util.print_error("invalid DSA Signature"),null;c=c.modInverse(f);b=b.multiply(c).mod(f);a=a.multiply(c).mod(f); e.subtract(BigInteger.ONE));c=c.modPow(a,d).mod(e);e=a.modInverse(e).multiply(b.add(f.multiply(c))).mod(e);f=[];f[0]=c.toMPI();f[1]=e.toMPI();return f};this.verify=function(b,a,c,d,e,f,g,h){b=util.getLeftNBits(openpgp_crypto_hashData(b,d),f.bitLength());b=new BigInteger(util.hexstrdump(b),16);if(0<BigInteger.ZERO.compareTo(a)||0<a.compareTo(f)||0<BigInteger.ZERO.compareTo(c)||0<c.compareTo(f))return util.print_error("invalid DSA Signature"),null;c=c.modInverse(f);b=b.multiply(c).mod(f);a=a.multiply(c).mod(f);
return g.modPow(b,e).multiply(h.modPow(a,e)).mod(e).mod(f)}} return g.modPow(b,e).multiply(h.modPow(a,e)).mod(e).mod(f)}}
function Elgamal(){this.encrypt=function(b,a,c,d){var e=BigInteger.ONE.add(BigInteger.ONE),f=c.subtract(e),e=openpgp_crypto_getRandomBigIntegerInRange(e,f),e=e.mod(f).add(BigInteger.ONE),f=[];f[0]=a.modPow(e,c);f[1]=d.modPow(e,c).multiply(b).mod(c).toMPI();f[0]=f[0].toMPI();return f};this.decrypt=function(b,a,c,d){util.print_debug("Elgamal Decrypt:\nc1:"+util.hexstrdump(b.toMPI())+"\nc2:"+util.hexstrdump(a.toMPI())+"\np:"+util.hexstrdump(c.toMPI())+"\nx:"+util.hexstrdump(d.toMPI()));return b.modPow(d, function Elgamal(){this.encrypt=function(b,a,c,d){var e=BigInteger.ONE.add(BigInteger.ONE),f=c.subtract(e),e=openpgp_crypto_getRandomBigIntegerInRange(e,f),e=e.mod(f).add(BigInteger.ONE),f=[];f[0]=a.modPow(e,c);f[1]=d.modPow(e,c).multiply(b).mod(c).toMPI();f[0]=f[0].toMPI();return f};this.decrypt=function(b,a,c,d){util.print_debug("Elgamal Decrypt:\nc1:"+util.hexstrdump(b.toMPI())+"\nc2:"+util.hexstrdump(a.toMPI())+"\np:"+util.hexstrdump(c.toMPI())+"\nx:"+util.hexstrdump(d.toMPI()));return b.modPow(d,
c).modInverse(c).multiply(a).mod(c)}}var dbits,canary=244837814094590,j_lm=15715070==(canary&16777215);function BigInteger(b,a,c){null!=b&&("number"==typeof b?this.fromNumber(b,a,c):null==a&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,a))}function nbi(){return new BigInteger(null)}function am1(b,a,c,d,e,f){for(;0<=--f;){var g=a*this[b++]+c[d]+e,e=Math.floor(g/67108864);c[d++]=g&67108863}return e} c).modInverse(c).multiply(a).mod(c)}}function bnClone(){var b=nbi();this.copyTo(b);return b}function bnIntValue(){if(0>this.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(b){return Math.floor(Math.LN2*this.DB/Math.log(b))}
function am2(b,a,c,d,e,f){for(var g=a&32767,a=a>>15;0<=--f;){var h=this[b]&32767,j=this[b++]>>15,k=a*h+j*g,h=g*h+((k&32767)<<15)+c[d]+(e&1073741823),e=(h>>>30)+(k>>>15)+a*j+(e>>>30);c[d++]=h&1073741823}return e}function am3(b,a,c,d,e,f){for(var g=a&16383,a=a>>14;0<=--f;){var h=this[b]&16383,j=this[b++]>>14,k=a*h+j*g,h=g*h+((k&16383)<<14)+c[d]+e,e=(h>>28)+(k>>14)+a*j;c[d++]=h&268435455}return e}
j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28);BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=(1<<dbits)-1;BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=[],rr,vv;
rr=48;for(vv=0;9>=vv;++vv)BI_RC[rr++]=vv;rr=97;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;rr=65;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;function int2char(b){return BI_RM.charAt(b)}function intAt(b,a){var c=BI_RC[b.charCodeAt(a)];return null==c?-1:c}function bnpCopyTo(b){for(var a=this.t-1;0<=a;--a)b[a]=this[a];b.t=this.t;b.s=this.s}function bnpFromInt(b){this.t=1;this.s=0>b?-1:0;0<b?this[0]=b:-1>b?this[0]=b+DV:this.t=0}function nbv(b){var a=nbi();a.fromInt(b);return a}
function bnpFromString(b,a){var c;if(16==a)c=4;else if(8==a)c=3;else if(256==a)c=8;else if(2==a)c=1;else if(32==a)c=5;else if(4==a)c=2;else{this.fromRadix(b,a);return}this.s=this.t=0;for(var d=b.length,e=!1,f=0;0<=--d;){var g=8==c?b[d]&255:intAt(b,d);0>g?"-"==b.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=g:f+c>this.DB?(this[this.t-1]|=(g&(1<<this.DB-f)-1)<<f,this[this.t++]=g>>this.DB-f):this[this.t-1]|=g<<f,f+=c,f>=this.DB&&(f-=this.DB))}if(8==c&&0!=(b[0]&128))this.s=-1,0<f&&(this[this.t-1]|=(1<<
this.DB-f)-1<<f);this.clamp();e&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t}
function bnToString(b){if(0>this.s)return"-"+this.negate().toString(b);if(16==b)b=4;else if(8==b)b=3;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else return this.toRadix(b);var a=(1<<b)-1,c,d=!1,e="",f=this.t,g=this.DB-f*this.DB%b;if(0<f--){if(g<this.DB&&0<(c=this[f]>>g))d=!0,e=int2char(c);for(;0<=f;)g<b?(c=(this[f]&(1<<g)-1)<<b-g,c|=this[--f]>>(g+=this.DB-b)):(c=this[f]>>(g-=b)&a,0>=g&&(g+=this.DB,--f)),0<c&&(d=!0),d&&(e+=int2char(c))}return d?e:"0"}
function bnNegate(){var b=nbi();BigInteger.ZERO.subTo(this,b);return b}function bnAbs(){return 0>this.s?this.negate():this}function bnCompareTo(b){var a=this.s-b.s;if(0!=a)return a;var c=this.t,a=c-b.t;if(0!=a)return a;for(;0<=--c;)if(0!=(a=this[c]-b[c]))return a;return 0}function nbits(b){var a=1,c;if(0!=(c=b>>>16))b=c,a+=16;if(0!=(c=b>>8))b=c,a+=8;if(0!=(c=b>>4))b=c,a+=4;if(0!=(c=b>>2))b=c,a+=2;0!=b>>1&&(a+=1);return a}
function bnBitLength(){return 0>=this.t?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(b,a){var c;for(c=this.t-1;0<=c;--c)a[c+b]=this[c];for(c=b-1;0<=c;--c)a[c]=0;a.t=this.t+b;a.s=this.s}function bnpDRShiftTo(b,a){for(var c=b;c<this.t;++c)a[c-b]=this[c];a.t=Math.max(this.t-b,0);a.s=this.s}
function bnpLShiftTo(b,a){var c=b%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(b/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)a[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)a[h]=0;a[f]=g;a.t=this.t+f+1;a.s=this.s;a.clamp()}
function bnpRShiftTo(b,a){a.s=this.s;var c=Math.floor(b/this.DB);if(c>=this.t)a.t=0;else{var d=b%this.DB,e=this.DB-d,f=(1<<d)-1;a[0]=this[c]>>d;for(var g=c+1;g<this.t;++g)a[g-c-1]|=(this[g]&f)<<e,a[g-c]=this[g]>>d;0<d&&(a[this.t-c-1]|=(this.s&f)<<e);a.t=this.t-c;a.clamp()}}
function bnpSubTo(b,a){for(var c=0,d=0,e=Math.min(b.t,this.t);c<e;)d+=this[c]-b[c],a[c++]=d&this.DM,d>>=this.DB;if(b.t<this.t){for(d-=b.s;c<this.t;)d+=this[c],a[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<b.t;)d-=b[c],a[c++]=d&this.DM,d>>=this.DB;d-=b.s}a.s=0>d?-1:0;-1>d?a[c++]=this.DV+d:0<d&&(a[c++]=d);a.t=c;a.clamp()}
function bnpMultiplyTo(b,a){var c=this.abs(),d=b.abs(),e=c.t;for(a.t=e+d.t;0<=--e;)a[e]=0;for(e=0;e<d.t;++e)a[e+c.t]=c.am(0,d[e],a,e,0,c.t);a.s=0;a.clamp();this.s!=b.s&&BigInteger.ZERO.subTo(a,a)}function bnpSquareTo(b){for(var a=this.abs(),c=b.t=2*a.t;0<=--c;)b[c]=0;for(c=0;c<a.t-1;++c){var d=a.am(c,a[c],b,2*c,0,1);if((b[c+a.t]+=a.am(c+1,2*a[c],b,2*c+1,d,a.t-c-1))>=a.DV)b[c+a.t]-=a.DV,b[c+a.t+1]=1}0<b.t&&(b[b.t-1]+=a.am(c,a[c],b,2*c,0,1));b.s=0;b.clamp()}
function bnpDivRemTo(b,a,c){var d=b.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=a&&a.fromInt(0),null!=c&&this.copyTo(c);else{null==c&&(c=nbi());var f=nbi(),g=this.s,b=b.s,h=this.DB-nbits(d[d.t-1]);0<h?(d.lShiftTo(h,f),e.lShiftTo(h,c)):(d.copyTo(f),e.copyTo(c));d=f.t;e=f[d-1];if(0!=e){var j=e*(1<<this.F1)+(1<d?f[d-2]>>this.F2:0),k=this.FV/j,j=(1<<this.F1)/j,l=1<<this.F2,m=c.t,r=m-d,p=null==a?nbi():a;f.dlShiftTo(r,p);0<=c.compareTo(p)&&(c[c.t++]=1,c.subTo(p,c));BigInteger.ONE.dlShiftTo(d,
p);for(p.subTo(f,f);f.t<d;)f[f.t++]=0;for(;0<=--r;){var o=c[--m]==e?this.DM:Math.floor(c[m]*k+(c[m-1]+l)*j);if((c[m]+=f.am(0,o,c,r,0,d))<o){f.dlShiftTo(r,p);for(c.subTo(p,c);c[m]<--o;)c.subTo(p,c)}}null!=a&&(c.drShiftTo(d,a),g!=b&&BigInteger.ZERO.subTo(a,a));c.t=d;c.clamp();0<h&&c.rShiftTo(h,c);0>g&&BigInteger.ZERO.subTo(c,c)}}}}function bnMod(b){var a=nbi();this.abs().divRemTo(b,null,a);0>this.s&&0<a.compareTo(BigInteger.ZERO)&&b.subTo(a,a);return a}function Classic(b){this.m=b}
function cConvert(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b}function cRevert(b){return b}function cReduce(b){b.divRemTo(this.m,null,b)}function cMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}function cSqrTo(b,a){b.squareTo(a);this.reduce(a)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;
function bnpInvDigit(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var a=b&3,a=a*(2-(b&15)*a)&15,a=a*(2-(b&255)*a)&255,a=a*(2-((b&65535)*a&65535))&65535,a=a*(2-b*a%this.DV)%this.DV;return 0<a?this.DV-a:-a}function Montgomery(b){this.m=b;this.mp=b.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<b.DB-15)-1;this.mt2=2*b.t}
function montConvert(b){var a=nbi();b.abs().dlShiftTo(this.m.t,a);a.divRemTo(this.m,null,a);0>b.s&&0<a.compareTo(BigInteger.ZERO)&&this.m.subTo(a,a);return a}function montRevert(b){var a=nbi();b.copyTo(a);this.reduce(a);return a}
function montReduce(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var a=0;a<this.m.t;++a){var c=b[a]&32767,d=c*this.mpl+((c*this.mph+(b[a]>>15)*this.mpl&this.um)<<15)&b.DM,c=a+this.m.t;for(b[c]+=this.m.am(0,d,b,a,0,this.m.t);b[c]>=b.DV;)b[c]-=b.DV,b[++c]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)}function montSqrTo(b,a){b.squareTo(a);this.reduce(a)}function montMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}Montgomery.prototype.convert=montConvert;
Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return 0==(0<this.t?this[0]&1:this.s)}function bnpExp(b,a){if(4294967295<b||1>b)return BigInteger.ONE;var c=nbi(),d=nbi(),e=a.convert(this),f=nbits(b)-1;for(e.copyTo(c);0<=--f;)if(a.sqrTo(c,d),0<(b&1<<f))a.mulTo(d,e,c);else var g=c,c=d,d=g;return a.revert(c)}
function bnModPowInt(b,a){var c;c=256>b||a.isEven()?new Classic(a):new Montgomery(a);return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;
BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;
BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function bnClone(){var b=nbi();this.copyTo(b);return b}function bnIntValue(){if(0>this.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(b){return Math.floor(Math.LN2*this.DB/Math.log(b))}
function bnSigNum(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1}function bnpToRadix(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var a=this.chunkSize(b),a=Math.pow(b,a),c=nbv(a),d=nbi(),e=nbi(),f="";for(this.divRemTo(c,d,e);0<d.signum();)f=(a+e.intValue()).toString(b).substr(1)+f,d.divRemTo(c,d,e);return e.intValue().toString(b)+f} function bnSigNum(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1}function bnpToRadix(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var a=this.chunkSize(b),a=Math.pow(b,a),c=nbv(a),d=nbi(),e=nbi(),f="";for(this.divRemTo(c,d,e);0<d.signum();)f=(a+e.intValue()).toString(b).substr(1)+f,d.divRemTo(c,d,e);return e.intValue().toString(b)+f}
function bnpFromRadix(b,a){this.fromInt(0);null==a&&(a=10);for(var c=this.chunkSize(a),d=Math.pow(a,c),e=!1,f=0,g=0,h=0;h<b.length;++h){var j=intAt(b,h);0>j?"-"==b.charAt(h)&&0==this.signum()&&(e=!0):(g=a*g+j,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=f=0))}0<f&&(this.dMultiply(Math.pow(a,f)),this.dAddOffset(g,0));e&&BigInteger.ZERO.subTo(this,this)} function bnpFromRadix(b,a){this.fromInt(0);null==a&&(a=10);for(var c=this.chunkSize(a),d=Math.pow(a,c),e=!1,f=0,g=0,h=0;h<b.length;++h){var j=intAt(b,h);0>j?"-"==b.charAt(h)&&0==this.signum()&&(e=!0):(g=a*g+j,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=f=0))}0<f&&(this.dMultiply(Math.pow(a,f)),this.dAddOffset(g,0));e&&BigInteger.ZERO.subTo(this,this)}
function bnpFromNumber(b,a,c){if("number"==typeof a)if(2>b)this.fromInt(1);else{this.fromNumber(b,c);this.testBit(b-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(b-1),op_or,this);for(this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(BigInteger.ONE.shiftLeft(b-1),this)}else{var c=[],d=b&7;c.length=(b>>3)+1;a.nextBytes(c);c[0]=0<d?c[0]&(1<<d)-1:0;this.fromString(c,256)}} function bnpFromNumber(b,a,c){if("number"==typeof a)if(2>b)this.fromInt(1);else{this.fromNumber(b,c);this.testBit(b-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(b-1),op_or,this);for(this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(BigInteger.ONE.shiftLeft(b-1),this)}else{var c=[],d=b&7;c.length=(b>>3)+1;a.nextBytes(c);c[0]=0<d?c[0]&(1<<d)-1:0;this.fromString(c,256)}}
@ -55,7 +33,29 @@ BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.toRadix=bnpToRa
BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr; BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr;
BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract; BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;
BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;BigInteger.prototype.toMPI=bnToMPI;BigInteger.prototype.square=bnSquare; BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;BigInteger.prototype.toMPI=bnToMPI;BigInteger.prototype.square=bnSquare;
function SecureRandom(){this.nextBytes=function(b){for(var a=0;a<b.length;a++)b[a]=openpgp_crypto_getSecureRandomOctet()}} var dbits,canary=244837814094590,j_lm=15715070==(canary&16777215);function BigInteger(b,a,c){null!=b&&("number"==typeof b?this.fromNumber(b,a,c):null==a&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,a))}function nbi(){return new BigInteger(null)}function am1(b,a,c,d,e,f){for(;0<=--f;){var g=a*this[b++]+c[d]+e,e=Math.floor(g/67108864);c[d++]=g&67108863}return e}
function am2(b,a,c,d,e,f){for(var g=a&32767,a=a>>15;0<=--f;){var h=this[b]&32767,j=this[b++]>>15,k=a*h+j*g,h=g*h+((k&32767)<<15)+c[d]+(e&1073741823),e=(h>>>30)+(k>>>15)+a*j+(e>>>30);c[d++]=h&1073741823}return e}function am3(b,a,c,d,e,f){for(var g=a&16383,a=a>>14;0<=--f;){var h=this[b]&16383,j=this[b++]>>14,k=a*h+j*g,h=g*h+((k&16383)<<14)+c[d]+e,e=(h>>28)+(k>>14)+a*j;c[d++]=h&268435455}return e}
j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28);BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=(1<<dbits)-1;BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=[],rr,vv;
rr=48;for(vv=0;9>=vv;++vv)BI_RC[rr++]=vv;rr=97;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;rr=65;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;function int2char(b){return BI_RM.charAt(b)}function intAt(b,a){var c=BI_RC[b.charCodeAt(a)];return null==c?-1:c}function bnpCopyTo(b){for(var a=this.t-1;0<=a;--a)b[a]=this[a];b.t=this.t;b.s=this.s}function bnpFromInt(b){this.t=1;this.s=0>b?-1:0;0<b?this[0]=b:-1>b?this[0]=b+DV:this.t=0}function nbv(b){var a=nbi();a.fromInt(b);return a}
function bnpFromString(b,a){var c;if(16==a)c=4;else if(8==a)c=3;else if(256==a)c=8;else if(2==a)c=1;else if(32==a)c=5;else if(4==a)c=2;else{this.fromRadix(b,a);return}this.s=this.t=0;for(var d=b.length,e=!1,f=0;0<=--d;){var g=8==c?b[d]&255:intAt(b,d);0>g?"-"==b.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=g:f+c>this.DB?(this[this.t-1]|=(g&(1<<this.DB-f)-1)<<f,this[this.t++]=g>>this.DB-f):this[this.t-1]|=g<<f,f+=c,f>=this.DB&&(f-=this.DB))}if(8==c&&0!=(b[0]&128))this.s=-1,0<f&&(this[this.t-1]|=(1<<
this.DB-f)-1<<f);this.clamp();e&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t}
function bnToString(b){if(0>this.s)return"-"+this.negate().toString(b);if(16==b)b=4;else if(8==b)b=3;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else return this.toRadix(b);var a=(1<<b)-1,c,d=!1,e="",f=this.t,g=this.DB-f*this.DB%b;if(0<f--){if(g<this.DB&&0<(c=this[f]>>g))d=!0,e=int2char(c);for(;0<=f;)g<b?(c=(this[f]&(1<<g)-1)<<b-g,c|=this[--f]>>(g+=this.DB-b)):(c=this[f]>>(g-=b)&a,0>=g&&(g+=this.DB,--f)),0<c&&(d=!0),d&&(e+=int2char(c))}return d?e:"0"}
function bnNegate(){var b=nbi();BigInteger.ZERO.subTo(this,b);return b}function bnAbs(){return 0>this.s?this.negate():this}function bnCompareTo(b){var a=this.s-b.s;if(0!=a)return a;var c=this.t,a=c-b.t;if(0!=a)return a;for(;0<=--c;)if(0!=(a=this[c]-b[c]))return a;return 0}function nbits(b){var a=1,c;if(0!=(c=b>>>16))b=c,a+=16;if(0!=(c=b>>8))b=c,a+=8;if(0!=(c=b>>4))b=c,a+=4;if(0!=(c=b>>2))b=c,a+=2;0!=b>>1&&(a+=1);return a}
function bnBitLength(){return 0>=this.t?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(b,a){var c;for(c=this.t-1;0<=c;--c)a[c+b]=this[c];for(c=b-1;0<=c;--c)a[c]=0;a.t=this.t+b;a.s=this.s}function bnpDRShiftTo(b,a){for(var c=b;c<this.t;++c)a[c-b]=this[c];a.t=Math.max(this.t-b,0);a.s=this.s}
function bnpLShiftTo(b,a){var c=b%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(b/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)a[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)a[h]=0;a[f]=g;a.t=this.t+f+1;a.s=this.s;a.clamp()}
function bnpRShiftTo(b,a){a.s=this.s;var c=Math.floor(b/this.DB);if(c>=this.t)a.t=0;else{var d=b%this.DB,e=this.DB-d,f=(1<<d)-1;a[0]=this[c]>>d;for(var g=c+1;g<this.t;++g)a[g-c-1]|=(this[g]&f)<<e,a[g-c]=this[g]>>d;0<d&&(a[this.t-c-1]|=(this.s&f)<<e);a.t=this.t-c;a.clamp()}}
function bnpSubTo(b,a){for(var c=0,d=0,e=Math.min(b.t,this.t);c<e;)d+=this[c]-b[c],a[c++]=d&this.DM,d>>=this.DB;if(b.t<this.t){for(d-=b.s;c<this.t;)d+=this[c],a[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<b.t;)d-=b[c],a[c++]=d&this.DM,d>>=this.DB;d-=b.s}a.s=0>d?-1:0;-1>d?a[c++]=this.DV+d:0<d&&(a[c++]=d);a.t=c;a.clamp()}
function bnpMultiplyTo(b,a){var c=this.abs(),d=b.abs(),e=c.t;for(a.t=e+d.t;0<=--e;)a[e]=0;for(e=0;e<d.t;++e)a[e+c.t]=c.am(0,d[e],a,e,0,c.t);a.s=0;a.clamp();this.s!=b.s&&BigInteger.ZERO.subTo(a,a)}function bnpSquareTo(b){for(var a=this.abs(),c=b.t=2*a.t;0<=--c;)b[c]=0;for(c=0;c<a.t-1;++c){var d=a.am(c,a[c],b,2*c,0,1);if((b[c+a.t]+=a.am(c+1,2*a[c],b,2*c+1,d,a.t-c-1))>=a.DV)b[c+a.t]-=a.DV,b[c+a.t+1]=1}0<b.t&&(b[b.t-1]+=a.am(c,a[c],b,2*c,0,1));b.s=0;b.clamp()}
function bnpDivRemTo(b,a,c){var d=b.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=a&&a.fromInt(0),null!=c&&this.copyTo(c);else{null==c&&(c=nbi());var f=nbi(),g=this.s,b=b.s,h=this.DB-nbits(d[d.t-1]);0<h?(d.lShiftTo(h,f),e.lShiftTo(h,c)):(d.copyTo(f),e.copyTo(c));d=f.t;e=f[d-1];if(0!=e){var j=e*(1<<this.F1)+(1<d?f[d-2]>>this.F2:0),k=this.FV/j,j=(1<<this.F1)/j,l=1<<this.F2,m=c.t,r=m-d,p=null==a?nbi():a;f.dlShiftTo(r,p);0<=c.compareTo(p)&&(c[c.t++]=1,c.subTo(p,c));BigInteger.ONE.dlShiftTo(d,
p);for(p.subTo(f,f);f.t<d;)f[f.t++]=0;for(;0<=--r;){var o=c[--m]==e?this.DM:Math.floor(c[m]*k+(c[m-1]+l)*j);if((c[m]+=f.am(0,o,c,r,0,d))<o){f.dlShiftTo(r,p);for(c.subTo(p,c);c[m]<--o;)c.subTo(p,c)}}null!=a&&(c.drShiftTo(d,a),g!=b&&BigInteger.ZERO.subTo(a,a));c.t=d;c.clamp();0<h&&c.rShiftTo(h,c);0>g&&BigInteger.ZERO.subTo(c,c)}}}}function bnMod(b){var a=nbi();this.abs().divRemTo(b,null,a);0>this.s&&0<a.compareTo(BigInteger.ZERO)&&b.subTo(a,a);return a}function Classic(b){this.m=b}
function cConvert(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b}function cRevert(b){return b}function cReduce(b){b.divRemTo(this.m,null,b)}function cMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}function cSqrTo(b,a){b.squareTo(a);this.reduce(a)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;
function bnpInvDigit(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var a=b&3,a=a*(2-(b&15)*a)&15,a=a*(2-(b&255)*a)&255,a=a*(2-((b&65535)*a&65535))&65535,a=a*(2-b*a%this.DV)%this.DV;return 0<a?this.DV-a:-a}function Montgomery(b){this.m=b;this.mp=b.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<b.DB-15)-1;this.mt2=2*b.t}
function montConvert(b){var a=nbi();b.abs().dlShiftTo(this.m.t,a);a.divRemTo(this.m,null,a);0>b.s&&0<a.compareTo(BigInteger.ZERO)&&this.m.subTo(a,a);return a}function montRevert(b){var a=nbi();b.copyTo(a);this.reduce(a);return a}
function montReduce(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var a=0;a<this.m.t;++a){var c=b[a]&32767,d=c*this.mpl+((c*this.mph+(b[a]>>15)*this.mpl&this.um)<<15)&b.DM,c=a+this.m.t;for(b[c]+=this.m.am(0,d,b,a,0,this.m.t);b[c]>=b.DV;)b[c]-=b.DV,b[++c]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)}function montSqrTo(b,a){b.squareTo(a);this.reduce(a)}function montMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}Montgomery.prototype.convert=montConvert;
Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return 0==(0<this.t?this[0]&1:this.s)}function bnpExp(b,a){if(4294967295<b||1>b)return BigInteger.ONE;var c=nbi(),d=nbi(),e=a.convert(this),f=nbits(b)-1;for(e.copyTo(c);0<=--f;)if(a.sqrTo(c,d),0<(b&1<<f))a.mulTo(d,e,c);else var g=c,c=d,d=g;return a.revert(c)}
function bnModPowInt(b,a){var c;c=256>b||a.isEven()?new Classic(a):new Montgomery(a);return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;
BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;
BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function SecureRandom(){this.nextBytes=function(b){for(var a=0;a<b.length;a++)b[a]=openpgp_crypto_getSecureRandomOctet()}}
function RSA(){function b(){this.n=null;this.e=0;this.u=this.dmq1=this.dmp1=this.q=this.p=this.d=this.ee=null}this.encrypt=function(a,b,d){return a.modPowInt(b,d)};this.decrypt=function(a,b,d,e,f){var g=a.mod(d).modPow(b.mod(d.subtract(BigInteger.ONE)),d),a=a.mod(e).modPow(b.mod(e.subtract(BigInteger.ONE)),e);util.print_debug("rsa.js decrypt\nxpn:"+util.hexstrdump(g.toMPI())+"\nxqn:"+util.hexstrdump(a.toMPI()));b=a.subtract(g);0==b[0]?(b=g.subtract(a),b=b.multiply(f).mod(e),b=e.subtract(b)):b=b.multiply(f).mod(e); function RSA(){function b(){this.n=null;this.e=0;this.u=this.dmq1=this.dmp1=this.q=this.p=this.d=this.ee=null}this.encrypt=function(a,b,d){return a.modPowInt(b,d)};this.decrypt=function(a,b,d,e,f){var g=a.mod(d).modPow(b.mod(d.subtract(BigInteger.ONE)),d),a=a.mod(e).modPow(b.mod(e.subtract(BigInteger.ONE)),e);util.print_debug("rsa.js decrypt\nxpn:"+util.hexstrdump(g.toMPI())+"\nxqn:"+util.hexstrdump(a.toMPI()));b=a.subtract(g);0==b[0]?(b=g.subtract(a),b=b.multiply(f).mod(e),b=e.subtract(b)):b=b.multiply(f).mod(e);
return b.multiply(d).add(g)};this.verify=function(a,b,d){return a.modPowInt(b,d)};this.sign=function(a,b,d){return a.modPow(b,d)};this.generate=function(a,c){var d=new b,e=new SecureRandom,f=a>>1;d.e=parseInt(c,16);for(d.ee=new BigInteger(c,16);;){for(;!(d.p=new BigInteger(a-f,1,e),0==d.p.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.p.isProbablePrime(10)););for(;!(d.q=new BigInteger(f,1,e),0==d.q.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.q.isProbablePrime(10));); return b.multiply(d).add(g)};this.verify=function(a,b,d){return a.modPowInt(b,d)};this.sign=function(a,b,d){return a.modPow(b,d)};this.generate=function(a,c){var d=new b,e=new SecureRandom,f=a>>1;d.e=parseInt(c,16);for(d.ee=new BigInteger(c,16);;){for(;!(d.p=new BigInteger(a-f,1,e),0==d.p.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.p.isProbablePrime(10)););for(;!(d.q=new BigInteger(f,1,e),0==d.q.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.q.isProbablePrime(10)););
if(0>=d.p.compareTo(d.q)){var g=d.p;d.p=d.q;d.q=g}var g=d.p.subtract(BigInteger.ONE),h=d.q.subtract(BigInteger.ONE),j=g.multiply(h);if(0==j.gcd(d.ee).compareTo(BigInteger.ONE)){d.n=d.p.multiply(d.q);d.d=d.ee.modInverse(j);d.dmp1=d.d.mod(g);d.dmq1=d.d.mod(h);d.u=d.p.modInverse(d.q);break}}return d};this.keyObject=b}function MD5(b){b=md5(b);return util.hex2bin(b)} if(0>=d.p.compareTo(d.q)){var g=d.p;d.p=d.q;d.q=g}var g=d.p.subtract(BigInteger.ONE),h=d.q.subtract(BigInteger.ONE),j=g.multiply(h);if(0==j.gcd(d.ee).compareTo(BigInteger.ONE)){d.n=d.p.multiply(d.q);d.d=d.ee.modInverse(j);d.dmp1=d.d.mod(g);d.dmq1=d.d.mod(h);d.u=d.p.modInverse(d.q);break}}return d};this.keyObject=b}function MD5(b){b=md5(b);return util.hex2bin(b)}
@ -285,7 +285,7 @@ JXG.Util.asciiCharCodeAt=function(b,a){var c=b.charCodeAt(a);if(255<c)switch(c){
151;break;case 732:c=152;break;case 8482:c=153;break;case 353:c=154;break;case 8250:c=155;break;case 339:c=156;break;case 382:c=158;break;case 376:c=159}return c}; 151;break;case 732:c=152;break;case 8482:c=153;break;case 353:c=154;break;case 8250:c=155;break;case 339:c=156;break;case 382:c=158;break;case 376:c=159}return c};
JXG.Util.utf8Decode=function(b){var a=[],c=0,d=0,e=0,f;if(!JXG.exists(b))return"";for(;c<b.length;)d=b.charCodeAt(c),128>d?(a.push(String.fromCharCode(d)),c++):191<d&&224>d?(e=b.charCodeAt(c+1),a.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=b.charCodeAt(c+1),f=b.charCodeAt(c+2),a.push(String.fromCharCode((d&15)<<12|(e&63)<<6|f&63)),c+=3);return a.join("")}; JXG.Util.utf8Decode=function(b){var a=[],c=0,d=0,e=0,f;if(!JXG.exists(b))return"";for(;c<b.length;)d=b.charCodeAt(c),128>d?(a.push(String.fromCharCode(d)),c++):191<d&&224>d?(e=b.charCodeAt(c+1),a.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=b.charCodeAt(c+1),f=b.charCodeAt(c+2),a.push(String.fromCharCode((d&15)<<12|(e&63)<<6|f&63)),c+=3);return a.join("")};
JXG.Util.genUUID=function(){for(var b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=Array(36),c=0,d,e=0;36>e;e++)8==e||13==e||18==e||23==e?a[e]="-":14==e?a[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,a[e]=b[19==e?d&3|8:d]);return a.join("")}; JXG.Util.genUUID=function(){for(var b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=Array(36),c=0,d,e=0;36>e;e++)8==e||13==e||18==e||23==e?a[e]="-":14==e?a[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,a[e]=b[19==e?d&3|8:d]);return a.join("")};
function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:2,encryption_cipher:9,compression:1,show_version:!0,show_comment:!0,integrity_protect:!0,composition_behavior:0,keyserver:"keyserver.linux.it"};this.versionstring="OpenPGP.js v.1.20130306";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var b=JSON.parse(window.localStorage.getItem("config"));null==b?(this.config=this.default_config,this.write()):this.config=b};this.write=function(){window.localStorage.setItem("config", function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:2,encryption_cipher:9,compression:1,show_version:!0,show_comment:!0,integrity_protect:!0,composition_behavior:0,keyserver:"keyserver.linux.it"};this.versionstring="OpenPGP.js v.1.20130412";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var b=JSON.parse(window.localStorage.getItem("config"));null==b?(this.config=this.default_config,this.write()):this.config=b};this.write=function(){window.localStorage.setItem("config",
JSON.stringify(this.config))}}var b64s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function s2r(b){var a,c,d,e="",f=0,g=0,h=b.length;for(d=0;d<h;d++)c=b.charCodeAt(d),0==g?(e+=b64s.charAt(c>>2&63),a=(c&3)<<4):1==g?(e+=b64s.charAt(a|c>>4&15),a=(c&15)<<2):2==g&&(e+=b64s.charAt(a|c>>6&3),f+=1,0==f%60&&(e+="\n"),e+=b64s.charAt(c&63)),f+=1,0==f%60&&(e+="\n"),g+=1,3==g&&(g=0);0<g&&(e+=b64s.charAt(a),f+=1,0==f%60&&(e+="\n"),e+="=",f+=1);1==g&&(0==f%60&&(e+="\n"),e+="=");return e} JSON.stringify(this.config))}}var b64s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function s2r(b){var a,c,d,e="",f=0,g=0,h=b.length;for(d=0;d<h;d++)c=b.charCodeAt(d),0==g?(e+=b64s.charAt(c>>2&63),a=(c&3)<<4):1==g?(e+=b64s.charAt(a|c>>4&15),a=(c&15)<<2):2==g&&(e+=b64s.charAt(a|c>>6&3),f+=1,0==f%60&&(e+="\n"),e+=b64s.charAt(c&63)),f+=1,0==f%60&&(e+="\n"),g+=1,3==g&&(g=0);0<g&&(e+=b64s.charAt(a),f+=1,0==f%60&&(e+="\n"),e+="=",f+=1);1==g&&(0==f%60&&(e+="\n"),e+="=");return e}
function r2s(b){var a,c,d="",e=0,f=0,g=b.length;for(c=0;c<g;c++)a=b64s.indexOf(b.charAt(c)),0<=a&&(e&&(d+=String.fromCharCode(f|a>>6-e&255)),e=e+2&7,f=a<<e&255);return d} function r2s(b){var a,c,d="",e=0,f=0,g=b.length;for(c=0;c<g;c++)a=b64s.indexOf(b.charAt(c)),0<=a&&(e&&(d+=String.fromCharCode(f|a>>6-e&255)),e=e+2&7,f=a<<e&255);return d}
function openpgp_encoding_deArmor(b){var a=getPGPMessageType(b);if(2!=a){b=b.split("-----");data={openpgp:openpgp_encoding_base64_decode(b[2].split("\n\n")[1].split("\n=")[0].replace(/\n- /g,"\n")),type:a};if(verifyCheckSum(data.openpgp,b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]))return data;util.print_error("Ascii armor integrity check on message failed: '"+b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]+"' should be '"+getCheckSum(data))}else{b=b.split("-----");a={text:b[2].replace(/\n- /g, function openpgp_encoding_deArmor(b){var a=getPGPMessageType(b);if(2!=a){b=b.split("-----");data={openpgp:openpgp_encoding_base64_decode(b[2].split("\n\n")[1].split("\n=")[0].replace(/\n- /g,"\n")),type:a};if(verifyCheckSum(data.openpgp,b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]))return data;util.print_error("Ascii armor integrity check on message failed: '"+b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]+"' should be '"+getCheckSum(data))}else{b=b.split("-----");a={text:b[2].replace(/\n- /g,

View File

@ -15,27 +15,37 @@
* materials provided with the application or distribution. * materials provided with the application or distribution.
*/ */
/**
* An array of bytes, that is integers with values from 0 to 255
* @typedef {(Array|Uint8Array)} openpgp_byte_array
*/
/**
* Block cipher function
* @callback openpgp_cipher_block_fn
* @param {openpgp_byte_array} block A block to perform operations on
* @param {openpgp_byte_array} key to use in encryption/decryption
* @return {openpgp_byte_array} Encrypted/decrypted block
*/
// -------------------------------------- // --------------------------------------
/** /**
* This function encrypts a given with the specified prefixrandom * This function encrypts a given with the specified prefixrandom
* using the specified blockcipher to encrypt a message * using the specified blockcipher to encrypt a message
* @param prefixrandom random bytes of block_size length provided * @param {String} prefixrandom random bytes of block_size length provided
* as a string to be used in prefixing the data * as a string to be used in prefixing the data
* @param blockcipherfn the algorithm encrypt function to encrypt * @param {openpgp_cipher_block_fn} blockcipherfn the algorithm encrypt function to encrypt
* data in one block_size encryption. The function must be * data in one block_size encryption.
* specified as blockcipherfn([integer_array(integers 0..255)] * @param {Integer} block_size the block size in bytes of the algorithm used
* block,[integer_array(integers 0..255)] key) returning an * @param {String} plaintext data to be encrypted provided as a string
* array of bytes (integers 0..255) * @param {openpgp_byte_array} key key to be used to encrypt the data. This will be passed to the
* @param block_size the block size in bytes of the algorithm used
* @param plaintext data to be encrypted provided as a string
* @param key key to be used to encrypt the data as
* integer_array(integers 0..255)]. This will be passed to the
* blockcipherfn * blockcipherfn
* @param resync a boolean value specifying if a resync of the * @param {Boolean} resync a boolean value specifying if a resync of the
* IV should be used or not. The encrypteddatapacket uses the * IV should be used or not. The encrypteddatapacket uses the
* "old" style with a resync. Encryption within an * "old" style with a resync. Encryption within an
* encryptedintegrityprotecteddata packet is not resyncing the IV. * encryptedintegrityprotecteddata packet is not resyncing the IV.
* @return a string with the encrypted data * @return {String} a string with the encrypted data
*/ */
function openpgp_cfb_encrypt(prefixrandom, blockcipherencryptfn, plaintext, block_size, key, resync) { function openpgp_cfb_encrypt(prefixrandom, blockcipherencryptfn, plaintext, block_size, key, resync) {
var FR = new Array(block_size); var FR = new Array(block_size);
@ -126,12 +136,12 @@ function openpgp_cfb_encrypt(prefixrandom, blockcipherencryptfn, plaintext, bloc
} }
/** /**
* decrypts the prefixed data for the Modification Detection Code (MDC) computation * Decrypts the prefixed data for the Modification Detection Code (MDC) computation
* @param blockcipherencryptfn cipher function to use * @param {openpgp_block_cipher_fn} blockcipherencryptfn Cipher function to use
* @param block_size blocksize of the algorithm * @param {Integer} block_size Blocksize of the algorithm
* @param key the key for encryption * @param {openpgp_byte_array} key The key for encryption
* @param ciphertext the encrypted data * @param {String} ciphertext The encrypted data
* @return plaintext data of D(ciphertext) with blocksize length +2 * @return {String} plaintext Data of D(ciphertext) with blocksize length +2
*/ */
function openpgp_cfb_mdc(blockcipherencryptfn, block_size, key, ciphertext) { function openpgp_cfb_mdc(blockcipherencryptfn, block_size, key, ciphertext) {
var iblock = new Array(block_size); var iblock = new Array(block_size);
@ -157,21 +167,17 @@ function openpgp_cfb_mdc(blockcipherencryptfn, block_size, key, ciphertext) {
/** /**
* This function decrypts a given plaintext using the specified * This function decrypts a given plaintext using the specified
* blockcipher to decrypt a message * blockcipher to decrypt a message
* @param blockcipherfn the algorithm _encrypt_ function to encrypt * @param {openpgp_cipher_block_fn} blockcipherfn The algorithm _encrypt_ function to encrypt
* data in one block_size encryption. The function must be * data in one block_size encryption.
* specified as blockcipherfn([integer_array(integers 0..255)] * @param {Integer} block_size the block size in bytes of the algorithm used
* block,[integer_array(integers 0..255)] key) returning an * @param {String} plaintext ciphertext to be decrypted provided as a string
* array of bytes (integers 0..255) * @param {openpgp_byte_array} key key to be used to decrypt the ciphertext. This will be passed to the
* @param block_size the block size in bytes of the algorithm used
* @param plaintext ciphertext to be decrypted provided as a string
* @param key key to be used to decrypt the ciphertext as
* integer_array(integers 0..255)]. This will be passed to the
* blockcipherfn * blockcipherfn
* @param resync a boolean value specifying if a resync of the * @param {Boolean} resync a boolean value specifying if a resync of the
* IV should be used or not. The encrypteddatapacket uses the * IV should be used or not. The encrypteddatapacket uses the
* "old" style with a resync. Decryption within an * "old" style with a resync. Decryption within an
* encryptedintegrityprotecteddata packet is not resyncing the IV. * encryptedintegrityprotecteddata packet is not resyncing the IV.
* @return a string with the plaintext data * @return {String} a string with the plaintext data
*/ */
function openpgp_cfb_decrypt(blockcipherencryptfn, block_size, key, ciphertext, resync) function openpgp_cfb_decrypt(blockcipherencryptfn, block_size, key, ciphertext, resync)

View File

@ -20,11 +20,11 @@
/** /**
* Encrypts data using the specified public key multiprecision integers * Encrypts data using the specified public key multiprecision integers
* and the specified algorithm. * and the specified algorithm.
* @param algo [Integer] Algorithm to be used (See RFC4880 9.1) * @param {Integer} algo Algorithm to be used (See RFC4880 9.1)
* @param publicMPIs [Array[openpgp_type_mpi]] algorithm dependent multiprecision integers * @param {openpgp_type_mpi[]} publicMPIs Algorithm dependent multiprecision integers
* @param data [openpgp_type_mpi] data to be encrypted as MPI * @param {openpgp_type_mpi} data Data to be encrypted as MPI
* @return [Object] if RSA an openpgp_type_mpi; if elgamal encryption an array of two * @return {(openpgp_type_mpi|openpgp_type_mpi[])} if RSA an openpgp_type_mpi;
* openpgp_type_mpi is returned; otherwise null * if elgamal encryption an array of two openpgp_type_mpi is returned; otherwise null
*/ */
function openpgp_crypto_asymetricEncrypt(algo, publicMPIs, data) { function openpgp_crypto_asymetricEncrypt(algo, publicMPIs, data) {
switch(algo) { switch(algo) {
@ -51,11 +51,13 @@ function openpgp_crypto_asymetricEncrypt(algo, publicMPIs, data) {
/** /**
* Decrypts data using the specified public key multiprecision integers of the private key, * Decrypts data using the specified public key multiprecision integers of the private key,
* the specified secretMPIs of the private key and the specified algorithm. * the specified secretMPIs of the private key and the specified algorithm.
* @param algo [Integer] Algorithm to be used (See RFC4880 9.1) * @param {Integer} algo Algorithm to be used (See RFC4880 9.1)
* @param publicMPIs [Array[openpgp_type_mpi]] algorithm dependent multiprecision integers of the public key part of the private key * @param {openpgp_type_mpi[]} publicMPIs Algorithm dependent multiprecision integers
* @param secretMPIs [Array[openpgp_type_mpi]] algorithm dependent multiprecision integers of the private key used * of the public key part of the private key
* @param data [openpgp_type_mpi] data to be encrypted as MPI * @param {openpgp_type_mpi[]} secretMPIs Algorithm dependent multiprecision integers
* @return [BigInteger] returns a big integer containing the decrypted data; otherwise null * of the private key used
* @param {openpgp_type_mpi} data Data to be encrypted as MPI
* @return {BigInteger} returns a big integer containing the decrypted data; otherwise null
*/ */
function openpgp_crypto_asymetricDecrypt(algo, publicMPIs, secretMPIs, dataMPIs) { function openpgp_crypto_asymetricDecrypt(algo, publicMPIs, secretMPIs, dataMPIs) {
@ -85,8 +87,8 @@ function openpgp_crypto_asymetricDecrypt(algo, publicMPIs, secretMPIs, dataMPIs)
/** /**
* generate random byte prefix as string for the specified algorithm * generate random byte prefix as string for the specified algorithm
* @param algo [Integer] algorithm to use (see RFC4880 9.2) * @param {Integer} algo Algorithm to use (see RFC4880 9.2)
* @return [String] random bytes with length equal to the block * @return {String} Random bytes with length equal to the block
* size of the cipher * size of the cipher
*/ */
function openpgp_crypto_getPrefixRandom(algo) { function openpgp_crypto_getPrefixRandom(algo) {
@ -107,10 +109,10 @@ function openpgp_crypto_getPrefixRandom(algo) {
/** /**
* retrieve the MDC prefixed bytes by decrypting them * retrieve the MDC prefixed bytes by decrypting them
* @param algo [Integer] algorithm to use (see RFC4880 9.2) * @param {Integer} algo Algorithm to use (see RFC4880 9.2)
* @param key [String] key as string. length is depending on the algorithm used * @param {String} key Key as string. length is depending on the algorithm used
* @param data [String] encrypted data where the prefix is decrypted from * @param {String} data Encrypted data where the prefix is decrypted from
* @return [String] plain text data of the prefixed data * @return {String} Plain text data of the prefixed data
*/ */
function openpgp_crypto_MDCSystemBytes(algo, key, data) { function openpgp_crypto_MDCSystemBytes(algo, key, data) {
util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nencrypteddata:",data); util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nencrypteddata:",data);
@ -138,8 +140,8 @@ function openpgp_crypto_MDCSystemBytes(algo, key, data) {
} }
/** /**
* Generating a session key for the specified symmetric algorithm * Generating a session key for the specified symmetric algorithm
* @param algo [Integer] algorithm to use (see RFC4880 9.2) * @param {Integer} algo Algorithm to use (see RFC4880 9.2)
* @return [String] random bytes as a string to be used as a key * @return {String} Random bytes as a string to be used as a key
*/ */
function openpgp_crypto_generateSessionKey(algo) { function openpgp_crypto_generateSessionKey(algo) {
switch (algo) { switch (algo) {
@ -160,12 +162,12 @@ function openpgp_crypto_generateSessionKey(algo) {
/** /**
* *
* @param algo [Integer] public key algorithm * @param {Integer} algo public Key algorithm
* @param hash_algo [Integer] hash algorithm * @param {Integer} hash_algo Hash algorithm
* @param msg_MPIs [Array[openpgp_type_mpi]] signature multiprecision integers * @param {openpgp_type_mpi[]} msg_MPIs Signature multiprecision integers
* @param publickey_MPIs [Array[openpgp_type_mpi]] public key multiprecision integers * @param {openpgp_type_mpi[]} publickey_MPIs Public key multiprecision integers
* @param data [String] data on where the signature was computed on. * @param {String} data Data on where the signature was computed on.
* @return true if signature (sig_data was equal to data over hash) * @return {Boolean} true if signature (sig_data was equal to data over hash)
*/ */
function openpgp_crypto_verifySignature(algo, hash_algo, msg_MPIs, publickey_MPIs, data) { function openpgp_crypto_verifySignature(algo, hash_algo, msg_MPIs, publickey_MPIs, data) {
var calc_hash = openpgp_crypto_hashData(hash_algo, data); var calc_hash = openpgp_crypto_hashData(hash_algo, data);
@ -207,12 +209,14 @@ function openpgp_crypto_verifySignature(algo, hash_algo, msg_MPIs, publickey_MPI
/** /**
* Create a signature on data using the specified algorithm * Create a signature on data using the specified algorithm
* @param hash_algo [Integer] hash algorithm to use (See RFC4880 9.4) * @param {Integer} hash_algo hash Algorithm to use (See RFC4880 9.4)
* @param algo [Integer] asymmetric cipher algorithm to use (See RFC4880 9.1) * @param {Integer} algo Asymmetric cipher algorithm to use (See RFC4880 9.1)
* @param publicMPIs [Array[openpgp_type_mpi]] public key multiprecision integers of the private key * @param {openpgp_type_mpi[]} publicMPIs Public key multiprecision integers
* @param secretMPIs [Array[openpgp_type_mpi]] private key multiprecision integers which is used to sign the data * of the private key
* @param data [String] data to be signed * @param {openpgp_type_mpi[]} secretMPIs Private key multiprecision
* @return [String or openpgp_type_mpi] * integers which is used to sign the data
* @param {String} data Data to be signed
* @return {(String|openpgp_type_mpi)}
*/ */
function openpgp_crypto_signData(hash_algo, algo, publicMPIs, secretMPIs, data) { function openpgp_crypto_signData(hash_algo, algo, publicMPIs, secretMPIs, data) {
@ -247,10 +251,10 @@ function openpgp_crypto_signData(hash_algo, algo, publicMPIs, secretMPIs, data)
} }
/** /**
* create a hash on the specified data using the specified algorithm * Create a hash on the specified data using the specified algorithm
* @param algo [Integer] hash algorithm type (see RFC4880 9.4) * @param {Integer} algo Hash algorithm type (see RFC4880 9.4)
* @param data [String] data to be hashed * @param {String} data Data to be hashed
* @return [String] hash value * @return {String} hash value
*/ */
function openpgp_crypto_hashData(algo, data) { function openpgp_crypto_hashData(algo, data) {
var hash = null; var hash = null;
@ -282,9 +286,9 @@ function openpgp_crypto_hashData(algo, data) {
} }
/** /**
* returns the hash size in bytes of the specified hash algorithm type * Returns the hash size in bytes of the specified hash algorithm type
* @param algo [Integer] hash algorithm type (See RFC4880 9.4) * @param {Integer} algo Hash algorithm type (See RFC4880 9.4)
* @return [Integer] size in bytes of the resulting hash * @return {Integer} Size in bytes of the resulting hash
*/ */
function openpgp_crypto_getHashByteLength(algo) { function openpgp_crypto_getHashByteLength(algo) {
var hash = null; var hash = null;
@ -307,9 +311,9 @@ function openpgp_crypto_getHashByteLength(algo) {
} }
/** /**
* retrieve secure random byte string of the specified length * Retrieve secure random byte string of the specified length
* @param length [Integer] length in bytes to generate * @param {Integer} length Length in bytes to generate
* @return [String] random byte string * @return {String} Random byte string
*/ */
function openpgp_crypto_getRandomBytes(length) { function openpgp_crypto_getRandomBytes(length) {
var result = ''; var result = '';
@ -320,20 +324,20 @@ function openpgp_crypto_getRandomBytes(length) {
} }
/** /**
* return a pseudo-random number in the specified range * Return a pseudo-random number in the specified range
* @param from [Integer] min of the random number * @param {Integer} from Min of the random number
* @param to [Integer] max of the random number (max 32bit) * @param {Integer} to Max of the random number (max 32bit)
* @return [Integer] a pseudo random number * @return {Integer} A pseudo random number
*/ */
function openpgp_crypto_getPseudoRandom(from, to) { function openpgp_crypto_getPseudoRandom(from, to) {
return Math.round(Math.random()*(to-from))+from; return Math.round(Math.random()*(to-from))+from;
} }
/** /**
* return a secure random number in the specified range * Return a secure random number in the specified range
* @param from [Integer] min of the random number * @param {Integer} from Min of the random number
* @param to [Integer] max of the random number (max 32bit) * @param {Integer} to Max of the random number (max 32bit)
* @return [Integer] a secure random number * @return {Integer} A secure random number
*/ */
function openpgp_crypto_getSecureRandom(from, to) { function openpgp_crypto_getSecureRandom(from, to) {
var buf = new Uint32Array(1); var buf = new Uint32Array(1);
@ -351,9 +355,9 @@ function openpgp_crypto_getSecureRandomOctet() {
} }
/** /**
* create a secure random big integer of bits length * Create a secure random big integer of bits length
* @param bits [Integer] bit length of the MPI to create * @param {Integer} bits Bit length of the MPI to create
* @return [BigInteger] resulting big integer * @return {BigInteger} Resulting big integer
*/ */
function openpgp_crypto_getRandomBigInteger(bits) { function openpgp_crypto_getRandomBigInteger(bits) {
if (bits < 0) if (bits < 0)
@ -392,11 +396,19 @@ function openpgp_crypto_testRSA(key){
var msg = rsa.encrypt(mpi.toBigInteger(),key.ee,key.n); var msg = rsa.encrypt(mpi.toBigInteger(),key.ee,key.n);
var result = rsa.decrypt(msg, key.d, key.p, key.q, key.u); var result = rsa.decrypt(msg, key.d, key.p, key.q, key.u);
} }
/** /**
* calls the necessary crypto functions to generate a keypair. Called directly by openpgp.js * @typedef {Object} openpgp_keypair
* @keyType [int] follows OpenPGP algorithm convention. * @property {openpgp_packet_keymaterial} privateKey
* @numBits [int] number of bits to make the key to be generated * @property {openpgp_packet_keymaterial} publicKey
* @return {privateKey: [openpgp_packet_keymaterial] , publicKey: [openpgp_packet_keymaterial]} */
/**
* Calls the necessary crypto functions to generate a keypair.
* Called directly by openpgp.js
* @param {Integer} keyType Follows OpenPGP algorithm convention.
* @param {Integer} numBits Number of bits to make the key to be generated
* @return {openpgp_keypair}
*/ */
function openpgp_crypto_generateKeyPair(keyType, numBits, passphrase, s2kHash, symmetricEncryptionAlgorithm){ function openpgp_crypto_generateKeyPair(keyType, numBits, passphrase, s2kHash, symmetricEncryptionAlgorithm){
var privKeyPacket; var privKeyPacket;

View File

@ -21,14 +21,14 @@
* Symmetrically encrypts data using prefixedrandom, a key with length * Symmetrically encrypts data using prefixedrandom, a key with length
* depending on the algorithm in openpgp_cfb mode with or without resync * depending on the algorithm in openpgp_cfb mode with or without resync
* (MDC style) * (MDC style)
* @param prefixrandom secure random bytes as string in length equal to the * @param {String} prefixrandom Secure random bytes as string in
* block size of the algorithm used (use openpgp_crypto_getPrefixRandom(algo) * length equal to the block size of the algorithm used (use
* to retrieve that string * openpgp_crypto_getPrefixRandom(algo) to retrieve that string
* @param algo [Integer] algorithm to use (see RFC4880 9.2) * @param {Integer} algo Algorithm to use (see RFC4880 9.2)
* @param key [String] key as string. length is depending on the algorithm used * @param {String} key Key as string. length is depending on the algorithm used
* @param data [String] data to encrypt * @param {String} data Data to encrypt
* @param openpgp_cfb [boolean] * @param {Boolean} openpgp_cfb
* @return [String] encrypted data * @return {String} Encrypted data
*/ */
function openpgp_crypto_symmetricEncrypt(prefixrandom, algo, key, data, openpgp_cfb) { function openpgp_crypto_symmetricEncrypt(prefixrandom, algo, key, data, openpgp_cfb) {
switch(algo) { switch(algo) {
@ -57,12 +57,12 @@ function openpgp_crypto_symmetricEncrypt(prefixrandom, algo, key, data, openpgp_
/** /**
* Symmetrically decrypts data using a key with length depending on the * Symmetrically decrypts data using a key with length depending on the
* algorithm in openpgp_cfb mode with or without resync (MDC style) * algorithm in openpgp_cfb mode with or without resync (MDC style)
* @param algo [Integer] algorithm to use (see RFC4880 9.2) * @param {Integer} algo Algorithm to use (see RFC4880 9.2)
* @param key [String] key as string. length is depending on the algorithm used * @param {String} key Key as string. length is depending on the algorithm used
* @param data [String] data to be decrypted * @param {String} data Data to be decrypted
* @param openpgp_cfb [boolean] if true use the resync (for encrypteddata); * @param {Boolean} openpgp_cfb If true use the resync (for encrypteddata);
* otherwise use without the resync (for MDC encrypted data) * otherwise use without the resync (for MDC encrypted data)
* @return [String] plaintext data * @return {String} Plaintext data
*/ */
function openpgp_crypto_symmetricDecrypt(algo, key, data, openpgp_cfb) { function openpgp_crypto_symmetricDecrypt(algo, key, data, openpgp_cfb) {
util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nalgo:"+algo+"\nencrypteddata:",data); util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nalgo:"+algo+"\nencrypteddata:",data);
@ -91,4 +91,4 @@ function openpgp_crypto_symmetricDecrypt(algo, key, data, openpgp_cfb) {
default: default:
} }
return null; return null;
} }

View File

@ -29,8 +29,8 @@ JXG.decompress = function(str) {return unescape((new JXG.Util.Unzip(JXG.Util.Bas
* *
* Only Huffman codes are decoded in gunzip. * Only Huffman codes are decoded in gunzip.
* The code is based on the source code for gunzip.c by Pasi Ojala * The code is based on the source code for gunzip.c by Pasi Ojala
* @see <a href="http://www.cs.tut.fi/~albert/Dev/gunzip/gunzip.c">http://www.cs.tut.fi/~albert/Dev/gunzip/gunzip.c</a> * {@link http://www.cs.tut.fi/~albert/Dev/gunzip/gunzip.c}
* @see <a href="http://www.cs.tut.fi/~albert">http://www.cs.tut.fi/~albert</a> * {@link http://www.cs.tut.fi/~albert}
*/ */
JXG.Util = {}; JXG.Util = {};
@ -925,7 +925,7 @@ function skipdir(){
/** /**
* Base64 encoding / decoding * Base64 encoding / decoding
* @see <a href="http://www.webtoolkit.info/">http://www.webtoolkit.info/</A> * {@link http://www.webtoolkit.info/}
*/ */
JXG.Util.Base64 = { JXG.Util.Base64 = {

View File

@ -28,10 +28,21 @@
* @classdesc Implementation of the GPG4Browsers config object * @classdesc Implementation of the GPG4Browsers config object
*/ */
function openpgp_config() { function openpgp_config() {
/**
* The variable with the actual configuration
* @property {Integer} prefer_hash_algorithm
* @property {Integer} encryption_cipher
* @property {Integer} compression
* @property {Boolean} show_version
* @property {Boolean} show_comment
* @property {Boolean} integrity_protect
* @property {Integer} composition_behavior
* @property {String} keyserver
*/
this.config = null; this.config = null;
/** /**
* the default config object which is used if no * The default config object which is used if no
* configuration was in place * configuration was in place
*/ */
this.default_config = { this.default_config = {
@ -48,10 +59,9 @@ function openpgp_config() {
this.versionstring ="OpenPGP.js VERSION"; this.versionstring ="OpenPGP.js VERSION";
this.commentstring ="http://openpgpjs.org"; this.commentstring ="http://openpgpjs.org";
/** /**
* reads the config out of the HTML5 local storage * Reads the config out of the HTML5 local storage
* and initializes the object config. * and initializes the object config.
* if config is null the default config will be used * if config is null the default config will be used
* @return [void]
*/ */
function read() { function read() {
var cf = JSON.parse(window.localStorage.getItem("config")); var cf = JSON.parse(window.localStorage.getItem("config"));
@ -64,13 +74,12 @@ function openpgp_config() {
} }
/** /**
* if enabled, debug messages will be printed * If enabled, debug messages will be printed
*/ */
this.debug = false; this.debug = false;
/** /**
* writes the config to HTML5 local storage * Writes the config to HTML5 local storage
* @return [void]
*/ */
function write() { function write() {
window.localStorage.setItem("config",JSON.stringify(this.config)); window.localStorage.setItem("config",JSON.stringify(this.config));

View File

@ -16,9 +16,11 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes * DeArmor an OpenPGP armored message; verify the checksum and return
* @text [String] OpenPGP armored message * the encoded bytes
* @return either the bytes of the decoded message or an object with attribute "text" containing the message text * @param {String} text OpenPGP armored message
* @returns {(String|Object)} Either the bytes of the decoded message
* or an object with attribute "text" containing the message text
* and an attribute "openpgp" containing the bytes. * and an attribute "openpgp" containing the bytes.
*/ */
function openpgp_encoding_deArmor(text) { function openpgp_encoding_deArmor(text) {
@ -45,8 +47,8 @@ function openpgp_encoding_deArmor(text) {
/** /**
* Finds out which Ascii Armoring type is used. This is an internal function * Finds out which Ascii Armoring type is used. This is an internal function
* @param text [String] ascii armored text * @param {String} text [String] ascii armored text
* @return 0 = MESSAGE PART n of m * @returns {Integer} 0 = MESSAGE PART n of m
* 1 = MESSAGE PART n * 1 = MESSAGE PART n
* 2 = SIGNED MESSAGE * 2 = SIGNED MESSAGE
* 3 = PGP MESSAGE * 3 = PGP MESSAGE
@ -102,7 +104,7 @@ function getPGPMessageType(text) {
* packet block. * packet block.
* @author Alex * @author Alex
* @version 2011-12-16 * @version 2011-12-16
* @return The header information * @returns {String} The header information
*/ */
function openpgp_encoding_armor_addheader() { function openpgp_encoding_armor_addheader() {
var result = ""; var result = "";
@ -118,11 +120,11 @@ function openpgp_encoding_armor_addheader() {
/** /**
* Armor an OpenPGP binary packet block * Armor an OpenPGP binary packet block
* @param messagetype type of the message * @param {Integer} messagetype type of the message
* @param data * @param data
* @param partindex * @param {Integer} partindex
* @param parttotal * @param {Integer} parttotal
* @return {string} Armored text * @returns {String} Armored text
*/ */
function openpgp_encoding_armor(messagetype, data, partindex, parttotal) { function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
var result = ""; var result = "";
@ -178,8 +180,8 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
/** /**
* Calculates a checksum over the given data and returns it base64 encoded * Calculates a checksum over the given data and returns it base64 encoded
* @param data [String] data to create a CRC-24 checksum for * @param {String} data Data to create a CRC-24 checksum for
* @return [String] base64 encoded checksum * @return {String} Base64 encoded checksum
*/ */
function getCheckSum(data) { function getCheckSum(data) {
var c = createcrc24(data); var c = createcrc24(data);
@ -190,10 +192,11 @@ function getCheckSum(data) {
} }
/** /**
* Calculates the checksum over the given data and compares it with the given base64 encoded checksum * Calculates the checksum over the given data and compares it with the
* @param data [String] data to create a CRC-24 checksum for * given base64 encoded checksum
* @param checksum [String] base64 encoded checksum * @param {String} data Data to create a CRC-24 checksum for
* @return true if the given checksum is correct; otherwise false * @param {String} checksum Base64 encoded checksum
* @return {Boolean} True if the given checksum is correct; otherwise false
*/ */
function verifyCheckSum(data, checksum) { function verifyCheckSum(data, checksum) {
var c = getCheckSum(data); var c = getCheckSum(data);
@ -202,8 +205,8 @@ function verifyCheckSum(data, checksum) {
} }
/** /**
* Internal function to calculate a CRC-24 checksum over a given string (data) * Internal function to calculate a CRC-24 checksum over a given string (data)
* @param data [String] data to create a CRC-24 checksum for * @param {String} data Data to create a CRC-24 checksum for
* @return [Integer] the CRC-24 checksum as number * @return {Integer} The CRC-24 checksum as number
*/ */
var crc_table = [ var crc_table = [
0x00000000, 0x00864cfb, 0x018ad50d, 0x010c99f6, 0x0393e6e1, 0x0315aa1a, 0x021933ec, 0x029f7f17, 0x07a18139, 0x0727cdc2, 0x062b5434, 0x06ad18cf, 0x043267d8, 0x04b42b23, 0x05b8b2d5, 0x053efe2e, 0x0fc54e89, 0x0f430272, 0x0e4f9b84, 0x0ec9d77f, 0x0c56a868, 0x0cd0e493, 0x0ddc7d65, 0x0d5a319e, 0x0864cfb0, 0x08e2834b, 0x09ee1abd, 0x09685646, 0x0bf72951, 0x0b7165aa, 0x0a7dfc5c, 0x0afbb0a7, 0x1f0cd1e9, 0x1f8a9d12, 0x1e8604e4, 0x1e00481f, 0x1c9f3708, 0x1c197bf3, 0x1d15e205, 0x1d93aefe, 0x18ad50d0, 0x182b1c2b, 0x192785dd, 0x19a1c926, 0x1b3eb631, 0x1bb8faca, 0x1ab4633c, 0x1a322fc7, 0x10c99f60, 0x104fd39b, 0x11434a6d, 0x11c50696, 0x135a7981, 0x13dc357a, 0x12d0ac8c, 0x1256e077, 0x17681e59, 0x17ee52a2, 0x16e2cb54, 0x166487af, 0x14fbf8b8, 0x147db443, 0x15712db5, 0x15f7614e, 0x3e19a3d2, 0x3e9fef29, 0x3f9376df, 0x3f153a24, 0x3d8a4533, 0x3d0c09c8, 0x3c00903e, 0x3c86dcc5, 0x39b822eb, 0x393e6e10, 0x3832f7e6, 0x38b4bb1d, 0x3a2bc40a, 0x3aad88f1, 0x3ba11107, 0x3b275dfc, 0x31dced5b, 0x315aa1a0, 0x00000000, 0x00864cfb, 0x018ad50d, 0x010c99f6, 0x0393e6e1, 0x0315aa1a, 0x021933ec, 0x029f7f17, 0x07a18139, 0x0727cdc2, 0x062b5434, 0x06ad18cf, 0x043267d8, 0x04b42b23, 0x05b8b2d5, 0x053efe2e, 0x0fc54e89, 0x0f430272, 0x0e4f9b84, 0x0ec9d77f, 0x0c56a868, 0x0cd0e493, 0x0ddc7d65, 0x0d5a319e, 0x0864cfb0, 0x08e2834b, 0x09ee1abd, 0x09685646, 0x0bf72951, 0x0b7165aa, 0x0a7dfc5c, 0x0afbb0a7, 0x1f0cd1e9, 0x1f8a9d12, 0x1e8604e4, 0x1e00481f, 0x1c9f3708, 0x1c197bf3, 0x1d15e205, 0x1d93aefe, 0x18ad50d0, 0x182b1c2b, 0x192785dd, 0x19a1c926, 0x1b3eb631, 0x1bb8faca, 0x1ab4633c, 0x1a322fc7, 0x10c99f60, 0x104fd39b, 0x11434a6d, 0x11c50696, 0x135a7981, 0x13dc357a, 0x12d0ac8c, 0x1256e077, 0x17681e59, 0x17ee52a2, 0x16e2cb54, 0x166487af, 0x14fbf8b8, 0x147db443, 0x15712db5, 0x15f7614e, 0x3e19a3d2, 0x3e9fef29, 0x3f9376df, 0x3f153a24, 0x3d8a4533, 0x3d0c09c8, 0x3c00903e, 0x3c86dcc5, 0x39b822eb, 0x393e6e10, 0x3832f7e6, 0x38b4bb1d, 0x3a2bc40a, 0x3aad88f1, 0x3ba11107, 0x3b275dfc, 0x31dced5b, 0x315aa1a0,

View File

@ -18,8 +18,8 @@
/** /**
* Wrapper function for the base64 codec. * Wrapper function for the base64 codec.
* This function encodes a String (message) in base64 (radix-64) * This function encodes a String (message) in base64 (radix-64)
* @param message [String] the message to encode * @param {String} message The message to encode
* @return [String] the base64 encoded data * @return {String} The base64 encoded data
*/ */
function openpgp_encoding_base64_encode(message) { function openpgp_encoding_base64_encode(message) {
return s2r(message); return s2r(message);
@ -29,8 +29,8 @@ function openpgp_encoding_base64_encode(message) {
/** /**
* Wrapper function for the base64 codec. * Wrapper function for the base64 codec.
* This function decodes a String(message) in base64 (radix-64) * This function decodes a String(message) in base64 (radix-64)
* @param message [String] base64 encoded data * @param {String} message Base64 encoded data
* @return [String] raw data after decoding * @return {String} Raw data after decoding
*/ */
function openpgp_encoding_base64_decode(message) { function openpgp_encoding_base64_decode(message) {
return r2s(message); return r2s(message);
@ -38,9 +38,10 @@ function openpgp_encoding_base64_decode(message) {
/** /**
* Wrapper function for jquery library. * Wrapper function for jquery library.
* This function escapes HTML characters within a string. This is used to prevent XSS. * This function escapes HTML characters within a string. This is used
* @param message [String] message to escape * to prevent XSS.
* @return [String] html encoded string * @param {String} message Message to escape
* @return {String} Html encoded string
*/ */
function openpgp_encoding_html_encode(message) { function openpgp_encoding_html_encode(message) {
if (message == null) if (message == null)
@ -50,9 +51,9 @@ function openpgp_encoding_html_encode(message) {
/** /**
* create a EME-PKCS1-v1_5 padding (See RFC4880 13.1.1) * create a EME-PKCS1-v1_5 padding (See RFC4880 13.1.1)
* @param message [String] message to be padded * @param {String} message message to be padded
* @param length [Integer] length to the resulting message * @param {Integer} length Length to the resulting message
* @return [String] EME-PKCS1 padded message * @return {String} EME-PKCS1 padded message
*/ */
function openpgp_encoding_eme_pkcs1_encode(message, length) { function openpgp_encoding_eme_pkcs1_encode(message, length) {
if (message.length > length-11) if (message.length > length-11)
@ -70,8 +71,8 @@ function openpgp_encoding_eme_pkcs1_encode(message, length) {
/** /**
* decodes a EME-PKCS1-v1_5 padding (See RFC4880 13.1.2) * decodes a EME-PKCS1-v1_5 padding (See RFC4880 13.1.2)
* @param message [String] EME-PKCS1 padded message * @param {String} message EME-PKCS1 padded message
* @return [String] decoded message * @return {String} decoded message
*/ */
function openpgp_encoding_eme_pkcs1_decode(message, len) { function openpgp_encoding_eme_pkcs1_decode(message, len) {
if (message.length < len) if (message.length < len)
@ -97,10 +98,10 @@ hash_headers[11] = [0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,
/** /**
* create a EMSA-PKCS1-v1_5 padding (See RFC4880 13.1.3) * create a EMSA-PKCS1-v1_5 padding (See RFC4880 13.1.3)
* @param algo [Integer] hash algorithm type used * @param {Integer} algo Hash algorithm type used
* @param data [String] data to be hashed * @param {String} data Data to be hashed
* @param keylength [Integer] key size of the public mpi in bytes * @param {Integer} keylength Key size of the public mpi in bytes
* @return the [String] hashcode with pkcs1padding as string * @returns {String} Hashcode with pkcs1padding as string
*/ */
function openpgp_encoding_emsa_pkcs1_encode(algo, data, keylength) { function openpgp_encoding_emsa_pkcs1_encode(algo, data, keylength) {
var data2 = ""; var data2 = "";
@ -119,8 +120,8 @@ function openpgp_encoding_emsa_pkcs1_encode(algo, data, keylength) {
/** /**
* extract the hash out of an EMSA-PKCS1-v1.5 padding (See RFC4880 13.1.3) * extract the hash out of an EMSA-PKCS1-v1.5 padding (See RFC4880 13.1.3)
* @param data [String] hash in pkcs1 encoding * @param {String} data Hash in pkcs1 encoding
* @return the hash as string * @returns {String} The hash as string
*/ */
function openpgp_encoding_emsa_pkcs1_decode(algo, data) { function openpgp_encoding_emsa_pkcs1_decode(algo, data) {
var i = 0; var i = 0;
@ -137,4 +138,4 @@ function openpgp_encoding_emsa_pkcs1_decode(algo, data) {
i+= j; i+= j;
if (data.substring(i).length < openpgp_crypto_getHashByteLength(algo)) return -1; if (data.substring(i).length < openpgp_crypto_getHashByteLength(algo)) return -1;
return data.substring(i); return data.substring(i);
} }

View File

@ -35,7 +35,6 @@ function _openpgp () {
* initializes the library: * initializes the library:
* - reading the keyring from local storage * - reading the keyring from local storage
* - reading the config from local storage * - reading the config from local storage
* @return [void]
*/ */
function init() { function init() {
this.config = new openpgp_config(); this.config = new openpgp_config();
@ -49,7 +48,7 @@ function _openpgp () {
* representation an returns openpgp_msg_publickey packets * representation an returns openpgp_msg_publickey packets
* @param {String} armoredText OpenPGP armored text containing * @param {String} armoredText OpenPGP armored text containing
* the public key(s) * the public key(s)
* @return {Array[openpgp_msg_publickey]} on error the function * @return {openpgp_msg_publickey[]} on error the function
* returns null * returns null
*/ */
function read_publicKey(armoredText) { function read_publicKey(armoredText) {
@ -95,7 +94,7 @@ function _openpgp () {
* representation an returns openpgp_msg_privatekey objects * representation an returns openpgp_msg_privatekey objects
* @param {String} armoredText OpenPGP armored text containing * @param {String} armoredText OpenPGP armored text containing
* the private key(s) * the private key(s)
* @return {Array[openpgp_msg_privatekey]} on error the function * @return {openpgp_msg_privatekey[]} on error the function
* returns null * returns null
*/ */
function read_privateKey(armoredText) { function read_privateKey(armoredText) {
@ -125,7 +124,7 @@ function _openpgp () {
* reads message packets out of an OpenPGP armored text and * reads message packets out of an OpenPGP armored text and
* returns an array of message objects * returns an array of message objects
* @param {String} armoredText text to be parsed * @param {String} armoredText text to be parsed
* @return {Array[openpgp_msg_message]} on error the function * @return {openpgp_msg_message[]} on error the function
* returns null * returns null
*/ */
function read_message(armoredText) { function read_message(armoredText) {
@ -146,7 +145,7 @@ function _openpgp () {
* External call will parse a de-armored messaged and return messages found. * External call will parse a de-armored messaged and return messages found.
* Internal will be called to read packets wrapped in other packets (i.e. compressed) * Internal will be called to read packets wrapped in other packets (i.e. compressed)
* @param {String} input dearmored text of OpenPGP packets, to be parsed * @param {String} input dearmored text of OpenPGP packets, to be parsed
* @return {Array[openpgp_msg_message]} on error the function * @return {openpgp_msg_message[]} on error the function
* returns null * returns null
*/ */
function read_messages_dearmored(input){ function read_messages_dearmored(input){
@ -291,10 +290,13 @@ function _openpgp () {
* creates a binary string representation of an encrypted and signed message. * creates a binary string representation of an encrypted and signed message.
* The message will be encrypted with the public keys specified and signed * The message will be encrypted with the public keys specified and signed
* with the specified private key. * with the specified private key.
* @param {obj: [openpgp_msg_privatekey]} privatekey private key to be used to sign the message * @param {Object} privatekey {obj: [openpgp_msg_privatekey]} Private key
* @param {Array {obj: [openpgp_msg_publickey]}} publickeys public keys to be used to encrypt the message * to be used to sign the message
* @param {Object[]} publickeys An arraf of {obj: [openpgp_msg_publickey]}
* - public keys to be used to encrypt the message
* @param {String} messagetext message text to encrypt and sign * @param {String} messagetext message text to encrypt and sign
* @return {String} a binary string representation of the message which can be OpenPGP armored * @return {String} a binary string representation of the message which
* can be OpenPGP armored
*/ */
function write_signed_and_encrypted_message(privatekey, publickeys, messagetext) { function write_signed_and_encrypted_message(privatekey, publickeys, messagetext) {
var result = ""; var result = "";
@ -347,8 +349,8 @@ function _openpgp () {
/** /**
* creates a binary string representation of an encrypted message. * creates a binary string representation of an encrypted message.
* The message will be encrypted with the public keys specified * The message will be encrypted with the public keys specified
* @param {Array {obj: [openpgp_msg_publickey]}} publickeys public * @param {Object[]} publickeys An array of {obj: [openpgp_msg_publickey]}
* keys to be used to encrypt the message * -public keys to be used to encrypt the message
* @param {String} messagetext message text to encrypt * @param {String} messagetext message text to encrypt
* @return {String} a binary string representation of the message * @return {String} a binary string representation of the message
* which can be OpenPGP armored * which can be OpenPGP armored
@ -389,12 +391,13 @@ function _openpgp () {
/** /**
* creates a binary string representation a signed message. * creates a binary string representation a signed message.
* The message will be signed with the specified private key. * The message will be signed with the specified private key.
* @param {obj: [openpgp_msg_privatekey]} privatekey private * @param {Object} privatekey {obj: [openpgp_msg_privatekey]}
* key to be used to sign the message * - the private key to be used to sign the message
* @param {String} messagetext message text to sign * @param {String} messagetext message text to sign
* @return {Object: text [String]}, openpgp: {String} a binary * @return {Object} {Object: text [String]}, openpgp: {String} a binary
* string representation of the message which can be OpenPGP * string representation of the message which can be OpenPGP
* armored(openpgp) and a text representation of the message (text). This can be directly used to OpenPGP armor the message * armored(openpgp) and a text representation of the message (text).
* This can be directly used to OpenPGP armor the message
*/ */
function write_signed_message(privatekey, messagetext) { function write_signed_message(privatekey, messagetext) {
var sig = new openpgp_packet_signature().write_message_signature(1, messagetext.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"), privatekey); var sig = new openpgp_packet_signature().write_message_signature(1, messagetext.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"), privatekey);
@ -403,11 +406,16 @@ function _openpgp () {
} }
/** /**
* generates a new key pair for openpgp. Beta stage. Currently only supports RSA keys, and no subkeys. * generates a new key pair for openpgp. Beta stage. Currently only
* @param {int} keyType to indicate what type of key to make. RSA is 1. Follows algorithms outlined in OpenPGP. * supports RSA keys, and no subkeys.
* @param {int} numBits number of bits for the key creation. (should be 1024+, generally) * @param {Integer} keyType to indicate what type of key to make.
* @param {string} userId assumes already in form of "User Name <username@email.com>" * RSA is 1. Follows algorithms outlined in OpenPGP.
* @return {privateKey: [openpgp_msg_privatekey], privateKeyArmored: [string], publicKeyArmored: [string]} * @param {Integer} numBits number of bits for the key creation. (should
* be 1024+, generally)
* @param {String} userId assumes already in form of "User Name
* <username@email.com>"
* @return {Object} {privateKey: [openpgp_msg_privatekey],
* privateKeyArmored: [string], publicKeyArmored: [string]}
*/ */
function generate_key_pair(keyType, numBits, userId, passphrase){ function generate_key_pair(keyType, numBits, userId, passphrase){
var userIdPacket = new openpgp_packet_userid(); var userIdPacket = new openpgp_packet_userid();

View File

@ -25,7 +25,6 @@ function openpgp_keyring() {
* Initialization routine for the keyring. This method reads the * Initialization routine for the keyring. This method reads the
* keyring from HTML5 local storage and initializes this instance. * keyring from HTML5 local storage and initializes this instance.
* This method is called by openpgp.init(). * This method is called by openpgp.init().
* @return {null} undefined
*/ */
function init() { function init() {
var sprivatekeys = JSON.parse(window.localStorage.getItem("privatekeys")); var sprivatekeys = JSON.parse(window.localStorage.getItem("privatekeys"));
@ -58,7 +57,7 @@ function openpgp_keyring() {
/** /**
* Checks if at least one private key is in the keyring * Checks if at least one private key is in the keyring
* @return {boolean} True if there are private keys, else false. * @return {Boolean} True if there are private keys, else false.
*/ */
function hasPrivateKey() { function hasPrivateKey() {
return this.privateKeys.length > 0; return this.privateKeys.length > 0;
@ -68,7 +67,6 @@ function openpgp_keyring() {
/** /**
* Saves the current state of the keyring to HTML5 local storage. * Saves the current state of the keyring to HTML5 local storage.
* The privateKeys array and publicKeys array gets Stringified using JSON * The privateKeys array and publicKeys array gets Stringified using JSON
* @return {null} undefined
*/ */
function store() { function store() {
var priv = new Array(); var priv = new Array();
@ -85,8 +83,8 @@ function openpgp_keyring() {
this.store = store; this.store = store;
/** /**
* searches all public keys in the keyring matching the address or address part of the user ids * searches all public keys in the keyring matching the address or address part of the user ids
* @param email_address * @param {String} email_address
* @return {array[openpgp_msg_publickey]} the public keys associated with provided email address. * @return {openpgp_msg_publickey[]} The public keys associated with provided email address.
*/ */
function getPublicKeyForAddress(email_address) { function getPublicKeyForAddress(email_address) {
var results = new Array(); var results = new Array();
@ -114,7 +112,7 @@ function openpgp_keyring() {
/** /**
* Searches the keyring for a private key containing the specified email address * Searches the keyring for a private key containing the specified email address
* @param {String} email_address email address to search for * @param {String} email_address email address to search for
* @return {Array[openpgp_msg_privatekey} private keys found * @return {openpgp_msg_privatekey[]} private keys found
*/ */
function getPrivateKeyForAddress(email_address) { function getPrivateKeyForAddress(email_address) {
var results = new Array(); var results = new Array();
@ -141,8 +139,8 @@ function openpgp_keyring() {
this.getPrivateKeyForAddress = getPrivateKeyForAddress; this.getPrivateKeyForAddress = getPrivateKeyForAddress;
/** /**
* Searches the keyring for public keys having the specified key id * Searches the keyring for public keys having the specified key id
* @param keyId provided as string of hex number (lowercase) * @param {String} keyId provided as string of hex number (lowercase)
* @return {Array[openpgp_msg_privatekey]} public keys found * @return {openpgp_msg_privatekey[]} public keys found
*/ */
function getPublicKeysForKeyId(keyId) { function getPublicKeysForKeyId(keyId) {
var result = new Array(); var result = new Array();
@ -169,7 +167,7 @@ function openpgp_keyring() {
/** /**
* Searches the keyring for private keys having the specified key id * Searches the keyring for private keys having the specified key id
* @param {String} keyId 8 bytes as string containing the key id to look for * @param {String} keyId 8 bytes as string containing the key id to look for
* @return {Array[openpgp_msg_privatekey]} private keys found * @return {openpgp_msg_privatekey[]} private keys found
*/ */
function getPrivateKeyForKeyId(keyId) { function getPrivateKeyForKeyId(keyId) {
var result = new Array(); var result = new Array();
@ -192,7 +190,6 @@ function openpgp_keyring() {
/** /**
* Imports a public key from an exported ascii armored message * Imports a public key from an exported ascii armored message
* @param {String} armored_text PUBLIC KEY BLOCK message to read the public key from * @param {String} armored_text PUBLIC KEY BLOCK message to read the public key from
* @return {null} nothing
*/ */
function importPublicKey (armored_text) { function importPublicKey (armored_text) {
var result = openpgp.read_publicKey(armored_text); var result = openpgp.read_publicKey(armored_text);
@ -205,7 +202,6 @@ function openpgp_keyring() {
/** /**
* Imports a private key from an exported ascii armored message * Imports a private key from an exported ascii armored message
* @param {String} armored_text PRIVATE KEY BLOCK message to read the private key from * @param {String} armored_text PRIVATE KEY BLOCK message to read the private key from
* @return {null} nothing
*/ */
function importPrivateKey (armored_text, password) { function importPrivateKey (armored_text, password) {
var result = openpgp.read_privateKey(armored_text); var result = openpgp.read_privateKey(armored_text);

View File

@ -155,7 +155,7 @@ function openpgp_msg_publickey() {
* - subkey binding and revocation certificates * - subkey binding and revocation certificates
* *
* This is useful for validating the key * This is useful for validating the key
* @returns true if the basic signatures are all valid * @returns {Boolean} true if the basic signatures are all valid
*/ */
function verifyBasicSignatures() { function verifyBasicSignatures() {
for (var i = 0; i < this.revocationSignatures.length; i++) { for (var i = 0; i < this.revocationSignatures.length; i++) {

View File

@ -30,11 +30,12 @@ function openpgp_packet_compressed() {
this.decompressedData = null; this.decompressedData = null;
/** /**
* parsing function for the packet. * Parsing function for the packet.
* @param {string} input payload of a tag 8 packet * @param {String} input Payload of a tag 8 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of input at position * @param {Integer} len Length of the packet or the remaining length of
* @return {openpgp_packet_compressed} object representation * input at position
* @return {openpgp_packet_compressed} Object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -46,9 +47,9 @@ function openpgp_packet_compressed() {
return this; return this;
} }
/** /**
* decompression method for decompressing the compressed data * Decompression method for decompressing the compressed data
* read by read_packet * read by read_packet
* @return {String} the decompressed data * @return {String} The decompressed data
*/ */
function decompress() { function decompress() {
if (this.decompressedData != null) if (this.decompressedData != null)
@ -99,8 +100,8 @@ function openpgp_packet_compressed() {
/** /**
* Compress the packet data (member decompressedData) * Compress the packet data (member decompressedData)
* @param {integer} type algorithm to be used // See RFC 4880 9.3 * @param {Integer} type Algorithm to be used // See RFC 4880 9.3
* @param {String} data data to be compressed * @param {String} data Data to be compressed
* @return {String} The compressed data stored in attribute compressedData * @return {String} The compressed data stored in attribute compressedData
*/ */
function compress(type, data) { function compress(type, data) {
@ -130,10 +131,10 @@ function openpgp_packet_compressed() {
} }
/** /**
* creates a string representation of the packet * Creates a string representation of the packet
* @param {integer} algorithm algorithm to be used // See RFC 4880 9.3 * @param {Integer} algorithm Algorithm to be used // See RFC 4880 9.3
* @param {String} data data to be compressed * @param {String} data Data to be compressed
* @return {String} string-representation of the packet * @return {String} String-representation of the packet
*/ */
function write_packet(algorithm, data) { function write_packet(algorithm, data) {
this.decompressedData = data; this.decompressedData = data;
@ -145,7 +146,7 @@ function openpgp_packet_compressed() {
} }
/** /**
* pretty printing the packet (useful for debug purposes) * Pretty printing the packet (useful for debug purposes)
* @return {String} * @return {String}
*/ */
function toString() { function toString() {

View File

@ -33,13 +33,13 @@ function openpgp_packet_encrypteddata() {
this.decryptedData = null; this.decryptedData = null;
/** /**
* parsing function for the packet. * Parsing function for the packet.
* *
* @param {string} input payload of a tag 9 packet * @param {String} input Payload of a tag 9 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of * @param {Integer} len Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} Object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
var mypos = position; var mypos = position;
@ -51,14 +51,14 @@ function openpgp_packet_encrypteddata() {
} }
/** /**
* symmetrically decrypt the packet data * Symmetrically decrypt the packet data
* *
* @param {integer} symmetric_algorithm_type * @param {Integer} symmetric_algorithm_type
* symmetric key algorithm to use // See RFC4880 9.2 * Symmetric key algorithm to use // See RFC4880 9.2
* @param {String} key * @param {String} key
* key as string with the corresponding length to the * Key as string with the corresponding length to the
* algorithm * algorithm
* @return the decrypted data; * @return The decrypted data;
*/ */
function decrypt_sym(symmetric_algorithm_type, key) { function decrypt_sym(symmetric_algorithm_type, key) {
this.decryptedData = openpgp_crypto_symmetricDecrypt( this.decryptedData = openpgp_crypto_symmetricDecrypt(
@ -71,11 +71,11 @@ function openpgp_packet_encrypteddata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param {Integer} algo symmetric key algorithm to use // See RFC4880 9.2 * @param {Integer} algo Symmetric key algorithm to use // See RFC4880 9.2
* @param {String} key key as string with the corresponding length to the * @param {String} key Key as string with the corresponding length to the
* algorithm * algorithm
* @param {String} data data to be * @param {String} data Data to be
* @return {String} string-representation of the packet * @return {String} String-representation of the packet
*/ */
function write_packet(algo, key, data) { function write_packet(algo, key, data) {
var result = ""; var result = "";

View File

@ -17,7 +17,8 @@
/** /**
* @class * @class
* @classdesc Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18) * @classdesc Implementation of the Sym. Encrypted Integrity Protected Data
* Packet (Tag 18)
* *
* RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is * RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is
* a variant of the Symmetrically Encrypted Data packet. It is a new feature * a variant of the Symmetrically Encrypted Data packet. It is a new feature
@ -34,12 +35,12 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
this.decrytpedData = null; // string this.decrytpedData = null; // string
this.hash = null; // string this.hash = null; // string
/** /**
* parsing function for the packet. * Parsing function for the packet.
* *
* @param {string} input payload of a tag 18 packet * @param {String} input Payload of a tag 18 packet
* @param {integer} position * @param {Integer} position
* position to start reading from the input string * position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of * @param {Integer} len Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encryptedintegrityprotecteddata} object * @return {openpgp_packet_encryptedintegrityprotecteddata} object
* representation * representation
@ -72,12 +73,12 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Creates a string representation of a Sym. Encrypted Integrity Protected * Creates a string representation of a Sym. Encrypted Integrity Protected
* Data Packet (tag 18) (see RFC4880 5.13) * Data Packet (tag 18) (see RFC4880 5.13)
* *
* @param {integer} symmetric_algorithm * @param {Integer} symmetric_algorithm
* the selected symmetric encryption algorithm to be used * The selected symmetric encryption algorithm to be used
* @param {String} key the key of cipher blocksize length to be used * @param {String} key The key of cipher blocksize length to be used
* @param data * @param {String} data
* plaintext data to be encrypted within the packet * Plaintext data to be encrypted within the packet
* @return a string representation of the packet * @return {String} A string representation of the packet
*/ */
function write_packet(symmetric_algorithm, key, data) { function write_packet(symmetric_algorithm, key, data) {
@ -107,10 +108,10 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Decrypts the encrypted data contained in this object read_packet must * Decrypts the encrypted data contained in this object read_packet must
* have been called before * have been called before
* *
* @param {integer} symmetric_algorithm_type * @param {Integer} symmetric_algorithm_type
* the selected symmetric encryption algorithm to be used * The selected symmetric encryption algorithm to be used
* @param {String} key the key of cipher blocksize length to be used * @param {String} key The key of cipher blocksize length to be used
* @return the decrypted data of this packet * @return {String} The decrypted data of this packet
*/ */
function decrypt(symmetric_algorithm_type, key) { function decrypt(symmetric_algorithm_type, key) {
this.decryptedData = openpgp_crypto_symmetricDecrypt( this.decryptedData = openpgp_crypto_symmetricDecrypt(

View File

@ -34,13 +34,13 @@
function openpgp_packet_encryptedsessionkey() { function openpgp_packet_encryptedsessionkey() {
/** /**
* parsing function for a publickey encrypted session key packet (tag 1). * Parsing function for a publickey encrypted session key packet (tag 1).
* *
* @param {string} input payload of a tag 1 packet * @param {String} input Payload of a tag 1 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of * @param {Integer} len Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} Object representation
*/ */
function read_pub_key_packet(input, position, len) { function read_pub_key_packet(input, position, len) {
this.tagType = 1; this.tagType = 1;
@ -83,21 +83,22 @@ function openpgp_packet_encryptedsessionkey() {
} }
/** /**
* create a string representation of a tag 1 packet * Create a string representation of a tag 1 packet
* *
* @param {String} publicKeyId * @param {String} publicKeyId
* the public key id corresponding to publicMPIs key as string * The public key id corresponding to publicMPIs key as string
* @param {Array[openpgp_type_mpi]} publicMPIs * @param {openpgp_type_mpi[]} publicMPIs
* multiprecision integer objects describing the public key * Multiprecision integer objects describing the public key
* @param {integer} pubalgo * @param {Integer} pubalgo
* the corresponding public key algorithm // See RFC4880 9.1 * The corresponding public key algorithm // See RFC4880 9.1
* @param {integer} symmalgo * @param {Integer} symmalgo
* the symmetric cipher algorithm used to encrypt the data within * The symmetric cipher algorithm used to encrypt the data
* an encrypteddatapacket or encryptedintegrityprotecteddatapacket * within an encrypteddatapacket or encryptedintegrity-
* protecteddatapacket
* following this packet //See RFC4880 9.2 * following this packet //See RFC4880 9.2
* @param {String} sessionkey * @param {String} sessionkey
* a string of randombytes representing the session key * A string of randombytes representing the session key
* @return {String} the string representation * @return {String} The string representation
*/ */
function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo, function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo,
sessionkey) { sessionkey) {
@ -121,14 +122,14 @@ function openpgp_packet_encryptedsessionkey() {
} }
/** /**
* parsing function for a symmetric encrypted session key packet (tag 3). * Parsing function for a symmetric encrypted session key packet (tag 3).
* *
* @param {string} input payload of a tag 1 packet * @param {String} input Payload of a tag 1 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input string
* @param {integer} len * @param {Integer} len
* length of the packet or the remaining length of * Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} Object representation
*/ */
function read_symmetric_key_packet(input, position, len) { function read_symmetric_key_packet(input, position, len) {
this.tagType = 3; this.tagType = 3;
@ -157,10 +158,10 @@ function openpgp_packet_encryptedsessionkey() {
* packets (tag 1) * packets (tag 1)
* *
* @param {openpgp_msg_message} msg * @param {openpgp_msg_message} msg
* the message object (with member encryptedData * The message object (with member encryptedData
* @param {openpgp_msg_privatekey} key * @param {openpgp_msg_privatekey} key
* private key with secMPIs unlocked * Private key with secMPIs unlocked
* @return {String} the unencrypted session key * @return {String} The unencrypted session key
*/ */
function decrypt(msg, key) { function decrypt(msg, key) {
if (this.tagType == 1) { if (this.tagType == 1) {
@ -187,7 +188,7 @@ function openpgp_packet_encryptedsessionkey() {
* Creates a string representation of this object (useful for debug * Creates a string representation of this object (useful for debug
* purposes) * purposes)
* *
* @return the string containing a openpgp description * @return {String} The string containing a openpgp description
*/ */
function toString() { function toString() {
if (this.tagType == 1) { if (this.tagType == 1) {

View File

@ -17,16 +17,16 @@
/** /**
* @class * @class
* @classdesc Parent openpgp packet class. Operations focus on determining packet types * @classdesc Parent openpgp packet class. Operations focus on determining
* and packet header. * packet types and packet header.
*/ */
function _openpgp_packet() { function _openpgp_packet() {
/** /**
* Encodes a given integer of length to the openpgp length specifier to a * Encodes a given integer of length to the openpgp length specifier to a
* string * string
* *
* @param {Integer} length of the length to encode * @param {Integer} length The length to encode
* @return {string} string with openpgp length representation * @return {String} String with openpgp length representation
*/ */
function encode_length(length) { function encode_length(length) {
result = ""; result = "";
@ -54,9 +54,9 @@ function _openpgp_packet() {
* Writes a packet header version 4 with the given tag_type and length to a * Writes a packet header version 4 with the given tag_type and length to a
* string * string
* *
* @param {integer} tag_type tag type * @param {Integer} tag_type Tag type
* @param {integer} length length of the payload * @param {Integer} length Length of the payload
* @return {string} string of the header * @return {String} String of the header
*/ */
function write_packet_header(tag_type, length) { function write_packet_header(tag_type, length) {
/* we're only generating v4 packet headers here */ /* we're only generating v4 packet headers here */
@ -70,9 +70,9 @@ function _openpgp_packet() {
* Writes a packet header Version 3 with the given tag_type and length to a * Writes a packet header Version 3 with the given tag_type and length to a
* string * string
* *
* @param {integer} tag_type tag type * @param {Integer} tag_type Tag type
* @param {integer} length length of the payload * @param {Integer} length Length of the payload
* @return {string} string of the header * @return {String} String of the header
*/ */
function write_old_packet_header(tag_type, length) { function write_old_packet_header(tag_type, length) {
var result = ""; var result = "";
@ -97,10 +97,10 @@ function _openpgp_packet() {
/** /**
* Generic static Packet Parser function * Generic static Packet Parser function
* *
* @param {String} input input stream as string * @param {String} input Input stream as string
* @param {integer} position position to start parsing * @param {integer} position Position to start parsing
* @param {integer} len length of the input from position on * @param {integer} len Length of the input from position on
* @return {openpgp_packet_*} returns a parsed openpgp_packet * @return {Object} Returns a parsed openpgp_packet
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
// some sanity checks // some sanity checks

View File

@ -50,10 +50,10 @@ function openpgp_packet_keymaterial() {
/** /**
* This function reads the payload of a secret key packet (Tag 5) * This function reads the payload of a secret key packet (Tag 5)
* and initializes the openpgp_packet_keymaterial * and initializes the openpgp_packet_keymaterial
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Intefer} len Length of the packet or remaining length of input
* @return openpgp_packet_keymaterial object * @return {openpgp_packet_keymaterial}
*/ */
function read_tag5(input, position, len) { function read_tag5(input, position, len) {
this.tagType = 5; this.tagType = 5;
@ -65,10 +65,10 @@ function openpgp_packet_keymaterial() {
/** /**
* This function reads the payload of a public key packet (Tag 6) * This function reads the payload of a public key packet (Tag 6)
* and initializes the openpgp_packet_keymaterial * and initializes the openpgp_packet_keymaterial
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Integer} len Length of the packet or remaining length of input
* @return openpgp_packet_keymaterial object * @return {openpgp_packet_keymaterial}
*/ */
function read_tag6(input, position, len) { function read_tag6(input, position, len) {
// A Public-Key packet starts a series of packets that forms an OpenPGP // A Public-Key packet starts a series of packets that forms an OpenPGP
@ -84,10 +84,10 @@ function openpgp_packet_keymaterial() {
/** /**
* This function reads the payload of a secret key sub packet (Tag 7) * This function reads the payload of a secret key sub packet (Tag 7)
* and initializes the openpgp_packet_keymaterial * and initializes the openpgp_packet_keymaterial
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Integer} len Length of the packet or remaining length of input
* @return openpgp_packet_keymaterial object * @return {openpgp_packet_keymaterial}
*/ */
function read_tag7(input, position, len) { function read_tag7(input, position, len) {
this.tagType = 7; this.tagType = 7;
@ -99,10 +99,10 @@ function openpgp_packet_keymaterial() {
/** /**
* This function reads the payload of a public key sub packet (Tag 14) * This function reads the payload of a public key sub packet (Tag 14)
* and initializes the openpgp_packet_keymaterial * and initializes the openpgp_packet_keymaterial
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Integer} len Length of the packet or remaining length of input
* @return openpgp_packet_keymaterial object * @return {openpgp_packet_keymaterial}
*/ */
function read_tag14(input, position, len) { function read_tag14(input, position, len) {
this.subKeySignature = null; this.subKeySignature = null;
@ -114,12 +114,13 @@ function openpgp_packet_keymaterial() {
} }
/** /**
* Internal Parser for public keys as specified in RFC 4880 section 5.5.2 Public-Key Packet Formats * Internal Parser for public keys as specified in RFC 4880 section
* 5.5.2 Public-Key Packet Formats
* called by read_tag&lt;num&gt; * called by read_tag&lt;num&gt;
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Integer} len Length of the packet or remaining length of input
* @return this object with attributes set by the parser * @return {Object} This object with attributes set by the parser
*/ */
function read_pub_key(input, position, len) { function read_pub_key(input, position, len) {
var mypos = position; var mypos = position;
@ -226,10 +227,10 @@ function openpgp_packet_keymaterial() {
/** /**
* Internal parser for private keys as specified in RFC 4880 section 5.5.3 * Internal parser for private keys as specified in RFC 4880 section 5.5.3
* @param input input string to read the packet from * @param {String} input Input string to read the packet from
* @param position start position for the parser * @param {Integer} position Start position for the parser
* @param len length of the packet or remaining length of input * @param {Integer} len Length of the packet or remaining length of input
* @return this object with attributes set by the parser * @return {Object} This object with attributes set by the parser
*/ */
function read_priv_key(input,position, len) { function read_priv_key(input,position, len) {
// - A Public-Key or Public-Subkey packet, as described above. // - A Public-Key or Public-Subkey packet, as described above.
@ -362,11 +363,13 @@ function openpgp_packet_keymaterial() {
/** /**
* Decrypts the private key MPIs which are needed to use the key. * Decrypts the private key MPIs which are needed to use the key.
* openpgp_packet_keymaterial.hasUnencryptedSecretKeyData should be false otherwise * openpgp_packet_keymaterial.hasUnencryptedSecretKeyData should be
* false otherwise
* a call to this function is not needed * a call to this function is not needed
* *
* @param str_passphrase the passphrase for this private key as string * @param {String} str_passphrase The passphrase for this private key
* @return true if the passphrase was correct; false if not * as string
* @return {Boolean} True if the passphrase was correct; false if not
*/ */
function decryptSecretMPIs(str_passphrase) { function decryptSecretMPIs(str_passphrase) {
if (this.hasUnencryptedSecretKeyData) if (this.hasUnencryptedSecretKeyData)
@ -549,11 +552,11 @@ function openpgp_packet_keymaterial() {
/** /**
* Continue parsing packets belonging to the key material such as signatures * Continue parsing packets belonging to the key material such as signatures
* @param {openpgp_*} parent_node the parent object * @param {Object} parent_node The parent object
* @param {String} input input string to read the packet(s) from * @param {String} input Input string to read the packet(s) from
* @param {integer} position start position for the parser * @param {Integer} position Start position for the parser
* @param {integer} len length of the packet(s) or remaining length of input * @param {Integer} len Length of the packet(s) or remaining length of input
* @return {integer} length of nodes read * @return {Integer} Length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
this.parentNode = parent_node; this.parentNode = parent_node;
@ -630,7 +633,7 @@ function openpgp_packet_keymaterial() {
/** /**
* Checks the validity for usage of this (sub)key * Checks the validity for usage of this (sub)key
* @return 0 = bad key, 1 = expired, 2 = revoked, 3 = valid * @return {Integer} 0 = bad key, 1 = expired, 2 = revoked, 3 = valid
*/ */
function verifyKey() { function verifyKey() {
if (this.tagType == 14) { if (this.tagType == 14) {
@ -658,8 +661,8 @@ function openpgp_packet_keymaterial() {
} }
/** /**
* calculates the key id of they key * Calculates the key id of they key
* @return {String} a 8 byte key id * @return {String} A 8 byte key id
*/ */
function getKeyId() { function getKeyId() {
if (this.version == 4) { if (this.version == 4) {
@ -673,8 +676,8 @@ function openpgp_packet_keymaterial() {
} }
/** /**
* calculates the fingerprint of the key * Calculates the fingerprint of the key
* @return {String} a string containing the fingerprint * @return {String} A string containing the fingerprint
*/ */
function getFingerprint() { function getFingerprint() {
if (this.version == 4) { if (this.version == 4) {
@ -688,14 +691,17 @@ function openpgp_packet_keymaterial() {
} }
/* /*
* creates an OpenPGP key packet for the given key. much TODO in regards to s2k, subkeys. * Creates an OpenPGP key packet for the given key. much
* @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * TODO in regards to s2k, subkeys.
* @param {Integer} keyType Follows the OpenPGP algorithm standard,
* IE 1 corresponds to RSA.
* @param {RSA.keyObject} key * @param {RSA.keyObject} key
* @param password * @param password
* @param s2kHash * @param s2kHash
* @param symmetricEncryptionAlgorithm * @param symmetricEncryptionAlgorithm
* @param timePacket * @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {Object} {body: [string]OpenPGP packet body contents,
header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){ function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){
this.symmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm; this.symmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
@ -769,11 +775,14 @@ function openpgp_packet_keymaterial() {
} }
/* /*
* same as write_private_key, but has less information because of public key. * Same as write_private_key, but has less information because of
* @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * public key.
* @param {Integer} keyType Follows the OpenPGP algorithm standard,
* IE 1 corresponds to RSA.
* @param {RSA.keyObject} key * @param {RSA.keyObject} key
* @param timePacket * @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {Object} {body: [string]OpenPGP packet body contents,
* header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_public_key(keyType, key, timePacket){ function write_public_key(keyType, key, timePacket){
var tag = 6; var tag = 6;

View File

@ -26,13 +26,13 @@ function openpgp_packet_literaldata() {
this.tagType = 11; this.tagType = 11;
/** /**
* parsing function for a literal data packet (tag 11). * Parsing function for a literal data packet (tag 11).
* *
* @param {string} input payload of a tag 11 packet * @param {String} input Payload of a tag 11 packet
* @param {integer} position * @param {Integer} position
* position to start reading from the input string * Position to start reading from the input string
* @param {integer} len * @param {Integer} len
* length of the packet or the remaining length of * Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
@ -53,7 +53,7 @@ function openpgp_packet_literaldata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param {String} data the data to be inserted as body * @param {String} data The data to be inserted as body
* @return {String} string-representation of the packet * @return {String} string-representation of the packet
*/ */
function write_packet(data) { function write_packet(data) {
@ -80,9 +80,9 @@ function openpgp_packet_literaldata() {
} }
/** /**
* generates debug output (pretty print) * Generates debug output (pretty print)
* *
* @return {string} String which gives some information about the keymaterial * @return {String} String which gives some information about the keymaterial
*/ */
function toString() { function toString() {
return '5.9. Literal Data Packet (Tag 11)\n' + ' length: ' return '5.9. Literal Data Packet (Tag 11)\n' + ' length: '

View File

@ -29,15 +29,15 @@
function openpgp_packet_marker() { function openpgp_packet_marker() {
this.tagType = 10; this.tagType = 10;
/** /**
* parsing function for a literal data packet (tag 10). * Parsing function for a literal data packet (tag 10).
* *
* @param {string} input payload of a tag 10 packet * @param {String} input Payload of a tag 10 packet
* @param {integer} position * @param {Integer} position
* position to start reading from the input string * Position to start reading from the input string
* @param {integer} len * @param {Integer} len
* length of the packet or the remaining length of * Length of the packet or the remaining length of
* input at position * input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} Object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = 3; this.packetLength = 3;
@ -52,7 +52,8 @@ function openpgp_packet_marker() {
/** /**
* Generates Debug output * Generates Debug output
* *
* @return {string} String which gives some information about the keymaterial * @return {String} String which gives some information about the
* keymaterial
*/ */
function toString() { function toString() {
return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n" return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n"

View File

@ -67,8 +67,8 @@ function openpgp_packet_modificationdetectioncode() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* *
* @return {string} String which gives some information about the modification * @return {String} String which gives some information about the
* detection code * modification detection code
*/ */
function toString() { function toString() {
return '5.14 Modification detection code packet\n' + ' bytes (' return '5.14 Modification detection code packet\n' + ' bytes ('

View File

@ -37,9 +37,9 @@ function openpgp_packet_onepasssignature() {
/** /**
* parsing function for a one-pass signature packet (tag 4). * parsing function for a one-pass signature packet (tag 4).
* @param {string} input payload of a tag 4 packet * @param {String} input payload of a tag 4 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of input at position * @param {Integer} len length of the packet or the remaining length of input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
@ -72,10 +72,10 @@ function openpgp_packet_onepasssignature() {
/** /**
* creates a string representation of a one-pass signature packet * creates a string representation of a one-pass signature packet
* @param {integer} type Signature types as described in RFC4880 Section 5.2.1. * @param {Integer} type Signature types as described in RFC4880 Section 5.2.1.
* @param {integer} hashalgorithm the hash algorithm used within the signature * @param {Integer} hashalgorithm the hash algorithm used within the signature
* @param {openpgp_msg_privatekey} privatekey the private key used to generate the signature * @param {openpgp_msg_privatekey} privatekey the private key used to generate the signature
* @param {integer} length length of data to be signed * @param {Integer} length length of data to be signed
* @param {boolean} nested boolean showing whether the signature is nested. * @param {boolean} nested boolean showing whether the signature is nested.
* "true" indicates that the next packet is another One-Pass Signature packet * "true" indicates that the next packet is another One-Pass Signature packet
* that describes another signature to be applied to the same message data. * that describes another signature to be applied to the same message data.
@ -100,7 +100,7 @@ function openpgp_packet_onepasssignature() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return {string} String which gives some information about the one-pass signature packet * @return {String} String which gives some information about the one-pass signature packet
*/ */
function toString() { function toString() {
return '5.4. One-Pass Signature Packets (Tag 4)\n'+ return '5.4. One-Pass Signature Packets (Tag 4)\n'+

View File

@ -70,9 +70,9 @@ function openpgp_packet_signature() {
/** /**
* parsing function for a signature packet (tag 2). * parsing function for a signature packet (tag 2).
* @param {string} input payload of a tag 2 packet * @param {String} input payload of a tag 2 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of input at position * @param {Integer} len length of the packet or the remaining length of input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
@ -210,10 +210,10 @@ function openpgp_packet_signature() {
/** /**
* creates a string representation of a message signature packet (tag 2). * creates a string representation of a message signature packet (tag 2).
* This can be only used on text data * This can be only used on text data
* @param {integer} signature_type should be 1 (one) * @param {Integer} signature_type should be 1 (one)
* @param {String} data data to be signed * @param {String} data data to be signed
* @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secMPIs MUST be unlocked) * @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secMPIs MUST be unlocked)
* @return {string} string representation of a signature packet * @return {String} string representation of a signature packet
*/ */
function write_message_signature(signature_type, data, privatekey) { function write_message_signature(signature_type, data, privatekey) {
var publickey = privatekey.privateKeyPacket.publicKey; var publickey = privatekey.privateKeyPacket.publicKey;
@ -256,7 +256,7 @@ function openpgp_packet_signature() {
} }
/** /**
* creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1) * creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1)
* @param {integer} type subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2 * @param {Integer} type subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2
* @param {String} data data to be included * @param {String} data data to be included
* @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1) * @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)
*/ */
@ -636,7 +636,7 @@ function openpgp_packet_signature() {
} }
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return {string} String which gives some information about the signature packet * @return {String} String which gives some information about the signature packet
*/ */
function toString () { function toString () {
@ -707,7 +707,7 @@ function openpgp_packet_signature() {
/** /**
* Tries to get the corresponding public key out of the public keyring for the issuer created this signature * Tries to get the corresponding public key out of the public keyring for the issuer created this signature
* @return {obj: [openpgp_msg_publickey], text: [String]} if found the public key will be returned. null otherwise * @return {Object} {obj: [openpgp_msg_publickey], text: [String]} if found the public key will be returned. null otherwise
*/ */
function getIssuerKey() { function getIssuerKey() {
var result = null; var result = null;

View File

@ -41,9 +41,9 @@ function openpgp_packet_userattribute() {
/** /**
* parsing function for a user attribute packet (tag 17). * parsing function for a user attribute packet (tag 17).
* @param {string} input payload of a tag 17 packet * @param {String} input payload of a tag 17 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of input at position * @param {Integer} len length of the packet or the remaining length of input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
@ -89,7 +89,7 @@ function openpgp_packet_userattribute() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return {string} String which gives some information about the user attribute packet * @return {String} String which gives some information about the user attribute packet
*/ */
function toString() { function toString() {
var result = '5.12. User Attribute Packet (Tag 17)\n'+ var result = '5.12. User Attribute Packet (Tag 17)\n'+
@ -102,11 +102,11 @@ function openpgp_packet_userattribute() {
/** /**
* Continue parsing packets belonging to the user attribute packet such as signatures * Continue parsing packets belonging to the user attribute packet such as signatures
* @param {openpgp_*} parent_node the parent object * @param {Object} parent_node the parent object
* @param {String} input input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param {integer} position start position for the parser * @param {Integer} position start position for the parser
* @param {integer} len length of the packet(s) or remaining length of input * @param {Integer} len length of the packet(s) or remaining length of input
* @return {integer} length of nodes read * @return {Integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {

View File

@ -34,9 +34,9 @@ function openpgp_packet_userid() {
/** /**
* parsing function for a user id packet (tag 13). * parsing function for a user id packet (tag 13).
* @param {string} input payload of a tag 13 packet * @param {String} input payload of a tag 13 packet
* @param {integer} position position to start reading from the input string * @param {Integer} position position to start reading from the input string
* @param {integer} len length of the packet or the remaining length of input at position * @param {Integer} len length of the packet or the remaining length of input at position
* @return {openpgp_packet_encrypteddata} object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
@ -63,11 +63,11 @@ function openpgp_packet_userid() {
/** /**
* Continue parsing packets belonging to the userid packet such as signatures * Continue parsing packets belonging to the userid packet such as signatures
* @param {openpgp_*} parent_node the parent object * @param {Object} parent_node the parent object
* @param {String} input input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param {integer} position start position for the parser * @param {Integer} position start position for the parser
* @param {integer} len length of the packet(s) or remaining length of input * @param {Integer} len length of the packet(s) or remaining length of input
* @return {integer} length of nodes read * @return {Integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
if (parent_node.tagType == 6) { // public key if (parent_node.tagType == 6) { // public key
@ -147,7 +147,7 @@ function openpgp_packet_userid() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return {string} String which gives some information about the user id packet * @return {String} String which gives some information about the user id packet
*/ */
function toString() { function toString() {
var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text (' var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text ('
@ -166,7 +166,7 @@ function openpgp_packet_userid() {
/** /**
* lookup function to find certification revocation signatures * lookup function to find certification revocation signatures
* @param {string} keyId string containing the key id of the issuer of this signature * @param {String} keyId string containing the key id of the issuer of this signature
* @return a CertificationRevocationSignature if found; otherwise null * @return a CertificationRevocationSignature if found; otherwise null
*/ */
function hasCertificationRevocationSignature(keyId) { function hasCertificationRevocationSignature(keyId) {
@ -182,8 +182,8 @@ function openpgp_packet_userid() {
/** /**
* Verifies all certification signatures. This method does not consider possible revocation signatures. * Verifies all certification signatures. This method does not consider possible revocation signatures.
* @param publicKeyPacket the top level key material * @param {Object} publicKeyPacket the top level key material
* @return an array of integers corresponding to the array of certification signatures. The meaning of each integer is the following: * @return {Integer[]} An array of integers corresponding to the array of certification signatures. The meaning of each integer is the following:
* 0 = bad signature * 0 = bad signature
* 1 = signature expired * 1 = signature expired
* 2 = issuer key not available * 2 = issuer key not available

View File

@ -25,10 +25,11 @@
*/ */
function openpgp_type_keyid() { function openpgp_type_keyid() {
/** /**
* parsing method for a key id * Parsing method for a key id
* @param {String} input input to read the key id from * @param {String} input Input to read the key id from
* @param {integer} position position where to start reading the key id from input * @param {integer} position Position where to start reading the key
* @return this object * id from input
* @return {openpgp_type_keyid} This object
*/ */
function read_packet(input, position) { function read_packet(input, position) {
this.bytes = input.substring(position, position+8); this.bytes = input.substring(position, position+8);
@ -36,7 +37,7 @@ function openpgp_type_keyid() {
} }
/** /**
* generates debug output (pretty print) * Generates debug output (pretty print)
* @return {String} Key Id as hexadecimal string * @return {String} Key Id as hexadecimal string
*/ */
function toString() { function toString() {

View File

@ -36,11 +36,13 @@ function openpgp_type_mpi() {
this.mpiByteLength = null; this.mpiByteLength = null;
this.data = null; this.data = null;
/** /**
* parsing function for a mpi (RFC 4880 3.2). * Parsing function for a mpi (RFC 4880 3.2).
* @param {string} input payload of mpi data * @param {String} input Payload of mpi data
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input
* @param {integer} len length of the packet or the remaining length of input at position * string
* @return {openpgp_type_mpi} object representation * @param {Integer} len Length of the packet or the remaining length of
* input at position
* @return {openpgp_type_mpi} Object representation
*/ */
function read(input, position, len) { function read(input, position, len) {
var mypos = position; var mypos = position;
@ -68,8 +70,8 @@ function openpgp_type_mpi() {
} }
/** /**
* generates debug output (pretty print) * Generates debug output (pretty print)
* @return {string} String which gives some information about the mpi * @return {String} String which gives some information about the mpi
*/ */
function toString() { function toString() {
var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x"; var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x";
@ -78,7 +80,7 @@ function openpgp_type_mpi() {
} }
/** /**
* converts the mpi to an BigInteger object * Converts the mpi to an BigInteger object
* @return {BigInteger} * @return {BigInteger}
*/ */
function getBigInteger() { function getBigInteger() {
@ -93,16 +95,16 @@ function openpgp_type_mpi() {
} }
/** /**
* gets the length of the mpi in bytes * Gets the length of the mpi in bytes
* @return {integer} mpi byte length * @return {Integer} Mpi byte length
*/ */
function getByteLength() { function getByteLength() {
return this.mpiByteLength; return this.mpiByteLength;
} }
/** /**
* creates an mpi from the specified string * Creates an mpi from the specified string
* @param {String} data data to read the mpi from * @param {String} data Data to read the mpi from
* @return {openpgp_type_mpi} * @return {openpgp_type_mpi}
*/ */
function create(data) { function create(data) {
@ -113,8 +115,8 @@ function openpgp_type_mpi() {
} }
/** /**
* converts the mpi object to a string as specified in RFC4880 3.2 * Converts the mpi object to a string as specified in RFC4880 3.2
* @return {String} mpi byte representation * @return {String} mpi Byte representation
*/ */
function toBin() { function toBin() {
var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF); var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF);

View File

@ -26,10 +26,10 @@
*/ */
function openpgp_type_s2k() { function openpgp_type_s2k() {
/** /**
* parsing function for a string-to-key specifier (RFC 4880 3.7). * Parsing function for a string-to-key specifier (RFC 4880 3.7).
* @param {string} input payload of string-to-key specifier * @param {String} input Payload of string-to-key specifier
* @param {integer} position position to start reading from the input string * @param {Integer} position Position to start reading from the input string
* @return {openpgp_type_s2k} object representation * @return {openpgp_type_s2k} Object representation
*/ */
function read(input, position) { function read(input, position) {
var mypos = position; var mypos = position;
@ -94,7 +94,7 @@ function openpgp_type_s2k() {
/** /**
* writes an s2k hash based on the inputs. * writes an s2k hash based on the inputs.
* @return {String} produced key of hashAlgorithm hash length * @return {String} Produced key of hashAlgorithm hash length
*/ */
function write(type, hash, passphrase, salt, c){ function write(type, hash, passphrase, salt, c){
this.type = type; this.type = type;
@ -107,9 +107,11 @@ function openpgp_type_s2k() {
} }
/** /**
* produces a key using the specified passphrase and the defined hashAlgorithm * Produces a key using the specified passphrase and the defined
* @param passphrase {String} passphrase containing user input * hashAlgorithm
* @return {String} produced key with a length corresponding to hashAlgorithm hash length * @param {String} passphrase Passphrase containing user input
* @return {String} Produced key with a length corresponding to
* hashAlgorithm hash length
*/ */
function produce_key(passphrase, numBytes) { function produce_key(passphrase, numBytes) {
if (this.type == 0) { if (this.type == 0) {

View File

@ -37,9 +37,9 @@ var Util = function() {
}; };
/** /**
* create hexstring from a binary * Create hexstring from a binary
* @param str [String] string to convert * @param {String} str String to convert
* @return [String] string containing the hexadecimal values * @return {String} String containing the hexadecimal values
*/ */
this.hexstrdump = function(str) { this.hexstrdump = function(str) {
if (str == null) if (str == null)
@ -57,9 +57,9 @@ var Util = function() {
}; };
/** /**
* create binary string from a hex encoded string * Create binary string from a hex encoded string
* @param str [String] hex string to convert * @param {String} str Hex string to convert
* @return [String] string containing the binary values * @return {String} String containing the binary values
*/ */
this.hex2bin = function(hex) { this.hex2bin = function(hex) {
var str = ''; var str = '';
@ -69,9 +69,9 @@ var Util = function() {
}; };
/** /**
* creating a hex string from an binary array of integers (0..255) * Creating a hex string from an binary array of integers (0..255)
* @param [Array[integer 0..255]] array to convert * @param {String} str Array of bytes to convert
* @return [String] hexadecimal representation of the array * @return {String} Hexadecimal representation of the array
*/ */
this.hexidump = function(str) { this.hexidump = function(str) {
var r=[]; var r=[];
@ -87,9 +87,9 @@ var Util = function() {
}; };
/** /**
* convert a string to an array of integers(0.255) * Convert a string to an array of integers(0.255)
* @param [String] string to convert * @param {String} str String to convert
* @return [Array [Integer 0..255]] array of (binary) integers * @return {Integer[]} An array of (binary) integers
*/ */
this.str2bin = function(str) { this.str2bin = function(str) {
var result = new Array(); var result = new Array();
@ -101,9 +101,9 @@ var Util = function() {
}; };
/** /**
* convert an array of integers(0.255) to a string * Convert an array of integers(0.255) to a string
* @param [Array [Integer 0..255]] array of (binary) integers to convert * @param {Integer[]} bin An array of (binary) integers to convert
* @return [String] string representation of the array * @return {String} The string representation of the array
*/ */
this.bin2str = function(bin) { this.bin2str = function(bin) {
var result = []; var result = [];
@ -114,9 +114,9 @@ var Util = function() {
}; };
/** /**
* convert a string to a Uint8Array * Convert a string to a Uint8Array
* @param [String] string to convert * @param {String} str String to convert
* @return [Uint8Array] array of (binary) integers * @return {Uint8Array} The array of (binary) integers
*/ */
this.str2Uint8Array = function(str){ this.str2Uint8Array = function(str){
var uintArray = new Uint8Array(new ArrayBuffer(str.length)); var uintArray = new Uint8Array(new ArrayBuffer(str.length));
@ -127,9 +127,10 @@ var Util = function() {
}; };
/** /**
* convert a Uint8Array to a string. This currently functions the same as bin2str. * Convert a Uint8Array to a string. This currently functions
* @param [Uint8Array] array of (binary) integers to convert * the same as bin2str.
* @return [String] string representation of the array * @param {Uint8Array} bin An array of (binary) integers to convert
* @return {String} String representation of the array
*/ */
this.Uint8Array2str = function(bin) { this.Uint8Array2str = function(bin) {
var result = []; var result = [];
@ -140,9 +141,11 @@ var Util = function() {
}; };
/** /**
* calculates a 16bit sum of a string by adding each character codes modulus 65535 * Calculates a 16bit sum of a string by adding each character
* @param text [String] string to create a sum of * codes modulus 65535
* @return [Integer] an integer containing the sum of all character codes % 65535 * @param {String} text String to create a sum of
* @return {Integer} An integer containing the sum of all character
* codes % 65535
*/ */
this.calc_checksum = function(text) { this.calc_checksum = function(text) {
var checksum = { s: 0, add: function (sadd) { this.s = (this.s + sadd) % 65536; }}; var checksum = { s: 0, add: function (sadd) { this.s = (this.s + sadd) % 65536; }};
@ -159,8 +162,9 @@ var Util = function() {
* Javascript context MUST define * Javascript context MUST define
* a "showMessages(text)" function. Line feeds ('\n') * a "showMessages(text)" function. Line feeds ('\n')
* are automatically converted to HTML line feeds '<br/>' * are automatically converted to HTML line feeds '<br/>'
* @param str [String] string of the debug message * @param {String} str String of the debug message
* @return [String] an HTML tt entity containing a paragraph with a style attribute where the debug message is HTMLencoded in. * @return {String} An HTML tt entity containing a paragraph with a
* style attribute where the debug message is HTMLencoded in.
*/ */
this.print_debug = function(str) { this.print_debug = function(str) {
if (openpgp.config.debug) { if (openpgp.config.debug) {
@ -177,8 +181,9 @@ var Util = function() {
* a "showMessages(text)" function. Line feeds ('\n') * a "showMessages(text)" function. Line feeds ('\n')
* are automatically converted to HTML line feeds '<br/>' * are automatically converted to HTML line feeds '<br/>'
* Different than print_debug because will call hexstrdump iff necessary. * Different than print_debug because will call hexstrdump iff necessary.
* @param str [String] string of the debug message * @param {String} str String of the debug message
* @return [String] an HTML tt entity containing a paragraph with a style attribute where the debug message is HTMLencoded in. * @return {String} An HTML tt entity containing a paragraph with a
* style attribute where the debug message is HTMLencoded in.
*/ */
this.print_debug_hexstr_dump = function(str,strToHex) { this.print_debug_hexstr_dump = function(str,strToHex) {
if (openpgp.config.debug) { if (openpgp.config.debug) {
@ -193,8 +198,9 @@ var Util = function() {
* The calling Javascript context MUST define * The calling Javascript context MUST define
* a "showMessages(text)" function. Line feeds ('\n') * a "showMessages(text)" function. Line feeds ('\n')
* are automatically converted to HTML line feeds '<br/>' * are automatically converted to HTML line feeds '<br/>'
* @param str [String] string of the error message * @param {String} str String of the error message
* @return [String] a HTML paragraph entity with a style attribute containing the HTML encoded error message * @return {String} A HTML paragraph entity with a style attribute
* containing the HTML encoded error message
*/ */
this.print_error = function(str) { this.print_error = function(str) {
str = openpgp_encoding_html_encode(str); str = openpgp_encoding_html_encode(str);
@ -206,8 +212,9 @@ var Util = function() {
* The calling Javascript context MUST define * The calling Javascript context MUST define
* a "showMessages(text)" function. Line feeds ('\n') * a "showMessages(text)" function. Line feeds ('\n')
* are automatically converted to HTML line feeds '<br/>'. * are automatically converted to HTML line feeds '<br/>'.
* @param str [String] string of the info message * @param {String} str String of the info message
* @return [String] a HTML paragraph entity with a style attribute containing the HTML encoded info message * @return {String} A HTML paragraph entity with a style attribute
* containing the HTML encoded info message
*/ */
this.print_info = function(str) { this.print_info = function(str) {
str = openpgp_encoding_html_encode(str); str = openpgp_encoding_html_encode(str);
@ -227,11 +234,13 @@ var Util = function() {
var result = string.substring(0, bytes); var result = string.substring(0, bytes);
return this.shiftRight(result, 8-rest); // +String.fromCharCode(string.charCodeAt(bytes -1) << (8-rest) & 0xFF); return this.shiftRight(result, 8-rest); // +String.fromCharCode(string.charCodeAt(bytes -1) << (8-rest) & 0xFF);
}; };
/** /**
* Shifting a string to n bits right * Shifting a string to n bits right
* @param value [String] the string to shift * @param {String} value The string to shift
* @param bitcount [Integer] amount of bits to shift (MUST be smaller than 9) * @param {Integer} bitcount Amount of bits to shift (MUST be smaller
* @return [String] resulting string. * than 9)
* @return {String} Resulting string.
*/ */
this.shiftRight = function(value, bitcount) { this.shiftRight = function(value, bitcount) {
var temp = util.str2bin(value); var temp = util.str2bin(value);
@ -249,7 +258,7 @@ var Util = function() {
/** /**
* Return the algorithm type as string * Return the algorithm type as string
* @return [String] String representing the message type * @return {String} String representing the message type
*/ */
this.get_hashAlgorithmString = function(algo) { this.get_hashAlgorithmString = function(algo) {
switch(algo) { switch(algo) {