Finished changing all the javascript files, the documentation
now correctly generates via the use of the makefile.
This commit is contained in:
parent
6242e72a1d
commit
51f8f95807
doc
JXG.Util.html_openpgp_packet.htmlglobal.htmlindex.htmlopenpgp.cfb.js.htmlopenpgp.crypto.js.htmlopenpgp.htmlopenpgp_config.htmlopenpgp_keyring.htmlopenpgp_msg_message.htmlopenpgp_msg_privatekey.htmlopenpgp_msg_publickey.htmlopenpgp_packet_compressed.htmlopenpgp_packet_encrypteddata.htmlopenpgp_packet_encryptedintegrityprotecteddata.htmlopenpgp_packet_encryptedsessionkey.htmlopenpgp_packet_keymaterial.htmlopenpgp_packet_literaldata.htmlopenpgp_packet_marker.htmlopenpgp_packet_modificationdetectioncode.htmlopenpgp_packet_onepasssignature.htmlopenpgp_packet_signature.htmlopenpgp_packet_userattribute.htmlopenpgp_packet_userid.htmlopenpgp_type_keyid.htmlopenpgp_type_mpi.htmlopenpgp_type_s2k.html
styles
resources
src
compression/zlib
config
encoding
openpgp.jsopenpgp.keyring.jsopenpgp.msg.publickey.jspacket
openpgp.packet.compressed.jsopenpgp.packet.encrypteddata.jsopenpgp.packet.encryptedintegrityprotecteddata.jsopenpgp.packet.encryptedsessionkey.jsopenpgp.packet.jsopenpgp.packet.keymaterial.jsopenpgp.packet.literaldata.jsopenpgp.packet.marker.jsopenpgp.packet.modificationdetectioncode.jsopenpgp.packet.onepasssignature.jsopenpgp.packet.signature.jsopenpgp.packet.userattribute.jsopenpgp.packet.userid.js
type
util
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7568
doc/global.html
7568
doc/global.html
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
400
doc/openpgp.html
400
doc/openpgp.html
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
|
@ -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;
|
|
||||||
}
|
|
2078
resources/openpgp.js
2078
resources/openpgp.js
File diff suppressed because it is too large
Load Diff
50
resources/openpgp.min.js
vendored
50
resources/openpgp.min.js
vendored
|
@ -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,
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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++) {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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 = "";
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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<num>
|
* called by read_tag<num>
|
||||||
* @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;
|
||||||
|
|
|
@ -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: '
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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 ('
|
||||||
|
|
|
@ -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'+
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user