diff --git a/resources/openpgp.js b/resources/openpgp.js
index acf0890c..efb58345 100644
--- a/resources/openpgp.js
+++ b/resources/openpgp.js
@@ -7449,7 +7449,7 @@ function openpgp_config() {
keyserver: "keyserver.linux.it" // "pgp.mit.edu:11371"
};
- this.versionstring ="OpenPGP.js v.1.20130427";
+ this.versionstring ="OpenPGP.js v.1.20130508";
this.commentstring ="http://openpgpjs.org";
/**
* Reads the config out of the HTML5 local storage
@@ -9731,8 +9731,8 @@ function openpgp_packet_marker() {
* packet to be placed at the end of the message, so that the signer
* can compute the entire signed message in one pass.
*/
-function openpgp_packet_onepasssignature() {
- this.tagType = 4;
+function openpgp_packet_one_pass_signature() {
+ this.tag = 4;
this.version = null; // A one-octet version number. The current version is 3.
this.type = null; // A one-octet signature type. Signature types are described in RFC4880 Section 5.2.1.
this.hashAlgorithm = null; // A one-octet number describing the hash algorithm used. (See RFC4880 9.4)
@@ -9742,35 +9742,35 @@ function openpgp_packet_onepasssignature() {
/**
* parsing function for a one-pass signature packet (tag 4).
- * @param {String} input payload of a tag 4 packet
- * @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 {String} bytes payload of a tag 4 packet
+ * @param {Integer} position position to start reading from the bytes string
+ * @param {Integer} len length of the packet or the remaining length of bytes at position
* @return {openpgp_packet_encrypteddata} object representation
*/
- function read(bytes) {
+ this.read = function(bytes) {
var mypos = 0;
// A one-octet version number. The current version is 3.
- this.version = input.charCodeAt(mypos++);
+ this.version = bytes.charCodeAt(mypos++);
// A one-octet signature type. Signature types are described in
// Section 5.2.1.
- this.type = input.charCodeAt(mypos++);
+ this.type = bytes.charCodeAt(mypos++);
// A one-octet number describing the hash algorithm used.
- this.hashAlgorithm = input.charCodeAt(mypos++);
+ this.hashAlgorithm = bytes.charCodeAt(mypos++);
// A one-octet number describing the public-key algorithm used.
- this.publicKeyAlgorithm = input.charCodeAt(mypos++);
+ this.publicKeyAlgorithm = bytes.charCodeAt(mypos++);
// An eight-octet number holding the Key ID of the signing key.
this.signingKeyId = new openpgp_type_keyid();
- this.signingKeyId.read_packet(input,mypos);
+ this.signingKeyId.read_packet(bytes,mypos);
mypos += 8;
// A one-octet number holding a flag showing whether the signature
// is nested. A zero value indicates that the next packet is
// another One-Pass Signature packet that describes another
// signature to be applied to the same message data.
- this.flags = input.charCodeAt(mypos++);
+ this.flags = bytes.charCodeAt(mypos++);
return this;
}
@@ -9785,7 +9785,7 @@ function openpgp_packet_onepasssignature() {
* that describes another signature to be applied to the same message data.
* @return {String} a string representation of a one-pass signature packet
*/
- function write(type, hashalgorithm, privatekey,length, nested) {
+ this.write = function(type, hashalgorithm, privatekey,length, nested) {
var result ="";
result += String.fromCharCode(3);
@@ -9800,25 +9800,6 @@ function openpgp_packet_onepasssignature() {
return result;
}
-
- /**
- * generates debug output (pretty print)
- * @return {String} String which gives some information about the one-pass signature packet
- */
- function toString() {
- return '5.4. One-Pass Signature Packets (Tag 4)\n'+
- ' length: '+this.packetLength+'\n'+
- ' type: '+this.type+'\n'+
- ' keyID: '+this.signingKeyId.toString()+'\n'+
- ' hashA: '+this.hashAlgorithm+'\n'+
- ' pubKeyA:'+this.publicKeyAlgorithm+'\n'+
- ' flags: '+this.flags+'\n'+
- ' version:'+this.version+'\n';
- }
-
- this.read_packet = read_packet;
- this.toString = toString;
- this.write_packet = write_packet;
};
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH
@@ -9837,735 +9818,6 @@ function openpgp_packet_onepasssignature() {
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-/**
- * @class
- * @classdesc Implementation of the Signature Packet (Tag 2)
- *
- * RFC4480 5.2:
- * A Signature packet describes a binding between some public key and
- * some data. The most common signatures are a signature of a file or a
- * block of text, and a signature that is a certification of a User ID.
- */
-function openpgp_packet_signature() {
- this.tagType = 2;
- this.signatureType = null;
- this.creationTime = null;
- this.keyId = null;
- this.signatureData = null;
- this.signatureExpirationTime = null;
- this.signatureNeverExpires = null;
- this.signedHashValue = null;
- this.MPIs = null;
- this.publicKeyAlgorithm = null;
- this.hashAlgorithm = null;
- this.exportable = null;
- this.trustLevel = null;
- this.trustAmount = null;
- this.regular_expression = null;
- this.revocable = null;
- this.keyExpirationTime = null;
- this.keyNeverExpires = null;
- this.preferredSymmetricAlgorithms = null;
- this.revocationKeyClass = null;
- this.revocationKeyAlgorithm = null;
- this.revocationKeyFingerprint = null;
- this.issuerKeyId = null;
- this.notationFlags = null;
- this.notationName = null;
- this.notationValue = null;
- this.preferredHashAlgorithms = null;
- this.preferredCompressionAlgorithms = null;
- this.keyServerPreferences = null;
- this.preferredKeyServer = null;
- this.isPrimaryUserID = null;
- this.policyURI = null;
- this.keyFlags = null;
- this.signersUserId = null;
- this.reasonForRevocationFlag = null;
- this.reasonForRevocationString = null;
- this.signatureTargetPublicKeyAlgorithm = null;
- this.signatureTargetHashAlgorithm = null;
- this.signatureTargetHash = null;
- this.embeddedSignature = null;
- this.verified = false;
-
-
- /**
- * parsing function for a signature packet (tag 2).
- * @param {String} input payload of a tag 2 packet
- * @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
- * @return {openpgp_packet_encrypteddata} object representation
- */
- function read_packet(input, position, len) {
- this.data = input.substring (position, position+len);
- if (len < 0) {
- util.print_debug("openpgp.packet.signature.js\n"+"openpgp_packet_signature read_packet length < 0 @:"+position);
- return null;
- }
- var mypos = position;
- this.packetLength = len;
- // alert('starting parsing signature: '+position+' '+this.packetLength);
- this.version = input[mypos++].charCodeAt();
- // switch on version (3 and 4)
- switch (this.version) {
- case 3:
- // One-octet length of following hashed material. MUST be 5.
- if (input[mypos++].charCodeAt() != 5)
- util.print_debug("openpgp.packet.signature.js\n"+'invalid One-octet length of following hashed material. MUST be 5. @:'+(mypos-1));
- var sigpos = mypos;
- // One-octet signature type.
- this.signatureType = input[mypos++].charCodeAt();
-
- // Four-octet creation time.
- this.creationTime = new Date(((input[mypos++].charCodeAt()) << 24 |
- (input[mypos++].charCodeAt() << 16) | (input[mypos++].charCodeAt() << 8) |
- input[mypos++].charCodeAt())* 1000);
-
- // storing data appended to data which gets verified
- this.signatureData = input.substring(position, mypos);
-
- // Eight-octet Key ID of signer.
- this.keyId = input.substring(mypos, mypos +8);
- mypos += 8;
-
- // One-octet public-key algorithm.
- this.publicKeyAlgorithm = input[mypos++].charCodeAt();
-
- // One-octet hash algorithm.
- this.hashAlgorithm = input[mypos++].charCodeAt();
-
- // Two-octet field holding left 16 bits of signed hash value.
- this.signedHashValue = (input[mypos++].charCodeAt() << 8) | input[mypos++].charCodeAt();
- var mpicount = 0;
- // Algorithm-Specific Fields for RSA signatures:
- // - multiprecision integer (MPI) of RSA signature value m**d mod n.
- if (this.publicKeyAlgorithm > 0 && this.publicKeyAlgorithm < 4)
- mpicount = 1;
- // Algorithm-Specific Fields for DSA signatures:
- // - MPI of DSA value r.
- // - MPI of DSA value s.
- else if (this.publicKeyAlgorithm == 17)
- mpicount = 2;
-
- this.MPIs = new Array();
- for (var i = 0; i < mpicount; i++) {
- this.MPIs[i] = new openpgp_type_mpi();
- if (this.MPIs[i].read(input, mypos, (mypos-position)) != null &&
- !this.packetLength < (mypos-position)) {
- mypos += this.MPIs[i].packetLength;
- } else {
- util.print_error('signature contains invalid MPI @:'+mypos);
- }
- }
- break;
- case 4:
- this.signatureType = input[mypos++].charCodeAt();
- this.publicKeyAlgorithm = input[mypos++].charCodeAt();
- this.hashAlgorithm = input[mypos++].charCodeAt();
-
- // Two-octet scalar octet count for following hashed subpacket
- // data.
- var hashed_subpacket_count = (input[mypos++].charCodeAt() << 8) + input[mypos++].charCodeAt();
-
- // Hashed subpacket data set (zero or more subpackets)
- var subpacket_length = 0;
- while (hashed_subpacket_count != subpacket_length) {
- if (hashed_subpacket_count < subpacket_length) {
- util.print_debug("openpgp.packet.signature.js\n"+"hashed missed something: "+mypos+" c:"+hashed_subpacket_count+" l:"+subpacket_length);
- }
-
- subpacket_length += this._raw_read_signature_sub_packet(input,
- mypos + subpacket_length, hashed_subpacket_count
- - subpacket_length);
- }
-
- mypos += hashed_subpacket_count;
- this.signatureData = input.substring(position, mypos);
-
- // alert("signatureData: "+util.hexstrdump(this.signatureData));
-
- // Two-octet scalar octet count for the following unhashed subpacket
- var subpacket_count = (input[mypos++].charCodeAt() << 8) + input[mypos++].charCodeAt();
-
- // Unhashed subpacket data set (zero or more subpackets).
- subpacket_length = 0;
- while (subpacket_count != subpacket_length) {
- if (subpacket_count < subpacket_length) {
- util.print_debug("openpgp.packet.signature.js\n"+"missed something: "+subpacket_length+" c:"+subpacket_count+" "+" l:"+subpacket_length);
- }
- subpacket_length += this._raw_read_signature_sub_packet(input,
- mypos + subpacket_length, subpacket_count
- - subpacket_length);
-
- }
- mypos += subpacket_count;
- // Two-octet field holding the left 16 bits of the signed hash
- // value.
- this.signedHashValue = (input[mypos++].charCodeAt() << 8) | input[mypos++].charCodeAt();
- // One or more multiprecision integers comprising the signature.
- // This portion is algorithm specific, as described above.
- var mpicount = 0;
- if (this.publicKeyAlgorithm > 0 && this.publicKeyAlgorithm < 4)
- mpicount = 1;
- else if (this.publicKeyAlgorithm == 17)
- mpicount = 2;
-
- this.MPIs = new Array();
- for (var i = 0; i < mpicount; i++) {
- this.MPIs[i] = new openpgp_type_mpi();
- if (this.MPIs[i].read(input, mypos, (mypos-position)) != null &&
- !this.packetLength < (mypos-position)) {
- mypos += this.MPIs[i].packetLength;
- } else {
- util.print_error('signature contains invalid MPI @:'+mypos);
- }
- }
- break;
- default:
- util.print_error("openpgp.packet.signature.js\n"+'unknown signature packet version'+this.version);
- break;
- }
- // util.print_message("openpgp.packet.signature.js\n"+"end signature: l: "+this.packetLength+"m: "+mypos+" m-p: "+(mypos-position));
- return this;
- }
- /**
- * creates a string representation of a message signature packet (tag 2).
- * This can be only used on text data
- * @param {Integer} signature_type should be 1 (one)
- * @param {String} data data to be signed
- * @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secMPIs MUST be unlocked)
- * @return {String} string representation of a signature packet
- */
- function write_message_signature(signature_type, data, privatekey) {
- var publickey = privatekey.privateKeyPacket.publicKey;
- var hash_algo = privatekey.getPreferredSignatureHashAlgorithm();
- var result = String.fromCharCode(4);
- result += String.fromCharCode(signature_type);
- result += String.fromCharCode(publickey.publicKeyAlgorithm);
- result += String.fromCharCode(hash_algo);
- var d = Math.round(new Date().getTime() / 1000);
- var datesubpacket = write_sub_signature_packet(2,""+
- String.fromCharCode((d >> 24) & 0xFF) +
- String.fromCharCode((d >> 16) & 0xFF) +
- String.fromCharCode((d >> 8) & 0xFF) +
- String.fromCharCode(d & 0xFF));
- var issuersubpacket = write_sub_signature_packet(16, privatekey.getKeyId());
- result += String.fromCharCode(((datesubpacket.length + issuersubpacket.length) >> 8) & 0xFF);
- result += String.fromCharCode ((datesubpacket.length + issuersubpacket.length) & 0xFF);
- result += datesubpacket;
- result += issuersubpacket;
- var trailer = '';
-
- trailer += String.fromCharCode(4);
- trailer += String.fromCharCode(0xFF);
- trailer += String.fromCharCode((result.length) >> 24);
- trailer += String.fromCharCode(((result.length) >> 16) & 0xFF);
- trailer += String.fromCharCode(((result.length) >> 8) & 0xFF);
- trailer += String.fromCharCode((result.length) & 0xFF);
- var result2 = String.fromCharCode(0);
- result2 += String.fromCharCode(0);
- var hash = openpgp_crypto_hashData(hash_algo, data+result+trailer);
- util.print_debug("DSA Signature is calculated with:|"+data+result+trailer+"|\n"+util.hexstrdump(data+result+trailer)+"\n hash:"+util.hexstrdump(hash));
- result2 += hash.charAt(0);
- result2 += hash.charAt(1);
- result2 += openpgp_crypto_signData(hash_algo,privatekey.privateKeyPacket.publicKey.publicKeyAlgorithm,
- publickey.MPIs,
- privatekey.privateKeyPacket.secMPIs,
- data+result+trailer);
- return {openpgp: (openpgp_packet.write_packet_header(2, (result+result2).length)+result + result2),
- hash: util.get_hashAlgorithmString(hash_algo)};
- }
- /**
- * 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 {String} data data to be included
- * @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)
- */
- function write_sub_signature_packet(type, data) {
- var result = "";
- result += openpgp_packet.encode_length(data.length+1);
- result += String.fromCharCode(type);
- result += data;
- return result;
- }
-
- // V4 signature sub packets
-
- this._raw_read_signature_sub_packet = function(input, position, len) {
- if (len < 0)
- util.print_debug("openpgp.packet.signature.js\n"+"_raw_read_signature_sub_packet length < 0 @:"+position);
- var mypos = position;
- var subplen = 0;
- // alert('starting signature subpackage read at position:'+position+' length:'+len);
- if (input[mypos].charCodeAt() < 192) {
- subplen = input[mypos++].charCodeAt();
- } else if (input[mypos].charCodeAt() >= 192 && input[mypos].charCodeAt() < 224) {
- subplen = ((input[mypos++].charCodeAt() - 192) << 8) + (input[mypos++].charCodeAt()) + 192;
- } else if (input[mypos].charCodeAt() > 223 && input[mypos].charCodeAt() < 255) {
- subplen = 1 << (input[mypos++].charCodeAt() & 0x1F);
- } else if (input[mypos].charCodeAt() < 255) {
- mypos++;
- subplen = (input[mypos++].charCodeAt() << 24) | (input[mypos++].charCodeAt() << 16)
- | (input[mypos++].charCodeAt() << 8) | input[mypos++].charCodeAt();
- }
-
- var type = input[mypos++].charCodeAt() & 0x7F;
- // alert('signature subpacket type '+type+" with length: "+subplen);
- // subpacket type
- switch (type) {
- case 2: // Signature Creation Time
- this.creationTime = new Date(((input[mypos++].charCodeAt() << 24) | (input[mypos++].charCodeAt() << 16)
- | (input[mypos++].charCodeAt() << 8) | input[mypos++].charCodeAt())*1000);
- break;
- case 3: // Signature Expiration Time
- this.signatureExpirationTime = (input[mypos++].charCodeAt() << 24)
- | (input[mypos++].charCodeAt() << 16) | (input[mypos++].charCodeAt() << 8)
- | input[mypos++].charCodeAt();
- this.signatureNeverExpires = (this.signature_expiration_time == 0);
-
- break;
- case 4: // Exportable Certification
- this.exportable = input[mypos++].charCodeAt() == 1;
- break;
- case 5: // Trust Signature
- this.trustLevel = input[mypos++].charCodeAt();
- this.trustAmount = input[mypos++].charCodeAt();
- break;
- case 6: // Regular Expression
- this.regular_expression = new String();
- for (var i = 0; i < subplen - 1; i++)
- this.regular_expression += (input[mypos++]);
- break;
- case 7: // Revocable
- this.revocable = input[mypos++].charCodeAt() == 1;
- break;
- case 9: // Key Expiration Time
- this.keyExpirationTime = (input[mypos++].charCodeAt() << 24)
- | (input[mypos++].charCodeAt() << 16) | (input[mypos++].charCodeAt() << 8)
- | input[mypos++].charCodeAt();
- this.keyNeverExpires = (this.keyExpirationTime == 0);
- break;
- case 11: // Preferred Symmetric Algorithms
- this.preferredSymmetricAlgorithms = new Array();
- for (var i = 0; i < subplen-1; i++) {
- this.preferredSymmetricAlgorithms = input[mypos++].charCodeAt();
- }
- break;
- case 12: // Revocation Key
- // (1 octet of class, 1 octet of public-key algorithm ID, 20
- // octets of
- // fingerprint)
- this.revocationKeyClass = input[mypos++].charCodeAt();
- this.revocationKeyAlgorithm = input[mypos++].charCodeAt();
- this.revocationKeyFingerprint = new Array();
- for ( var i = 0; i < 20; i++) {
- this.revocationKeyFingerprint = input[mypos++].charCodeAt();
- }
- break;
- case 16: // Issuer
- this.issuerKeyId = input.substring(mypos,mypos+8);
- mypos += 8;
- break;
- case 20: // Notation Data
- this.notationFlags = (input[mypos++].charCodeAt() << 24) |
- (input[mypos++].charCodeAt() << 16) |
- (input[mypos++].charCodeAt() << 8) |
- (input[mypos++].charCodeAt());
- var nameLength = (input[mypos++].charCodeAt() << 8) | (input[mypos++].charCodeAt());
- var valueLength = (input[mypos++].charCodeAt() << 8) | (input[mypos++].charCodeAt());
- this.notationName = "";
- for (var i = 0; i < nameLength; i++) {
- this.notationName += input[mypos++];
- }
- this.notationValue = "";
- for (var i = 0; i < valueLength; i++) {
- this.notationValue += input[mypos++];
- }
- break;
- case 21: // Preferred Hash Algorithms
- this.preferredHashAlgorithms = new Array();
- for (var i = 0; i < subplen-1; i++) {
- this.preferredHashAlgorithms = input[mypos++].charCodeAt();
- }
- break;
- case 22: // Preferred Compression Algorithms
- this.preferredCompressionAlgorithms = new Array();
- for ( var i = 0; i < subplen-1; i++) {
- this.preferredCompressionAlgorithms = input[mypos++].charCodeAt();
- }
- break;
- case 23: // Key Server Preferences
- this.keyServerPreferences = new Array();
- for ( var i = 0; i < subplen-1; i++) {
- this.keyServerPreferences = input[mypos++].charCodeAt();
- }
- break;
- case 24: // Preferred Key Server
- this.preferredKeyServer = new String();
- for ( var i = 0; i < subplen-1; i++) {
- this.preferredKeyServer += input[mypos++];
- }
- break;
- case 25: // Primary User ID
- this.isPrimaryUserID = input[mypos++] != 0;
- break;
- case 26: // Policy URI
- this.policyURI = new String();
- for ( var i = 0; i < subplen-1; i++) {
- this.policyURI += input[mypos++];
- }
- break;
- case 27: // Key Flags
- this.keyFlags = new Array();
- for ( var i = 0; i < subplen-1; i++) {
- this.keyFlags = input[mypos++].charCodeAt();
- }
- break;
- case 28: // Signer's User ID
- this.signersUserId = new String();
- for ( var i = 0; i < subplen-1; i++) {
- this.signersUserId += input[mypos++];
- }
- break;
- case 29: // Reason for Revocation
- this.reasonForRevocationFlag = input[mypos++].charCodeAt();
- this.reasonForRevocationString = new String();
- for ( var i = 0; i < subplen -2; i++) {
- this.reasonForRevocationString += input[mypos++];
- }
- break;
- case 30: // Features
- // TODO: to be implemented
- return subplen+1;
- case 31: // Signature Target
- // (1 octet public-key algorithm, 1 octet hash algorithm, N octets hash)
- this.signatureTargetPublicKeyAlgorithm = input[mypos++].charCodeAt();
- this.signatureTargetHashAlgorithm = input[mypos++].charCodeAt();
- var signatureTargetHashAlgorithmLength = 0;
- switch(this.signatureTargetHashAlgorithm) {
- case 1: // - MD5 [HAC] "MD5"
- case 2: // - SHA-1 [FIPS180] "SHA1"
- signatureTargetHashAlgorithmLength = 20;
- break;
- case 3: // - RIPE-MD/160 [HAC] "RIPEMD160"
- case 8: // - SHA256 [FIPS180] "SHA256"
- case 9: // - SHA384 [FIPS180] "SHA384"
- case 10: // - SHA512 [FIPS180] "SHA512"
- case 11: // - SHA224 [FIPS180] "SHA224"
- break;
- // 100 to 110 - Private/Experimental algorithm
- default:
- util.print_error("openpgp.packet.signature.js\n"+"unknown signature target hash algorithm:"+this.signatureTargetHashAlgorithm);
- return null;
- }
- this.signatureTargetHash = new Array();
- for (var i = 0; i < signatureTargetHashAlgorithmLength; i++) {
- this.signatureTargetHash[i] = input[mypos++];
- }
- case 32: // Embedded Signature
- this.embeddedSignature = new openpgp_packet_signature();
- this.embeddedSignature.read_packet(input, mypos, len -(mypos-position));
- return ((mypos+ this.embeddedSignature.packetLength) - position);
- break;
- case 100: // Private or experimental
- case 101: // Private or experimental
- case 102: // Private or experimental
- case 103: // Private or experimental
- case 104: // Private or experimental
- case 105: // Private or experimental
- case 106: // Private or experimental
- case 107: // Private or experimental
- case 108: // Private or experimental
- case 109: // Private or experimental
- case 110: // Private or experimental
- util.print_error("openpgp.packet.signature.js\n"+'private or experimental signature subpacket type '+type+" @:"+mypos+" subplen:"+subplen+" len:"+len);
- return subplen+1;
- break;
- case 0: // Reserved
- case 1: // Reserved
- case 8: // Reserved
- case 10: // Placeholder for backward compatibility
- case 13: // Reserved
- case 14: // Reserved
- case 15: // Reserved
- case 17: // Reserved
- case 18: // Reserved
- case 19: // Reserved
- default:
- util.print_error("openpgp.packet.signature.js\n"+'unknown signature subpacket type '+type+" @:"+mypos+" subplen:"+subplen+" len:"+len);
- return subplen+1;
- break;
- }
- return mypos -position;
- };
- /**
- * verifys the signature packet. Note: not signature types are implemented
- * @param {String} data data which on the signature applies
- * @param {openpgp_msg_privatekey} key the public key to verify the signature
- * @return {boolean} True if message is verified, else false.
- */
- function verify(data, key) {
- // calculating the trailer
- var trailer = '';
- trailer += String.fromCharCode(this.version);
- trailer += String.fromCharCode(0xFF);
- trailer += String.fromCharCode(this.signatureData.length >> 24);
- trailer += String.fromCharCode((this.signatureData.length >> 16) &0xFF);
- trailer += String.fromCharCode((this.signatureData.length >> 8) &0xFF);
- trailer += String.fromCharCode(this.signatureData.length & 0xFF);
- switch(this.signatureType) {
- case 0: // 0x00: Signature of a binary document.
- if (this.version == 4) {
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.obj.publicKeyPacket.MPIs, data+this.signatureData+trailer);
- }
- break;
-
- case 1: // 0x01: Signature of a canonical text document.
- if (this.version == 4) {
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.obj.publicKeyPacket.MPIs, data+this.signatureData+trailer);
- return this.verified;
- }
- break;
-
- case 2: // 0x02: Standalone signature.
- // This signature is a signature of only its own subpacket contents.
- // It is calculated identically to a signature over a zero-length
- // binary document. Note that it doesn't make sense to have a V3
- // standalone signature.
- if (this.version == 3) {
- this.verified = false;
- break;
- }
-
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.obj.publicKeyPacket.MPIs, this.signatureData+trailer);
- break;
- case 16:
- // 0x10: Generic certification of a User ID and Public-Key packet.
- // The issuer of this certification does not make any particular
- // assertion as to how well the certifier has checked that the owner
- // of the key is in fact the person described by the User ID.
- case 17:
- // 0x11: Persona certification of a User ID and Public-Key packet.
- // The issuer of this certification has not done any verification of
- // the claim that the owner of this key is the User ID specified.
- case 18:
- // 0x12: Casual certification of a User ID and Public-Key packet.
- // The issuer of this certification has done some casual
- // verification of the claim of identity.
- case 19:
- // 0x13: Positive certification of a User ID and Public-Key packet.
- // The issuer of this certification has done substantial
- // verification of the claim of identity.
- //
- // Most OpenPGP implementations make their "key signatures" as 0x10
- // certifications. Some implementations can issue 0x11-0x13
- // certifications, but few differentiate between the types.
- case 48:
- // 0x30: Certification revocation signature
- // This signature revokes an earlier User ID certification signature
- // (signature class 0x10 through 0x13) or direct-key signature
- // (0x1F). It should be issued by the same key that issued the
- // revoked signature or an authorized revocation key. The signature
- // is computed over the same data as the certificate that it
- // revokes, and should have a later creation date than that
- // certificate.
-
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.MPIs, data+this.signatureData+trailer);
- break;
-
- case 24:
- // 0x18: Subkey Binding Signature
- // This signature is a statement by the top-level signing key that
- // indicates that it owns the subkey. This signature is calculated
- // directly on the primary key and subkey, and not on any User ID or
- // other packets. A signature that binds a signing subkey MUST have
- // an Embedded Signature subpacket in this binding signature that
- // contains a 0x19 signature made by the signing subkey on the
- // primary key and subkey.
- if (this.version == 3) {
- this.verified = false;
- break;
- }
-
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.MPIs, data+this.signatureData+trailer);
- break;
- case 25:
- // 0x19: Primary Key Binding Signature
- // This signature is a statement by a signing subkey, indicating
- // that it is owned by the primary key and subkey. This signature
- // is calculated the same way as a 0x18 signature: directly on the
- // primary key and subkey, and not on any User ID or other packets.
-
- // When a signature is made over a key, the hash data starts with the
- // octet 0x99, followed by a two-octet length of the key, and then body
- // of the key packet. (Note that this is an old-style packet header for
- // a key packet with two-octet length.) A subkey binding signature
- // (type 0x18) or primary key binding signature (type 0x19) then hashes
- // the subkey using the same format as the main key (also using 0x99 as
- // the first octet).
- case 31:
- // 0x1F: Signature directly on a key
- // This signature is calculated directly on a key. It binds the
- // information in the Signature subpackets to the key, and is
- // appropriate to be used for subpackets that provide information
- // about the key, such as the Revocation Key subpacket. It is also
- // appropriate for statements that non-self certifiers want to make
- // about the key itself, rather than the binding between a key and a
- // name.
- case 32:
- // 0x20: Key revocation signature
- // The signature is calculated directly on the key being revoked. A
- // revoked key is not to be used. Only revocation signatures by the
- // key being revoked, or by an authorized revocation key, should be
- // considered valid revocation signatures.
- case 40:
- // 0x28: Subkey revocation signature
- // The signature is calculated directly on the subkey being revoked.
- // A revoked subkey is not to be used. Only revocation signatures
- // by the top-level signature key that is bound to this subkey, or
- // by an authorized revocation key, should be considered valid
- // revocation signatures.
- this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm, this.hashAlgorithm,
- this.MPIs, key.MPIs, data+this.signatureData+trailer);
- break;
-
- // Key revocation signatures (types 0x20 and 0x28)
- // hash only the key being revoked.
- case 64:
- // 0x40: Timestamp signature.
- // This signature is only meaningful for the timestamp contained in
- // it.
- case 80:
- // 0x50: Third-Party Confirmation signature.
- // This signature is a signature over some other OpenPGP Signature
- // packet(s). It is analogous to a notary seal on the signed data.
- // A third-party signature SHOULD include Signature Target
- // subpacket(s) to give easy identification. Note that we really do
- // mean SHOULD. There are plausible uses for this (such as a blind
- // party that only sees the signature, not the key or source
- // document) that cannot include a target subpacket.
- default:
- util.print_error("openpgp.packet.signature.js\n"+"signature verification for type"+ this.signatureType+" not implemented");
- break;
- }
- return this.verified;
- }
- /**
- * generates debug output (pretty print)
- * @return {String} String which gives some information about the signature packet
- */
-
- function toString () {
- if (this.version == 3) {
- var result = '5.2. Signature Packet (Tag 2)\n'+
- "Packet Length: :"+this.packetLength+'\n'+
- "Packet version: :"+this.version+'\n'+
- "One-octet signature type :"+this.signatureType+'\n'+
- "Four-octet creation time. :"+this.creationTime+'\n'+
- "Eight-octet Key ID of signer. :"+util.hexidump(this.keyId)+'\n'+
- "One-octet public-key algorithm. :"+this.publicKeyAlgorithm+'\n'+
- "One-octet hash algorithm. :"+this.hashAlgorithm+'\n'+
- "Two-octet field holding left\n" +
- " 16 bits of signed hash value. :"+this.signedHashValue+'\n';
- } else {
- var result = '5.2. Signature Packet (Tag 2)\n'+
- "Packet Length: :"+this.packetLength+'\n'+
- "Packet version: :"+this.version+'\n'+
- "One-octet signature type :"+this.signatureType+'\n'+
- "One-octet public-key algorithm. :"+this.publicKeyAlgorithm+'\n'+
- "One-octet hash algorithm. :"+this.hashAlgorithm+'\n'+
- "Two-octet field holding left\n" +
- " 16 bits of signed hash value. :"+this.signedHashValue+'\n'+
- "Signature Creation Time :"+this.creationTime+'\n'+
- "Signature Expiration Time :"+this.signatureExpirationTime+'\n'+
- "Signature Never Expires :"+this.signatureNeverExpires+'\n'+
- "Exportable Certification :"+this.exportable+'\n'+
- "Trust Signature level: :"+this.trustLevel+' amount'+this.trustAmount+'\n'+
- "Regular Expression :"+this.regular_expression+'\n'+
- "Revocable :"+this.revocable+'\n'+
- "Key Expiration Time :"+this.keyExpirationTime+" "+this.keyNeverExpires+'\n'+
- "Preferred Symmetric Algorithms :"+this.preferredSymmetricAlgorithms+'\n'+
- "Revocation Key"+'\n'+
- " ( 1 octet of class, :"+this.revocationKeyClass +'\n'+
- " 1 octet of public-key ID, :" +this.revocationKeyAlgorithm+'\n'+
- " 20 octets of fingerprint) :"+this.revocationKeyFingerprint+'\n'+
- "Issuer :"+util.hexstrdump(this.issuerKeyId)+'\n'+
- "Preferred Hash Algorithms :"+this.preferredHashAlgorithms+'\n'+
- "Preferred Compression Alg. :"+this.preferredCompressionAlgorithms+'\n'+
- "Key Server Preferences :"+this.keyServerPreferences+'\n'+
- "Preferred Key Server :"+this.preferredKeyServer+'\n'+
- "Primary User ID :"+this.isPrimaryUserID+'\n'+
- "Policy URI :"+this.policyURI+'\n'+
- "Key Flags :"+this.keyFlags+'\n'+
- "Signer's User ID :"+this.signersUserId+'\n'+
- "Notation :"+this.notationName+" = "+this.notationValue+"\n"+
- "Reason for Revocation\n"+
- " Flag :"+this.reasonForRevocationFlag+'\n'+
- " Reason :"+this.reasonForRevocationString+'\nMPI:\n';
- }
- for (var i = 0; i < this.MPIs.length; i++) {
- result += this.MPIs[i].toString();
- }
- return result;
- }
-
- /**
- * gets the issuer key id of this signature
- * @return {String} issuer key id as string (8bytes)
- */
- function getIssuer() {
- if (this.version == 4)
- return this.issuerKeyId;
- if (this.verions == 4)
- return this.keyId;
- return null;
- }
-
- /**
- * Tries to get the corresponding public key out of the public keyring for the issuer created this signature
- * @return {Object} {obj: [openpgp_msg_publickey], text: [String]} if found the public key will be returned. null otherwise
- */
- function getIssuerKey() {
- var result = null;
- if (this.version == 4) {
- result = openpgp.keyring.getPublicKeysForKeyId(this.issuerKeyId);
- } else if (this.version == 3) {
- result = openpgp.keyring.getPublicKeysForKeyId(this.keyId);
- } else return null;
- if (result.length == 0)
- return null;
- return result[0];
- }
- this.getIssuerKey = getIssuerKey;
- this.getIssuer = getIssuer;
- this.write_message_signature = write_message_signature;
- this.verify = verify;
- this.read_packet = read_packet;
- this.toString = toString;
-}
-// GPG4Browsers - An OpenPGP implementation in javascript
-// Copyright (C) 2011 Recurity Labs GmbH
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
/**
* @class
* @classdesc Implementation of the User Attribute Packet (Tag 17)
@@ -10727,6 +9979,27 @@ function openpgp_packet_userattribute() {
* packet types and packet header.
*/
function _openpgp_packet() {
+
+ this.read_simple_length = function(bytes) {
+ var len = 0,
+ offset,
+ type = bytes[0].charCodeAt();
+
+
+ if (type < 192) {
+ len = bytes[0].charCodeAt();
+ offset = 1;
+ } else if (type < 255) {
+ len = ((bytes[0].charCodeAt() - 192) << 8) + (bytes[1].charCodeAt()) + 192;
+ offset = 2;
+ } else if (type == 255) {
+ len = openpgp_packet_integer_read(bytes.substr(1, 4));
+ offset = 5;
+ }
+
+ return { len: len, offset: offset };
+ }
+
/**
* Encodes a given integer of length to the openpgp length specifier to a
* string
@@ -10734,7 +10007,7 @@ function _openpgp_packet() {
* @param {Integer} length The length to encode
* @return {String} String with openpgp length representation
*/
- function encode_length(length) {
+ this.encode_length = function(length) {
var result = "";
if (length < 192) {
result += String.fromCharCode(length);
@@ -10754,7 +10027,6 @@ function _openpgp_packet() {
}
return result;
}
- this.encode_length = encode_length;
/**
* Writes a packet header version 4 with the given tag_type and length to a
@@ -10768,7 +10040,7 @@ function _openpgp_packet() {
/* we're only generating v4 packet headers here */
var result = "";
result += String.fromCharCode(0xC0 | tag_type);
- result += encode_length(length);
+ result += this.encode_length(length);
return result;
}
@@ -12055,12 +11327,521 @@ function openpgp_packet_secret_subkey() {
*/
function openpgp_packet_signature() {
this.tag = 2;
+ this.signatureType = null;
+ this.created = null;
+ this.signatureData = null;
+ this.signatureExpirationTime = null;
+ this.signatureNeverExpires = null;
+ this.signedHashValue = null;
+ this.mpi = null;
+ this.publicKeyAlgorithm = null;
+ this.hashAlgorithm = null;
+ this.exportable = null;
+ this.trustLevel = null;
+ this.trustAmount = null;
+ this.regularExpression = null;
+ this.revocable = null;
+ this.keyExpirationTime = null;
+ this.keyNeverExpires = null;
+ this.preferredSymmetricAlgorithms = null;
+ this.revocationKeyClass = null;
+ this.revocationKeyAlgorithm = null;
+ this.revocationKeyFingerprint = null;
+ this.issuerKeyId = null;
+ this.notation = {};
+ this.preferredHashAlgorithms = null;
+ this.preferredCompressionAlgorithms = null;
+ this.keyServerPreferences = null;
+ this.preferredKeyServer = null;
+ this.isPrimaryUserID = null;
+ this.policyURI = null;
+ this.keyFlags = null;
+ this.signersUserId = null;
+ this.reasonForRevocationFlag = null;
+ this.reasonForRevocationString = null;
+ this.signatureTargetPublicKeyAlgorithm = null;
+ this.signatureTargetHashAlgorithm = null;
+ this.signatureTargetHash = null;
+ this.embeddedSignature = null;
+ this.verified = false;
+
- this.write = function() {
+ /**
+ * parsing function for a signature packet (tag 2).
+ * @param {String} bytes payload of a tag 2 packet
+ * @param {Integer} position position to start reading from the bytes string
+ * @param {Integer} len length of the packet or the remaining length of bytes at position
+ * @return {openpgp_packet_encrypteddata} object representation
+ */
+ this.read = function(bytes) {
+ var i = 0;
+ this.version = bytes[i++].charCodeAt();
+ // switch on version (3 and 4)
+ switch (this.version) {
+ case 3:
+ // One-octet length of following hashed material. MUST be 5.
+ if (bytes[i++].charCodeAt() != 5)
+ util.print_debug("openpgp.packet.signature.js\n"+
+ 'invalid One-octet length of following hashed material.' +
+ 'MUST be 5. @:'+(i-1));
+
+ var sigpos = i;
+ // One-octet signature type.
+ this.signatureType = bytes[i++].charCodeAt();
+
+ // Four-octet creation time.
+ this.created = openpgp_packet_time_read(bytes.substr(i, 4));
+ i += 4;
+
+ // storing data appended to data which gets verified
+ this.signatureData = bytes.substring(position, i);
+
+ // Eight-octet Key ID of signer.
+ this.issuerKeyId = bytes.substring(i, i +8);
+ i += 8;
+
+ // One-octet public-key algorithm.
+ this.publicKeyAlgorithm = bytes[i++].charCodeAt();
+
+ // One-octet hash algorithm.
+ this.hashAlgorithm = bytes[i++].charCodeAt();
+ break;
+ case 4:
+ this.signatureType = bytes[i++].charCodeAt();
+ this.publicKeyAlgorithm = bytes[i++].charCodeAt();
+ this.hashAlgorithm = bytes[i++].charCodeAt();
+
+
+ function subpackets(bytes, signed) {
+ // Two-octet scalar octet count for following hashed subpacket
+ // data.
+ var subpacket_length = openpgp_packet_number_read(
+ bytes.substr(0, 2));
+
+ var i = 2;
+
+ // Hashed subpacket data set (zero or more subpackets)
+ var subpacked_read = 0;
+ while (i < 2 + subpacket_length) {
+
+ var len = openpgp_packet.read_simple_length(bytes.substr(i));
+ i += len.offset;
+
+ // Since it is trivial to add data to the unhashed portion of
+ // the packet we simply ignore all unauthenticated data.
+ if(signed)
+ this.read_sub_packet(bytes.substr(i, len.len));
+
+ i += len.len;
+ }
+
+ return i;
+ }
+
+ i += subpackets.call(this, bytes.substr(i), true);
+
+ // A V4 signature hashes the packet body
+ // starting from its first field, the version number, through the end
+ // of the hashed subpacket data. Thus, the fields hashed are the
+ // signature version, the signature type, the public-key algorithm, the
+ // hash algorithm, the hashed subpacket length, and the hashed
+ // subpacket body.
+ this.signatureData = bytes.substr(0, i);
+
+ i += subpackets.call(this, bytes.substr(i), false);
+
+ break;
+ default:
+ util.print_error("openpgp.packet.signature.js\n"+
+ 'unknown signature packet version'+this.version);
+ break;
+ }
+
+ // Two-octet field holding left 16 bits of signed hash value.
+ this.signedHashValue = bytes.substr(i, 2);
+ i += 2;
+
+ var mpicount = 0;
+ // Algorithm-Specific Fields for RSA signatures:
+ // - multiprecision number (MPI) of RSA signature value m**d mod n.
+ if (this.publicKeyAlgorithm > 0 && this.publicKeyAlgorithm < 4)
+ mpicount = 1;
+ // Algorithm-Specific Fields for DSA signatures:
+ // - MPI of DSA value r.
+ // - MPI of DSA value s.
+ else if (this.publicKeyAlgorithm == 17)
+ mpicount = 2;
+
+ this.mpi = [];
+ for (var j = 0; j < mpicount; j++) {
+ this.mpi[j] = new openpgp_type_mpi();
+ i += this.mpi[j].read(bytes.substr(i));
+ }
}
- this.read = function() {}
+ /**
+ * creates a string representation of a message signature packet (tag 2).
+ * This can be only used on text data
+ * @param {Integer} signature_type should be 1 (one)
+ * @param {String} data data to be signed
+ * @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secmpi MUST be unlocked)
+ * @return {String} string representation of a signature packet
+ */
+ function write_message_signature(signature_type, data, privatekey) {
+ var publickey = privatekey.privateKeyPacket.publicKey;
+ var hash_algo = privatekey.getPreferredSignatureHashAlgorithm();
+ var result = String.fromCharCode(4);
+ result += String.fromCharCode(signature_type);
+ result += String.fromCharCode(publickey.publicKeyAlgorithm);
+ result += String.fromCharCode(hash_algo);
+ var d = Math.round(new Date().getTime() / 1000);
+ var datesubpacket = write_sub_signature_packet(2,""+
+ String.fromCharCode((d >> 24) & 0xFF) +
+ String.fromCharCode((d >> 16) & 0xFF) +
+ String.fromCharCode((d >> 8) & 0xFF) +
+ String.fromCharCode(d & 0xFF));
+ var issuersubpacket = write_sub_signature_packet(16, privatekey.getKeyId());
+ result += String.fromCharCode(((datesubpacket.length + issuersubpacket.length) >> 8) & 0xFF);
+ result += String.fromCharCode ((datesubpacket.length + issuersubpacket.length) & 0xFF);
+ result += datesubpacket;
+ result += issuersubpacket;
+ var trailer = '';
+
+ trailer += String.fromCharCode(4);
+ trailer += String.fromCharCode(0xFF);
+ trailer += String.fromCharCode((result.length) >> 24);
+ trailer += String.fromCharCode(((result.length) >> 16) & 0xFF);
+ trailer += String.fromCharCode(((result.length) >> 8) & 0xFF);
+ trailer += String.fromCharCode((result.length) & 0xFF);
+ var result2 = String.fromCharCode(0);
+ result2 += String.fromCharCode(0);
+ var hash = openpgp_crypto_hashData(hash_algo, data+result+trailer);
+ util.print_debug("DSA Signature is calculated with:|"+data+result+trailer+"|\n"+util.hexstrdump(data+result+trailer)+"\n hash:"+util.hexstrdump(hash));
+ result2 += hash.charAt(0);
+ result2 += hash.charAt(1);
+ result2 += openpgp_crypto_signData(hash_algo,privatekey.privateKeyPacket.publicKey.publicKeyAlgorithm,
+ publickey.mpi,
+ privatekey.privateKeyPacket.secmpi,
+ data+result+trailer);
+ return {openpgp: (openpgp_packet.write_packet_header(2, (result+result2).length)+result + result2),
+ hash: util.get_hashAlgorithmString(hash_algo)};
+ }
+ /**
+ * 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 {String} data data to be included
+ * @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)
+ */
+ function write_sub_signature_packet(type, data) {
+ var result = "";
+ result += openpgp_packet.encode_length(data.length+1);
+ result += String.fromCharCode(type);
+ result += data;
+ return result;
+ }
+
+ // V4 signature sub packets
+
+ this.read_sub_packet = function(bytes) {
+ var mypos = 0;
+
+ function read_array(prop, bytes) {
+ this[prop] = [];
+
+ for (var i = 0; i < bytes.length; i++) {
+ this[prop].push(bytes[i].charCodeAt());
+ }
+ }
+
+ // The leftwost bit denotes a "critical" packet, but we ignore it.
+ var type = bytes[mypos++].charCodeAt() & 0x7F;
+
+ // subpacket type
+ switch (type) {
+ case 2: // Signature Creation Time
+ this.created = openpgp_packet_time_read(bytes.substr(mypos));
+ break;
+ case 3: // Signature Expiration Time
+ var time = openpgp_packet_time_read(bytes.substr(mypos));
+
+ this.signatureNeverExpires = time.getTime() == 0;
+ this.signatureExpirationTime = time;
+
+ break;
+ case 4: // Exportable Certification
+ this.exportable = bytes[mypos++].charCodeAt() == 1;
+ break;
+ case 5: // Trust Signature
+ this.trustLevel = bytes[mypos++].charCodeAt();
+ this.trustAmount = bytes[mypos++].charCodeAt();
+ break;
+ case 6: // Regular Expression
+ this.regularExpression = bytes.substr(mypos);
+ break;
+ case 7: // Revocable
+ this.revocable = bytes[mypos++].charCodeAt() == 1;
+ break;
+ case 9: // Key Expiration Time
+ var time = openpgp_packet_time_read(bytes.substr(mypos));
+
+ this.keyExpirationTime = time;
+ this.keyNeverExpires = time.getTime() == 0;
+
+ break;
+ case 11: // Preferred Symmetric Algorithms
+ this.preferredSymmetricAlgorithms = [];
+
+ while(mypos != bytes.length) {
+ this.preferredSymmetricAlgorithms.push(bytes[mypos++].charCodeAt());
+ }
+
+ break;
+ case 12: // Revocation Key
+ // (1 octet of class, 1 octet of public-key algorithm ID, 20
+ // octets of
+ // fingerprint)
+ this.revocationKeyClass = bytes[mypos++].charCodeAt();
+ this.revocationKeyAlgorithm = bytes[mypos++].charCodeAt();
+ this.revocationKeyFingerprint = bytes.substr(mypos, 20);
+ break;
+
+ case 16: // Issuer
+ this.issuerKeyId = bytes.substr(mypos, 8);
+ break;
+
+ case 20: // Notation Data
+ // We don't know how to handle anything but a text flagged data.
+ if(bytes[mypos].charCodeAt() == 0x80) {
+
+ mypos += 4;
+ var m = openpgp_packet_number_read(bytes.substr(mypos, 2));
+ mypos += 2
+ var n = openpgp_packet_number_read(bytes.substr(mypos, 2));
+ mypos += 2
+
+ var name = bytes.substr(mypos, m),
+ value = bytes.substr(mypos + m, n);
+
+ this.notation[name] = value;
+ }
+ break;
+ case 21: // Preferred Hash Algorithms
+ read_array.call(this, 'preferredHashAlgorithms', bytes.substr(mypos));
+ break;
+ case 22: // Preferred Compression Algorithms
+ read_array.call(this, 'preferredCompressionAlgorithms ', bytes.substr(mypos));
+ break;
+ case 23: // Key Server Preferences
+ read_array.call(this, 'keyServerPreferencess', bytes.substr(mypos));
+ break;
+ case 24: // Preferred Key Server
+ this.preferredKeyServer = bytes.substr(mypos);
+ break;
+ case 25: // Primary User ID
+ this.isPrimaryUserID = bytes[mypos++] != 0;
+ break;
+ case 26: // Policy URI
+ this.policyURI = bytes.substr(mypos);
+ break;
+ case 27: // Key Flags
+ read_array.call(this, 'keyFlags', bytes.substr(mypos));
+ break;
+ case 28: // Signer's User ID
+ this.signersUserId += bytes.substr(mypos);
+ break;
+ case 29: // Reason for Revocation
+ this.reasonForRevocationFlag = bytes[mypos++].charCodeAt();
+ this.reasonForRevocationString = bytes.substr(mypos);
+ break;
+ case 30: // Features
+ read_array.call(this, 'features', bytes.substr(mypos));
+ break;
+ case 31: // Signature Target
+ // (1 octet public-key algorithm, 1 octet hash algorithm, N octets hash)
+ this.signatureTargetPublicKeyAlgorithm = bytes[mypos++].charCodeAt();
+ this.signatureTargetHashAlgorithm = bytes[mypos++].charCodeAt();
+
+ var len = openpgp_crypto_getHashByteLength(this.signatureTargetHashAlgorithm);
+
+ this.signatureTargetHash = bytes.substr(mypos, len);
+ break;
+ case 32: // Embedded Signature
+ this.embeddedSignature = new openpgp_packet_signature();
+ this.embeddedSignature.read(bytes.substr(mypos));
+ break;
+ default:
+ util.print_error("openpgp.packet.signature.js\n"+
+ 'unknown signature subpacket type '+type+" @:"+mypos+
+ " subplen:"+subplen+" len:"+len);
+ break;
+ }
+ };
+
+ /**
+ * verifys the signature packet. Note: not signature types are implemented
+ * @param {String} data data which on the signature applies
+ * @param {openpgp_msg_privatekey} key the public key to verify the signature
+ * @return {boolean} True if message is verified, else false.
+ */
+ this.verify = function(data, key) {
+ // calculating the trailer
+ var trailer = '';
+ trailer += String.fromCharCode(this.version);
+ trailer += String.fromCharCode(0xFF);
+ trailer += openpgp_packet_number_write(this.signatureData.length, 4);
+
+ switch(this.signatureType) {
+ case 0: // 0x00: Signature of a binary document.
+ if (this.version == 4) {
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi,
+ data+this.signatureData+trailer);
+ }
+ break;
+
+ case 1: // 0x01: Signature of a canonical text document.
+ if (this.version == 4) {
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi,
+ data+this.signatureData+trailer);
+ return this.verified;
+ }
+ break;
+
+ case 2: // 0x02: Standalone signature.
+ // This signature is a signature of only its own subpacket contents.
+ // It is calculated identically to a signature over a zero-lengh
+ // binary document. Note that it doesn't make sense to have a V3
+ // standalone signature.
+ if (this.version == 3) {
+ this.verified = false;
+ break;
+ }
+
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi,
+ this.signatureData+trailer);
+ break;
+ case 16:
+ // 0x10: Generic certification of a User ID and Public-Key packet.
+ // The issuer of this certification does not make any particular
+ // assertion as to how well the certifier has checked that the owner
+ // of the key is in fact the person described by the User ID.
+ case 17:
+ // 0x11: Persona certification of a User ID and Public-Key packet.
+ // The issuer of this certification has not done any verification of
+ // the claim that the owner of this key is the User ID specified.
+ case 18:
+ // 0x12: Casual certification of a User ID and Public-Key packet.
+ // The issuer of this certification has done some casual
+ // verification of the claim of identity.
+ case 19:
+ // 0x13: Positive certification of a User ID and Public-Key packet.
+ // The issuer of this certification has done substantial
+ // verification of the claim of identity.
+ //
+ // Most OpenPGP implementations make their "key signatures" as 0x10
+ // certifications. Some implementations can issue 0x11-0x13
+ // certifications, but few differentiate between the types.
+ case 48:
+ // 0x30: Certification revocation signature
+ // This signature revokes an earlier User ID certification signature
+ // (signature class 0x10 through 0x13) or direct-key signature
+ // (0x1F). It should be issued by the same key that issued the
+ // revoked signature or an authorized revocation key. The signature
+ // is computed over the same data as the certificate that it
+ // revokes, and should have a later creation date than that
+ // certificate.
+
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi,
+ String.fromCharCode(0xB4) +
+ openpgp_packet_number_write(data.length, 4) +
+ data + this.signatureData + trailer);
+ break;
+
+ case 24:
+ // 0x18: Subkey Binding Signature
+ // This signature is a statement by the top-level signing key that
+ // indicates that it owns the subkey. This signature is calculated
+ // directly on the primary key and subkey, and not on any User ID or
+ // other packets. A signature that binds a signing subkey MUST have
+ // an Embedded Signature subpacket in this binding signature that
+ // contains a 0x19 signature made by the signing subkey on the
+ // primary key and subkey.
+ if (this.version == 3) {
+ this.verified = false;
+ break;
+ }
+
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi, data+this.signatureData+trailer);
+ break;
+ case 25:
+ // 0x19: Primary Key Binding Signature
+ // This signature is a statement by a signing subkey, indicating
+ // that it is owned by the primary key and subkey. This signature
+ // is calculated the same way as a 0x18 signature: directly on the
+ // primary key and subkey, and not on any User ID or other packets.
+
+ // When a signature is made over a key, the hash data starts with the
+ // octet 0x99, followed by a two-octet length of the key, and then body
+ // of the key packet. (Note that this is an old-style packet header for
+ // a key packet with two-octet length.) A subkey binding signature
+ // (type 0x18) or primary key binding signature (type 0x19) then hashes
+ // the subkey using the same format as the main key (also using 0x99 as
+ // the first octet).
+ case 31:
+ // 0x1F: Signature directly on a key
+ // This signature is calculated directly on a key. It binds the
+ // information in the Signature subpackets to the key, and is
+ // appropriate to be used for subpackets that provide information
+ // about the key, such as the Revocation Key subpacket. It is also
+ // appropriate for statements that non-self certifiers want to make
+ // about the key itself, rather than the binding between a key and a
+ // name.
+ case 32:
+ // 0x20: Key revocation signature
+ // The signature is calculated directly on the key being revoked. A
+ // revoked key is not to be used. Only revocation signatures by the
+ // key being revoked, or by an authorized revocation key, should be
+ // considered valid revocation signatures.
+ case 40:
+ // 0x28: Subkey revocation signature
+ // The signature is calculated directly on the subkey being revoked.
+ // A revoked subkey is not to be used. Only revocation signatures
+ // by the top-level signature key that is bound to this subkey, or
+ // by an authorized revocation key, should be considered valid
+ // revocation signatures.
+ this.verified = openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
+ this.hashAlgorithm, this.mpi, key.mpi, data+this.signatureData+trailer);
+ break;
+
+ // Key revocation signatures (types 0x20 and 0x28)
+ // hash only the key being revoked.
+ case 64:
+ // 0x40: Timestamp signature.
+ // This signature is only meaningful for the timestamp contained in
+ // it.
+ case 80:
+ // 0x50: Third-Party Confirmation signature.
+ // This signature is a signature over some other OpenPGP Signature
+ // packet(s). It is analogous to a notary seal on the signed data.
+ // A third-party signature SHOULD include Signature Target
+ // subpacket(s) to give easy identification. Note that we really do
+ // mean SHOULD. There are plausible uses for this (such as a blind
+ // party that only sees the signature, not the key or source
+ // document) that cannot include a target subpacket.
+ default:
+ util.print_error("openpgp.packet.signature.js\n"+
+ "signature verification for type"+ this.signatureType+" not implemented");
+ break;
+ }
+
+ return this.verified;
+ }
}
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH
diff --git a/resources/openpgp.min.js b/resources/openpgp.min.js
index 3743e888..a0a6fedc 100644
--- a/resources/openpgp.min.js
+++ b/resources/openpgp.min.js
@@ -1,131 +1,131 @@
-function DSA(){this.select_hash_algorithm=function(b){var a=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(b.bitLength()/8)){case 20:return 2!=a&&11a?2:a;case 28:return 11a?11:a;case 32:return 10a?8:a;default:return util.print_debug("DSA select hash algorithm: returning null for an unknown length of q"),null}};this.sign=function(b,a,c,d,e,f){b=util.getLeftNBits(openpgp_crypto_hashData(b,a),e.bitLength());b=new BigInteger(util.hexstrdump(b),16);a=openpgp_crypto_getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE),
-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(0this.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)<>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||36j?"-"==b.charAt(h)&&0==this.signum()&&(e=!0):(g=a*g+j,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=f=0))}0b)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>c)!=(this.s&this.DM)>>c)a[e++]=d|this.s<c?(d=(this[b]&(1<>(c+=this.DB-8)):(d=this[b]>>(c-=8)&255,0>=c&&(c+=this.DB,--b)),0this.compareTo(b)?this:b}function bnMax(b){return 0b?this.rShiftTo(-b,a):this.lShiftTo(b,a);return a}function bnShiftRight(b){var a=nbi();0>b?this.lShiftTo(-b,a):this.rShiftTo(b,a);return a}
-function lbit(b){if(0==b)return-1;var a=0;0==(b&65535)&&(b>>=16,a+=16);0==(b&255)&&(b>>=8,a+=8);0==(b&15)&&(b>>=4,a+=4);0==(b&3)&&(b>>=2,a+=2);0==(b&1)&&++a;return a}function bnGetLowestSetBit(){for(var b=0;bthis.s?this.t*this.DB:-1}function cbit(b){for(var a=0;0!=b;)b&=b-1,++a;return a}function bnBitCount(){for(var b=0,a=this.s&this.DM,c=0;c=this.t?0!=this.s:0!=(this[a]&1<>=this.DB;if(b.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=b.s}a.s=0>d?-1:0;0d&&(a[c++]=this.DV+d);a.t=c;a.clamp()}function bnAdd(b){var a=nbi();this.addTo(b,a);return a}function bnSubtract(b){var a=nbi();this.subTo(b,a);return a}
-function bnMultiply(b){var a=nbi();this.multiplyTo(b,a);return a}function bnSquare(){var b=nbi();this.squareTo(b);return b}function bnDivide(b){var a=nbi();this.divRemTo(b,a,null);return a}function bnRemainder(b){var a=nbi();this.divRemTo(b,null,a);return a}function bnDivideAndRemainder(b){var a=nbi(),c=nbi();this.divRemTo(b,a,c);return[a,c]}function bnpDMultiply(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()}
-function bnpDAddOffset(b,a){if(0!=b){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=b;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}}function NullExp(){}function nNop(b){return b}function nMulTo(b,a,c){b.multiplyTo(a,c)}function nSqrTo(b,a){b.squareTo(a)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(b){return this.exp(b,new NullExp)}
-function bnpMultiplyLowerTo(b,a,c){var d=Math.min(this.t+b.t,a);c.s=0;for(c.t=d;0b.s||b.t>2*this.m.t)return b.mod(this.m);if(0>b.compareTo(this.m))return b;var a=nbi();b.copyTo(a);this.reduce(a);return a}function barrettRevert(b){return b}
-function barrettReduce(b){b.drShiftTo(this.m.t-1,this.r2);if(b.t>this.m.t+1)b.t=this.m.t+1,b.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>b.compareTo(this.r2);)b.dAddOffset(1,this.m.t+1);for(b.subTo(this.r2,b);0<=b.compareTo(this.m);)b.subTo(this.m,b)}function barrettSqrTo(b,a){b.squareTo(a);this.reduce(a)}function barrettMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}Barrett.prototype.convert=barrettConvert;
+function DSA(){this.select_hash_algorithm=function(a){var b=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(a.bitLength()/8)){case 20:return 2!=b&&11b?2:b;case 28:return 11b?11:b;case 32:return 10b?8:b;default:return util.print_debug("DSA select hash algorithm: returning null for an unknown length of q"),null}};this.sign=function(a,b,c,d,e,f){a=util.getLeftNBits(openpgp_crypto_hashData(a,b),e.bitLength());a=new BigInteger(util.hexstrdump(a),16);b=openpgp_crypto_getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE),
+e.subtract(BigInteger.ONE));c=c.modPow(b,d).mod(e);e=b.modInverse(e).multiply(a.add(f.multiply(c))).mod(e);f=[];f[0]=c.toMPI();f[1]=e.toMPI();return f};this.verify=function(a,b,c,d,e,f,h,g){a=util.getLeftNBits(openpgp_crypto_hashData(a,d),f.bitLength());a=new BigInteger(util.hexstrdump(a),16);if(0this.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)<>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}
+function bnSigNum(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1}function bnpToRadix(a){null==a&&(a=10);if(0==this.signum()||2>a||36j?"-"==a.charAt(g)&&0==this.signum()&&(e=!0):(h=b*h+j,++f>=c&&(this.dMultiply(d),this.dAddOffset(h,0),h=f=0))}0a)this.fromInt(1);else{this.fromNumber(a,c);this.testBit(a-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);for(this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(BigInteger.ONE.shiftLeft(a-1),this)}else{var c=[],d=a&7;c.length=(a>>3)+1;b.nextBytes(c);c[0]=0>c)!=(this.s&this.DM)>>c)b[e++]=d|this.s<c?(d=(this[a]&(1<>(c+=this.DB-8)):(d=this[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0this.compareTo(a)?this:a}function bnMax(a){return 0a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b}function bnShiftRight(a){var b=nbi();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b}
+function lbit(a){if(0==a)return-1;var b=0;0==(a&65535)&&(a>>=16,b+=16);0==(a&255)&&(a>>=8,b+=8);0==(a&15)&&(a>>=4,b+=4);0==(a&3)&&(a>>=2,b+=2);0==(a&1)&&++b;return b}function bnGetLowestSetBit(){for(var a=0;athis.s?this.t*this.DB:-1}function cbit(a){for(var b=0;0!=a;)a&=a-1,++b;return b}function bnBitCount(){for(var a=0,b=this.s&this.DM,c=0;c=this.t?0!=this.s:0!=(this[b]&1<>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0;0d&&(b[c++]=this.DV+d);b.t=c;b.clamp()}function bnAdd(a){var b=nbi();this.addTo(a,b);return b}function bnSubtract(a){var b=nbi();this.subTo(a,b);return b}
+function bnMultiply(a){var b=nbi();this.multiplyTo(a,b);return b}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(a){var b=nbi();this.divRemTo(a,b,null);return b}function bnRemainder(a){var b=nbi();this.divRemTo(a,null,b);return b}function bnDivideAndRemainder(a){var b=nbi(),c=nbi();this.divRemTo(a,b,c);return[b,c]}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}
+function bnpDAddOffset(a,b){if(0!=a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,b,c){a.multiplyTo(b,c)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp)}
+function bnpMultiplyLowerTo(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=nbi();a.copyTo(b);this.reduce(b);return b}function barrettRevert(a){return a}
+function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1)a.t=this.m.t+1,a.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,b,c){a.multiplyTo(b,c);this.reduce(c)}Barrett.prototype.convert=barrettConvert;
Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;
-function bnModPow(b,a){var c=b.bitLength(),d,e=nbv(1),f;if(0>=c)return e;d=18>c?1:48>c?3:144>c?4:768>c?5:6;f=8>c?new Classic(a):a.isEven()?new Barrett(a):new Montgomery(a);var g=[],h=3,j=d-1,k=(1<=j?m=b[l]>>c-j&k:(m=(b[l]&(1<>this.DB+c-j));for(h=d;0==(m&1);)m>>=1,--h;if(0>(c-=h))c+=this.DB,--l;if(r)g[m].copyTo(e),
-r=!1;else{for(;1--c&&(c=this.DB-1,--l)}return f.revert(e)}
-function bnGCD(b){var a=0>this.s?this.negate():this.clone(),b=0>b.s?b.negate():b.clone();if(0>a.compareTo(b))var c=a,a=b,b=c;var c=a.getLowestSetBit(),d=b.getLowestSetBit();if(0>d)return a;c=b)return 0;var a=this.DV%b,c=0>this.s?b-1:0;if(0h.signum())h.addTo(b,h);else return h;return 0>h.signum()?h.add(b):h}
+function bnModPow(a,b){var c=a.bitLength(),d,e=nbv(1),f;if(0>=c)return e;d=18>c?1:48>c?3:144>c?4:768>c?5:6;f=8>c?new Classic(b):b.isEven()?new Barrett(b):new Montgomery(b);var h=[],g=3,j=d-1,k=(1<=j?m=a[l]>>c-j&k:(m=(a[l]&(1<>this.DB+c-j));for(g=d;0==(m&1);)m>>=1,--g;if(0>(c-=g))c+=this.DB,--l;if(r)h[m].copyTo(e),
+r=!1;else{for(;1--c&&(c=this.DB-1,--l)}return f.revert(e)}
+function bnGCD(a){var b=0>this.s?this.negate():this.clone(),a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a))var c=b,b=a,a=c;var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0g.signum())g.addTo(a,g);else return g;return 0>g.signum()?g.add(a):g}
var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,
733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=67108864/lowprimes[lowprimes.length-1];
-function bnIsProbablePrime(b){var a,c=this.abs();if(1==c.t&&c[0]<=lowprimes[lowprimes.length-1]){for(a=0;a>>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 bnToMPI(){var b=this.toByteArray(),a=8*(b.length-1)+nbits(b[0]),c;c=""+String.fromCharCode((a&65280)>>8);c+=String.fromCharCode(a&255);return c+=util.bin2str(b)}
-function bnpMillerRabin(b){var a=this.subtract(BigInteger.ONE),c=a.getLowestSetBit();if(0>=c)return!1;var d=a.shiftRight(c),b=b+1>>1;if(b>lowprimes.length)b=lowprimes.length;for(var e=nbi(),f=0;f>>16))a=c,b+=16;if(0!=(c=a>>8))a=c,b+=8;if(0!=(c=a>>4))a=c,b+=4;if(0!=(c=a>>2))a=c,b+=2;0!=a>>1&&(b+=1);return b}function bnToMPI(){var a=this.toByteArray(),b=8*(a.length-1)+nbits(a[0]),c;c=""+String.fromCharCode((b&65280)>>8);c+=String.fromCharCode(b&255);return c+=util.bin2str(a)}
+function bnpMillerRabin(a){var b=this.subtract(BigInteger.ONE),c=b.getLowestSetBit();if(0>=c)return!1;var d=b.shiftRight(c),a=a+1>>1;if(a>lowprimes.length)a=lowprimes.length;for(var e=nbi(),f=0;f>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}
+var dbits,canary=244837814094590,j_lm=15715070==(canary&16777215);function BigInteger(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function nbi(){return new BigInteger(null)}function am1(a,b,c,d,e,f){for(;0<=--f;){var h=b*this[a++]+c[d]+e,e=Math.floor(h/67108864);c[d++]=h&67108863}return e}
+function am2(a,b,c,d,e,f){for(var h=b&32767,b=b>>15;0<=--f;){var g=this[a]&32767,j=this[a++]>>15,k=b*g+j*h,g=h*g+((k&32767)<<15)+c[d]+(e&1073741823),e=(g>>>30)+(k>>>15)+b*j+(e>>>30);c[d++]=g&1073741823}return e}function am3(a,b,c,d,e,f){for(var h=b&16383,b=b>>14;0<=--f;){var g=this[a]&16383,j=this[a++]>>14,k=b*g+j*h,g=h*g+((k&16383)<<14)+c[d]+e,e=(g>>28)+(k>>14)+b*j;c[d++]=g&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<=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;0b?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):this[this.t-1]|=g<=this.DB&&(f-=this.DB))}if(8==c&&0!=(b[0]&128))this.s=-1,0this.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<>g))d=!0,e=int2char(c);for(;0<=f;)g>(g+=this.DB-b)):(c=this[f]>>(g-=b)&a,0>=g&&(g+=this.DB,--f)),0this.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>d|g,g=(this[h]&e)<=this.t)a.t=0;else{var d=b%this.DB,e=this.DB-d,f=(1<>d;for(var g=c+1;g>d;0>=this.DB;if(b.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=b.s}a.s=0>d?-1:0;-1>d?a[c++]=this.DV+d:0=a.DV)b[c+a.t]-=a.DV,b[c+a.t+1]=1}0=d.t)){var e=this.abs();if(e.t>this.F2:0),k=this.FV/j,j=(1<g&&BigInteger.ZERO.subTo(c,c)}}}}function bnMod(b){var a=nbi();this.abs().divRemTo(b,null,a);0>this.s&&0b.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>15;this.um=(1<b.s&&0>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==(0b)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<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;
+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(a){return BI_RM.charAt(a)}function intAt(a,b){var c=BI_RC[a.charCodeAt(b)];return null==c?-1:c}function bnpCopyTo(a){for(var b=this.t-1;0<=b;--b)a[b]=this[b];a.t=this.t;a.s=this.s}function bnpFromInt(a){this.t=1;this.s=0>a?-1:0;0a?this[0]=a+DV:this.t=0}function nbv(a){var b=nbi();b.fromInt(a);return b}
+function bnpFromString(a,b){var c;if(16==b)c=4;else if(8==b)c=3;else if(256==b)c=8;else if(2==b)c=1;else if(32==b)c=5;else if(4==b)c=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var d=a.length,e=!1,f=0;0<=--d;){var h=8==c?a[d]&255:intAt(a,d);0>h?"-"==a.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=h:f+c>this.DB?(this[this.t-1]|=(h&(1<>this.DB-f):this[this.t-1]|=h<=this.DB&&(f-=this.DB))}if(8==c&&0!=(a[0]&128))this.s=-1,0this.s)return"-"+this.negate().toString(a);if(16==a)a=4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<>h))d=!0,e=int2char(c);for(;0<=f;)h>(h+=this.DB-a)):(c=this[f]>>(h-=a)&b,0>=h&&(h+=this.DB,--f)),0this.s?this.negate():this}function bnCompareTo(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return b;for(;0<=--c;)if(0!=(b=this[c]-a[c]))return b;return 0}function nbits(a){var b=1,c;if(0!=(c=a>>>16))a=c,b+=16;if(0!=(c=a>>8))a=c,b+=8;if(0!=(c=a>>4))a=c,b+=4;if(0!=(c=a>>2))a=c,b+=2;0!=a>>1&&(b+=1);return b}
+function bnBitLength(){return 0>=this.t?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(a,b){var c;for(c=this.t-1;0<=c;--c)b[c+a]=this[c];for(c=a-1;0<=c;--c)b[c]=0;b.t=this.t+a;b.s=this.s}function bnpDRShiftTo(a,b){for(var c=a;c>d|h,h=(this[g]&e)<=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,f=(1<>d;for(var h=c+1;h>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b[c++]=this.DV+d:0=b.DV)a[c+b.t]-=b.DV,a[c+b.t+1]=1}0=d.t)){var e=this.abs();if(e.t>this.F2:0),k=this.FV/j,j=(1<h&&BigInteger.ZERO.subTo(c,c)}}}}function bnMod(a){var b=nbi();this.abs().divRemTo(a,null,b);0>this.s&&0a.s||0<=a.compareTo(this.m)?a.mod(this.m):a}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,b,c){a.multiplyTo(b,c);this.reduce(c)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}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 a=this[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0>15;this.um=(1<a.s&&0>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a[c]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,b,c){a.multiplyTo(b,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==(0a)return BigInteger.ONE;var c=nbi(),d=nbi(),e=b.convert(this),f=nbits(a)-1;for(e.copyTo(c);0<=--f;)if(b.sqrTo(c,d),0<(a&1<a||b.isEven()?new Classic(b):new Montgomery(b);return this.exp(a,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>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)}
-function md5cycle(b,a){var c=b[0],d=b[1],e=b[2],f=b[3],c=ff(c,d,e,f,a[0],7,-680876936),f=ff(f,c,d,e,a[1],12,-389564586),e=ff(e,f,c,d,a[2],17,606105819),d=ff(d,e,f,c,a[3],22,-1044525330),c=ff(c,d,e,f,a[4],7,-176418897),f=ff(f,c,d,e,a[5],12,1200080426),e=ff(e,f,c,d,a[6],17,-1473231341),d=ff(d,e,f,c,a[7],22,-45705983),c=ff(c,d,e,f,a[8],7,1770035416),f=ff(f,c,d,e,a[9],12,-1958414417),e=ff(e,f,c,d,a[10],17,-42063),d=ff(d,e,f,c,a[11],22,-1990404162),c=ff(c,d,e,f,a[12],7,1804603682),f=ff(f,c,d,e,a[13],12,
--40341101),e=ff(e,f,c,d,a[14],17,-1502002290),d=ff(d,e,f,c,a[15],22,1236535329),c=gg(c,d,e,f,a[1],5,-165796510),f=gg(f,c,d,e,a[6],9,-1069501632),e=gg(e,f,c,d,a[11],14,643717713),d=gg(d,e,f,c,a[0],20,-373897302),c=gg(c,d,e,f,a[5],5,-701558691),f=gg(f,c,d,e,a[10],9,38016083),e=gg(e,f,c,d,a[15],14,-660478335),d=gg(d,e,f,c,a[4],20,-405537848),c=gg(c,d,e,f,a[9],5,568446438),f=gg(f,c,d,e,a[14],9,-1019803690),e=gg(e,f,c,d,a[3],14,-187363961),d=gg(d,e,f,c,a[8],20,1163531501),c=gg(c,d,e,f,a[13],5,-1444681467),
-f=gg(f,c,d,e,a[2],9,-51403784),e=gg(e,f,c,d,a[7],14,1735328473),d=gg(d,e,f,c,a[12],20,-1926607734),c=hh(c,d,e,f,a[5],4,-378558),f=hh(f,c,d,e,a[8],11,-2022574463),e=hh(e,f,c,d,a[11],16,1839030562),d=hh(d,e,f,c,a[14],23,-35309556),c=hh(c,d,e,f,a[1],4,-1530992060),f=hh(f,c,d,e,a[4],11,1272893353),e=hh(e,f,c,d,a[7],16,-155497632),d=hh(d,e,f,c,a[10],23,-1094730640),c=hh(c,d,e,f,a[13],4,681279174),f=hh(f,c,d,e,a[0],11,-358537222),e=hh(e,f,c,d,a[3],16,-722521979),d=hh(d,e,f,c,a[6],23,76029189),c=hh(c,d,
-e,f,a[9],4,-640364487),f=hh(f,c,d,e,a[12],11,-421815835),e=hh(e,f,c,d,a[15],16,530742520),d=hh(d,e,f,c,a[2],23,-995338651),c=ii(c,d,e,f,a[0],6,-198630844),f=ii(f,c,d,e,a[7],10,1126891415),e=ii(e,f,c,d,a[14],15,-1416354905),d=ii(d,e,f,c,a[5],21,-57434055),c=ii(c,d,e,f,a[12],6,1700485571),f=ii(f,c,d,e,a[3],10,-1894986606),e=ii(e,f,c,d,a[10],15,-1051523),d=ii(d,e,f,c,a[1],21,-2054922799),c=ii(c,d,e,f,a[8],6,1873313359),f=ii(f,c,d,e,a[15],10,-30611744),e=ii(e,f,c,d,a[6],15,-1560198380),d=ii(d,e,f,c,a[13],
-21,1309151649),c=ii(c,d,e,f,a[4],6,-145523070),f=ii(f,c,d,e,a[11],10,-1120210379),e=ii(e,f,c,d,a[2],15,718787259),d=ii(d,e,f,c,a[9],21,-343485551);b[0]=add32(c,b[0]);b[1]=add32(d,b[1]);b[2]=add32(e,b[2]);b[3]=add32(f,b[3])}function cmn(b,a,c,d,e,f){a=add32(add32(a,b),add32(d,f));return add32(a<>>32-e,c)}function ff(b,a,c,d,e,f,g){return cmn(a&c|~a&d,b,a,e,f,g)}function gg(b,a,c,d,e,f,g){return cmn(a&d|c&~d,b,a,e,f,g)}function hh(b,a,c,d,e,f,g){return cmn(a^c^d,b,a,e,f,g)}
-function ii(b,a,c,d,e,f,g){return cmn(c^(a|~d),b,a,e,f,g)}function md51(b){txt="";var a=b.length,c=[1732584193,-271733879,-1732584194,271733878],d;for(d=64;d<=b.length;d+=64)md5cycle(c,md5blk(b.substring(d-64,d)));var b=b.substring(d-64),e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(d=0;d>2]|=b.charCodeAt(d)<<(d%4<<3);e[d>>2]|=128<<(d%4<<3);if(55d;d++)e[d]=0}e[14]=8*a;md5cycle(c,e);return c}
-function md5blk(b){var a=[],c;for(c=0;64>c;c+=4)a[c>>2]=b.charCodeAt(c)+(b.charCodeAt(c+1)<<8)+(b.charCodeAt(c+2)<<16)+(b.charCodeAt(c+3)<<24);return a}var hex_chr="0123456789abcdef".split("");function rhex(b){for(var a="",c=0;4>c;c++)a+=hex_chr[b>>8*c+4&15]+hex_chr[b>>8*c&15];return a}function hex(b){for(var a=0;a>16)+(a>>16)+(c>>16)<<16|c&65535});var RMDsize=160,X=[];function ROL(b,a){return new Number(b<>>32-a)}function F(b,a,c){return new Number(b^a^c)}function G(b,a,c){return new Number(b&a|~b&c)}function H(b,a,c){return new Number((b|~a)^c)}function I(b,a,c){return new Number(b&c|a&~c)}function J(b,a,c){return new Number(b^(a|~c))}
-function mixOneRound(b,a,c,d,e,f,g,h){switch(h){case 0:b+=F(a,c,d)+f+0;break;case 1:b+=G(a,c,d)+f+1518500249;break;case 2:b+=H(a,c,d)+f+1859775393;break;case 3:b+=I(a,c,d)+f+2400959708;break;case 4:b+=J(a,c,d)+f+2840853838;break;case 5:b+=J(a,c,d)+f+1352829926;break;case 6:b+=I(a,c,d)+f+1548603684;break;case 7:b+=H(a,c,d)+f+1836072691;break;case 8:b+=G(a,c,d)+f+2053994217;break;case 9:b+=F(a,c,d)+f+0;break;default:document.write("Bogus round number")}b=ROL(b,g)+e;c=ROL(c,10);h=[];h[0]=b&4294967295;
-h[1]=a&4294967295;h[2]=c&4294967295;h[3]=d&4294967295;h[4]=e&4294967295;h[5]=f;h[6]=g;return h}function MDinit(b){b[0]=1732584193;b[1]=4023233417;b[2]=2562383102;b[3]=271733878;b[4]=3285377520}
+BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function SecureRandom(){this.nextBytes=function(a){for(var b=0;b>1;d.e=parseInt(c,16);for(d.ee=new BigInteger(c,16);;){for(;!(d.p=new BigInteger(b-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 h=d.p;d.p=d.q;d.q=h}var h=d.p.subtract(BigInteger.ONE),g=d.q.subtract(BigInteger.ONE),j=h.multiply(g);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(h);d.dmq1=d.d.mod(g);d.u=d.p.modInverse(d.q);break}}return d};this.keyObject=a}function MD5(a){a=md5(a);return util.hex2bin(a)}
+function md5cycle(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],c=ff(c,d,e,f,b[0],7,-680876936),f=ff(f,c,d,e,b[1],12,-389564586),e=ff(e,f,c,d,b[2],17,606105819),d=ff(d,e,f,c,b[3],22,-1044525330),c=ff(c,d,e,f,b[4],7,-176418897),f=ff(f,c,d,e,b[5],12,1200080426),e=ff(e,f,c,d,b[6],17,-1473231341),d=ff(d,e,f,c,b[7],22,-45705983),c=ff(c,d,e,f,b[8],7,1770035416),f=ff(f,c,d,e,b[9],12,-1958414417),e=ff(e,f,c,d,b[10],17,-42063),d=ff(d,e,f,c,b[11],22,-1990404162),c=ff(c,d,e,f,b[12],7,1804603682),f=ff(f,c,d,e,b[13],12,
+-40341101),e=ff(e,f,c,d,b[14],17,-1502002290),d=ff(d,e,f,c,b[15],22,1236535329),c=gg(c,d,e,f,b[1],5,-165796510),f=gg(f,c,d,e,b[6],9,-1069501632),e=gg(e,f,c,d,b[11],14,643717713),d=gg(d,e,f,c,b[0],20,-373897302),c=gg(c,d,e,f,b[5],5,-701558691),f=gg(f,c,d,e,b[10],9,38016083),e=gg(e,f,c,d,b[15],14,-660478335),d=gg(d,e,f,c,b[4],20,-405537848),c=gg(c,d,e,f,b[9],5,568446438),f=gg(f,c,d,e,b[14],9,-1019803690),e=gg(e,f,c,d,b[3],14,-187363961),d=gg(d,e,f,c,b[8],20,1163531501),c=gg(c,d,e,f,b[13],5,-1444681467),
+f=gg(f,c,d,e,b[2],9,-51403784),e=gg(e,f,c,d,b[7],14,1735328473),d=gg(d,e,f,c,b[12],20,-1926607734),c=hh(c,d,e,f,b[5],4,-378558),f=hh(f,c,d,e,b[8],11,-2022574463),e=hh(e,f,c,d,b[11],16,1839030562),d=hh(d,e,f,c,b[14],23,-35309556),c=hh(c,d,e,f,b[1],4,-1530992060),f=hh(f,c,d,e,b[4],11,1272893353),e=hh(e,f,c,d,b[7],16,-155497632),d=hh(d,e,f,c,b[10],23,-1094730640),c=hh(c,d,e,f,b[13],4,681279174),f=hh(f,c,d,e,b[0],11,-358537222),e=hh(e,f,c,d,b[3],16,-722521979),d=hh(d,e,f,c,b[6],23,76029189),c=hh(c,d,
+e,f,b[9],4,-640364487),f=hh(f,c,d,e,b[12],11,-421815835),e=hh(e,f,c,d,b[15],16,530742520),d=hh(d,e,f,c,b[2],23,-995338651),c=ii(c,d,e,f,b[0],6,-198630844),f=ii(f,c,d,e,b[7],10,1126891415),e=ii(e,f,c,d,b[14],15,-1416354905),d=ii(d,e,f,c,b[5],21,-57434055),c=ii(c,d,e,f,b[12],6,1700485571),f=ii(f,c,d,e,b[3],10,-1894986606),e=ii(e,f,c,d,b[10],15,-1051523),d=ii(d,e,f,c,b[1],21,-2054922799),c=ii(c,d,e,f,b[8],6,1873313359),f=ii(f,c,d,e,b[15],10,-30611744),e=ii(e,f,c,d,b[6],15,-1560198380),d=ii(d,e,f,c,b[13],
+21,1309151649),c=ii(c,d,e,f,b[4],6,-145523070),f=ii(f,c,d,e,b[11],10,-1120210379),e=ii(e,f,c,d,b[2],15,718787259),d=ii(d,e,f,c,b[9],21,-343485551);a[0]=add32(c,a[0]);a[1]=add32(d,a[1]);a[2]=add32(e,a[2]);a[3]=add32(f,a[3])}function cmn(a,b,c,d,e,f){b=add32(add32(b,a),add32(d,f));return add32(b<>>32-e,c)}function ff(a,b,c,d,e,f,h){return cmn(b&c|~b&d,a,b,e,f,h)}function gg(a,b,c,d,e,f,h){return cmn(b&d|c&~d,a,b,e,f,h)}function hh(a,b,c,d,e,f,h){return cmn(b^c^d,a,b,e,f,h)}
+function ii(a,b,c,d,e,f,h){return cmn(c^(b|~d),a,b,e,f,h)}function md51(a){txt="";var b=a.length,c=[1732584193,-271733879,-1732584194,271733878],d;for(d=64;d<=a.length;d+=64)md5cycle(c,md5blk(a.substring(d-64,d)));var a=a.substring(d-64),e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(d=0;d>2]|=a.charCodeAt(d)<<(d%4<<3);e[d>>2]|=128<<(d%4<<3);if(55d;d++)e[d]=0}e[14]=8*b;md5cycle(c,e);return c}
+function md5blk(a){var b=[],c;for(c=0;64>c;c+=4)b[c>>2]=a.charCodeAt(c)+(a.charCodeAt(c+1)<<8)+(a.charCodeAt(c+2)<<16)+(a.charCodeAt(c+3)<<24);return b}var hex_chr="0123456789abcdef".split("");function rhex(a){for(var b="",c=0;4>c;c++)b+=hex_chr[a>>8*c+4&15]+hex_chr[a>>8*c&15];return b}function hex(a){for(var b=0;b>16)+(b>>16)+(c>>16)<<16|c&65535});var RMDsize=160,X=[];function ROL(a,b){return new Number(a<>>32-b)}function F(a,b,c){return new Number(a^b^c)}function G(a,b,c){return new Number(a&b|~a&c)}function H(a,b,c){return new Number((a|~b)^c)}function I(a,b,c){return new Number(a&c|b&~c)}function J(a,b,c){return new Number(a^(b|~c))}
+function mixOneRound(a,b,c,d,e,f,h,g){switch(g){case 0:a+=F(b,c,d)+f+0;break;case 1:a+=G(b,c,d)+f+1518500249;break;case 2:a+=H(b,c,d)+f+1859775393;break;case 3:a+=I(b,c,d)+f+2400959708;break;case 4:a+=J(b,c,d)+f+2840853838;break;case 5:a+=J(b,c,d)+f+1352829926;break;case 6:a+=I(b,c,d)+f+1548603684;break;case 7:a+=H(b,c,d)+f+1836072691;break;case 8:a+=G(b,c,d)+f+2053994217;break;case 9:a+=F(b,c,d)+f+0;break;default:document.write("Bogus round number")}a=ROL(a,h)+e;c=ROL(c,10);g=[];g[0]=a&4294967295;
+g[1]=b&4294967295;g[2]=c&4294967295;g[3]=d&4294967295;g[4]=e&4294967295;g[5]=f;g[6]=h;return g}function MDinit(a){a[0]=1732584193;a[1]=4023233417;a[2]=2562383102;a[3]=271733878;a[4]=3285377520}
var ROLs=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12],[11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5],[11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12],[9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6],[9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11],[9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5],[15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8],[8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]],indexes=[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[7,4,13,1,10,6,15,3,12,
0,9,5,2,14,11,8],[3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12],[1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2],[4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12],[6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2],[15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13],[8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14],[12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]];
-function compress(b,a){blockA=[];blockB=[];for(var c,d=0;5>d;d++)blockA[d]=new Number(b[d]),blockB[d]=new Number(b[d]);for(var e=0,f=0;5>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockA[(e+0)%5],blockA[(e+1)%5],blockA[(e+2)%5],blockA[(e+3)%5],blockA[(e+4)%5],a[indexes[f][d]],ROLs[f][d],f),blockA[(e+0)%5]=c[0],blockA[(e+1)%5]=c[1],blockA[(e+2)%5]=c[2],blockA[(e+3)%5]=c[3],blockA[(e+4)%5]=c[4],e+=4;e=0;for(f=5;10>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockB[(e+0)%5],blockB[(e+1)%5],blockB[(e+2)%5],blockB[(e+
-3)%5],blockB[(e+4)%5],a[indexes[f][d]],ROLs[f][d],f),blockB[(e+0)%5]=c[0],blockB[(e+1)%5]=c[1],blockB[(e+2)%5]=c[2],blockB[(e+3)%5]=c[3],blockB[(e+4)%5]=c[4],e+=4;blockB[3]+=blockA[2]+b[1];b[1]=b[2]+blockA[3]+blockB[4];b[2]=b[3]+blockA[4]+blockB[0];b[3]=b[4]+blockA[0]+blockB[1];b[4]=b[0]+blockA[1]+blockB[2];b[0]=blockB[3]}function zeroX(b){for(var a=0;16>a;a++)b[a]=0}
-function MDfinish(b,a,c,d){var e=Array(16);zeroX(e);for(var f=0,g=0;g<(c&63);g++)e[g>>>2]^=(a.charCodeAt(f++)&255)<<8*(g&3);e[c>>>2&15]^=1<<8*(c&3)+7;55<(c&63)&&(compress(b,e),e=Array(16),zeroX(e));e[14]=c<<3;e[15]=c>>>29|d<<3;compress(b,e)}function BYTES_TO_DWORD(b){var a=(b.charCodeAt(3)&255)<<24,a=a|(b.charCodeAt(2)&255)<<16,a=a|(b.charCodeAt(1)&255)<<8;return a|=b.charCodeAt(0)&255}
-function RMD(b){var a=Array(RMDsize/32),c=Array(RMDsize/8),d,e;MDinit(a);d=b.length;var f=Array(16);zeroX(f);var g=0;for(e=d;63h;h++)f[h]=BYTES_TO_DWORD(b.substr(g,4)),g+=4;compress(a,f)}MDfinish(a,b.substr(g),d,0);for(h=0;h>>2]&255,c[h+1]=a[h>>>2]>>>8&255,c[h+2]=a[h>>>2]>>>16&255,c[h+3]=a[h>>>2]>>>24&255;return c}function RMDstring(b){for(var b=RMD(b),a="",c=0;c>5]|=(a.charCodeAt(d/8)&255)<<24-d%32;return b},c=function(a){var b=[],c=a.length,d,e;for(d=0;d>3]|=e<<24-4*(d%8)}return b},d=function(a){var b="",c=4*a.length,d,e;for(d=0;d>2]>>8*(3-d%4),b+="0123456789abcdef".charAt(e>>4&15)+"0123456789abcdef".charAt(e&15);return b},e=function(a){var b=
-"",c=4*a.length,d,e,f;for(d=0;d>2]>>8*(3-d%4)&255)<<16|(a[d+1>>2]>>8*(3-(d+1)%4)&255)<<8|a[d+2>>2]>>8*(3-(d+2)%4)&255;for(e=0;4>e;e+=1)b=8*d+6*e<=32*a.length?b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>6*(3-e)&63):b+""}return b},f=function(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>24-c%32&255);return b},g=function(a,b){return a<>>32-b},h=function(a,b){return a>>>b|a<<32-b},j=function(a,c){return 32>=c?new b(a.highOrder>>>
-c|a.lowOrder<<32-c,a.lowOrder>>>c|a.highOrder<<32-c):new b(a.lowOrder>>>c|a.highOrder<<32-c,a.highOrder>>>c|a.lowOrder<<32-c)},k=function(a,c){return 32>=c?new b(a.highOrder>>>c,a.lowOrder>>>c|a.highOrder<<32-c):new b(0,a.highOrder<<32-c)},l=function(a,b,c){return a&b^~a&c},m=function(a,c,d){return new b(a.highOrder&c.highOrder^~a.highOrder&d.highOrder,a.lowOrder&c.lowOrder^~a.lowOrder&d.lowOrder)},r=function(a,b,c){return a&b^a&c^b&c},p=function(a,c,d){return new b(a.highOrder&c.highOrder^a.highOrder&
-d.highOrder^c.highOrder&d.highOrder,a.lowOrder&c.lowOrder^a.lowOrder&d.lowOrder^c.lowOrder&d.lowOrder)},o=function(a){return h(a,2)^h(a,13)^h(a,22)},y=function(a){var c=j(a,28),d=j(a,34),a=j(a,39);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},x=function(a){return h(a,6)^h(a,11)^h(a,25)},v=function(a){var c=j(a,14),d=j(a,18),a=j(a,41);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},u=function(a){return h(a,7)^h(a,18)^a>>>3},
-t=function(a){var c=j(a,1),d=j(a,8),a=k(a,7);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},E=function(a){return h(a,17)^h(a,19)^a>>>10},Q=function(a){var c=j(a,19),d=j(a,61),a=k(a,6);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},D=function(a,b){var c=(a&65535)+(b&65535);return((a>>>16)+(b>>>16)+(c>>>16)&65535)<<16|c&65535},M=function(a,b,c,d){var e=(a&65535)+(b&65535)+(c&65535)+(d&65535);return((a>>>16)+(b>>>16)+(c>>>16)+
-(d>>>16)+(e>>>16)&65535)<<16|e&65535},K=function(a,b,c,d,e){var f=(a&65535)+(b&65535)+(c&65535)+(d&65535)+(e&65535);return((a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16)&65535)<<16|f&65535},w=function(a,c){var d,e,f;d=(a.lowOrder&65535)+(c.lowOrder&65535);e=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d>>>16);f=(e&65535)<<16|d&65535;d=(a.highOrder&65535)+(c.highOrder&65535)+(e>>>16);e=(a.highOrder>>>16)+(c.highOrder>>>16)+(d>>>16);return new b((e&65535)<<16|d&65535,f)},z=function(a,c,d,e){var f,g,
-h;f=(a.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&65535);g=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f>>>16);h=(g&65535)<<16|f&65535;f=(a.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(g>>>16);g=(a.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f>>>16);return new b((g&65535)<<16|f&65535,h)},T=function(a,c,d,e,f){var g,h,j;g=(a.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&
-65535)+(f.lowOrder&65535);h=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f.lowOrder>>>16)+(g>>>16);j=(h&65535)<<16|g&65535;g=(a.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(f.highOrder&65535)+(h>>>16);h=(a.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f.highOrder>>>16)+(g>>>16);return new b((h&65535)<<16|g&65535,j)},A=function(a,b){var c=[],d,e,f,h,j,k,l,m,o,s=[1732584193,4023233417,2562383102,271733878,3285377520],
+function compress(a,b){blockA=[];blockB=[];for(var c,d=0;5>d;d++)blockA[d]=new Number(a[d]),blockB[d]=new Number(a[d]);for(var e=0,f=0;5>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockA[(e+0)%5],blockA[(e+1)%5],blockA[(e+2)%5],blockA[(e+3)%5],blockA[(e+4)%5],b[indexes[f][d]],ROLs[f][d],f),blockA[(e+0)%5]=c[0],blockA[(e+1)%5]=c[1],blockA[(e+2)%5]=c[2],blockA[(e+3)%5]=c[3],blockA[(e+4)%5]=c[4],e+=4;e=0;for(f=5;10>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockB[(e+0)%5],blockB[(e+1)%5],blockB[(e+2)%5],blockB[(e+
+3)%5],blockB[(e+4)%5],b[indexes[f][d]],ROLs[f][d],f),blockB[(e+0)%5]=c[0],blockB[(e+1)%5]=c[1],blockB[(e+2)%5]=c[2],blockB[(e+3)%5]=c[3],blockB[(e+4)%5]=c[4],e+=4;blockB[3]+=blockA[2]+a[1];a[1]=a[2]+blockA[3]+blockB[4];a[2]=a[3]+blockA[4]+blockB[0];a[3]=a[4]+blockA[0]+blockB[1];a[4]=a[0]+blockA[1]+blockB[2];a[0]=blockB[3]}function zeroX(a){for(var b=0;16>b;b++)a[b]=0}
+function MDfinish(a,b,c,d){var e=Array(16);zeroX(e);for(var f=0,h=0;h<(c&63);h++)e[h>>>2]^=(b.charCodeAt(f++)&255)<<8*(h&3);e[c>>>2&15]^=1<<8*(c&3)+7;55<(c&63)&&(compress(a,e),e=Array(16),zeroX(e));e[14]=c<<3;e[15]=c>>>29|d<<3;compress(a,e)}function BYTES_TO_DWORD(a){var b=(a.charCodeAt(3)&255)<<24,b=b|(a.charCodeAt(2)&255)<<16,b=b|(a.charCodeAt(1)&255)<<8;return b|=a.charCodeAt(0)&255}
+function RMD(a){var b=Array(RMDsize/32),c=Array(RMDsize/8),d,e;MDinit(b);d=a.length;var f=Array(16);zeroX(f);var h=0;for(e=d;63g;g++)f[g]=BYTES_TO_DWORD(a.substr(h,4)),h+=4;compress(b,f)}MDfinish(b,a.substr(h),d,0);for(g=0;g>>2]&255,c[g+1]=b[g>>>2]>>>8&255,c[g+2]=b[g>>>2]>>>16&255,c[g+3]=b[g>>>2]>>>24&255;return c}function RMDstring(a){for(var a=RMD(a),b="",c=0;c>5]|=(a.charCodeAt(d/8)&255)<<24-d%32;return b},c=function(a){var b=[],c=a.length,d,e;for(d=0;d>3]|=e<<24-4*(d%8)}return b},d=function(a){var b="",c=4*a.length,d,e;for(d=0;d>2]>>8*(3-d%4),b+="0123456789abcdef".charAt(e>>4&15)+"0123456789abcdef".charAt(e&15);return b},e=function(a){var b=
+"",c=4*a.length,d,e,f;for(d=0;d>2]>>8*(3-d%4)&255)<<16|(a[d+1>>2]>>8*(3-(d+1)%4)&255)<<8|a[d+2>>2]>>8*(3-(d+2)%4)&255;for(e=0;4>e;e+=1)b=8*d+6*e<=32*a.length?b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>6*(3-e)&63):b+""}return b},f=function(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>24-c%32&255);return b},h=function(a,b){return a<>>32-b},g=function(a,b){return a>>>b|a<<32-b},j=function(b,c){return 32>=c?new a(b.highOrder>>>
+c|b.lowOrder<<32-c,b.lowOrder>>>c|b.highOrder<<32-c):new a(b.lowOrder>>>c|b.highOrder<<32-c,b.highOrder>>>c|b.lowOrder<<32-c)},k=function(b,c){return 32>=c?new a(b.highOrder>>>c,b.lowOrder>>>c|b.highOrder<<32-c):new a(0,b.highOrder<<32-c)},l=function(a,b,c){return a&b^~a&c},m=function(b,c,d){return new a(b.highOrder&c.highOrder^~b.highOrder&d.highOrder,b.lowOrder&c.lowOrder^~b.lowOrder&d.lowOrder)},r=function(a,b,c){return a&b^a&c^b&c},p=function(b,c,d){return new a(b.highOrder&c.highOrder^b.highOrder&
+d.highOrder^c.highOrder&d.highOrder,b.lowOrder&c.lowOrder^b.lowOrder&d.lowOrder^c.lowOrder&d.lowOrder)},o=function(a){return g(a,2)^g(a,13)^g(a,22)},y=function(b){var c=j(b,28),d=j(b,34),b=j(b,39);return new a(c.highOrder^d.highOrder^b.highOrder,c.lowOrder^d.lowOrder^b.lowOrder)},x=function(a){return g(a,6)^g(a,11)^g(a,25)},v=function(b){var c=j(b,14),d=j(b,18),b=j(b,41);return new a(c.highOrder^d.highOrder^b.highOrder,c.lowOrder^d.lowOrder^b.lowOrder)},u=function(a){return g(a,7)^g(a,18)^a>>>3},
+t=function(b){var c=j(b,1),d=j(b,8),b=k(b,7);return new a(c.highOrder^d.highOrder^b.highOrder,c.lowOrder^d.lowOrder^b.lowOrder)},E=function(a){return g(a,17)^g(a,19)^a>>>10},Q=function(b){var c=j(b,19),d=j(b,61),b=k(b,6);return new a(c.highOrder^d.highOrder^b.highOrder,c.lowOrder^d.lowOrder^b.lowOrder)},D=function(a,b){var c=(a&65535)+(b&65535);return((a>>>16)+(b>>>16)+(c>>>16)&65535)<<16|c&65535},M=function(a,b,c,d){var e=(a&65535)+(b&65535)+(c&65535)+(d&65535);return((a>>>16)+(b>>>16)+(c>>>16)+
+(d>>>16)+(e>>>16)&65535)<<16|e&65535},K=function(a,b,c,d,e){var f=(a&65535)+(b&65535)+(c&65535)+(d&65535)+(e&65535);return((a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16)&65535)<<16|f&65535},w=function(b,c){var d,e,f;d=(b.lowOrder&65535)+(c.lowOrder&65535);e=(b.lowOrder>>>16)+(c.lowOrder>>>16)+(d>>>16);f=(e&65535)<<16|d&65535;d=(b.highOrder&65535)+(c.highOrder&65535)+(e>>>16);e=(b.highOrder>>>16)+(c.highOrder>>>16)+(d>>>16);return new a((e&65535)<<16|d&65535,f)},z=function(b,c,d,e){var f,h,
+g;f=(b.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&65535);h=(b.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f>>>16);g=(h&65535)<<16|f&65535;f=(b.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(h>>>16);h=(b.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f>>>16);return new a((h&65535)<<16|f&65535,g)},T=function(b,c,d,e,f){var h,g,j;h=(b.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&
+65535)+(f.lowOrder&65535);g=(b.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f.lowOrder>>>16)+(h>>>16);j=(g&65535)<<16|h&65535;h=(b.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(f.highOrder&65535)+(g>>>16);g=(b.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f.highOrder>>>16)+(h>>>16);return new a((g&65535)<<16|h&65535,j)},A=function(a,b){var c=[],d,e,f,g,j,k,l,m,o,s=[1732584193,4023233417,2562383102,271733878,3285377520],
p=[1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,
-2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782];a[b>>5]|=128<<24-b%32;a[(b+65>>9<<4)+15]=b;o=a.length;for(l=0;lm;m+=1)c[m]=
-16>m?a[m+l]:g(c[m-3]^c[m-8]^c[m-14]^c[m-16],1),k=20>m?K(g(d,5),e&f^~e&h,j,p[m],c[m]):40>m?K(g(d,5),e^f^h,j,p[m],c[m]):60>m?K(g(d,5),r(e,f,h),j,p[m],c[m]):K(g(d,5),e^f^h,j,p[m],c[m]),j=h,h=f,f=g(e,30),e=d,d=k;s[0]=D(d,s[0]);s[1]=D(e,s[1]);s[2]=D(f,s[2]);s[3]=D(h,s[3]);s[4]=D(j,s[4])}return s},B=function(a,c,d){var e,f,g,h,j,k,A,B,C,s,ca,Y,L,da,ba,O,ea,fa,ga,ha,ia,ja,ka,la,q,ma,Z=[],ra;if("SHA-224"===d||"SHA-256"===d)ca=64,e=(c+65>>9<<4)+15,da=16,ba=1,q=Number,O=D,ea=M,fa=K,ga=u,ha=E,ia=o,ja=x,la=r,
+2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782];a[b>>5]|=128<<24-b%32;a[(b+65>>9<<4)+15]=b;o=a.length;for(l=0;lm;m+=1)c[m]=
+16>m?a[m+l]:h(c[m-3]^c[m-8]^c[m-14]^c[m-16],1),k=20>m?K(h(d,5),e&f^~e&g,j,p[m],c[m]):40>m?K(h(d,5),e^f^g,j,p[m],c[m]):60>m?K(h(d,5),r(e,f,g),j,p[m],c[m]):K(h(d,5),e^f^g,j,p[m],c[m]),j=g,g=f,f=h(e,30),e=d,d=k;s[0]=D(d,s[0]);s[1]=D(e,s[1]);s[2]=D(f,s[2]);s[3]=D(g,s[3]);s[4]=D(j,s[4])}return s},B=function(b,c,d){var e,f,g,h,j,k,A,B,C,s,ca,Y,L,da,ba,O,ea,fa,ga,ha,ia,ja,ka,la,q,ma,Z=[],ra;if("SHA-224"===d||"SHA-256"===d)ca=64,e=(c+65>>9<<4)+15,da=16,ba=1,q=Number,O=D,ea=M,fa=K,ga=u,ha=E,ia=o,ja=x,la=r,
ka=l,ma=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,
-4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s="SHA-224"===d?[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]:[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];else if("SHA-384"===d||"SHA-512"===d)ca=80,e=(c+128>>10<<5)+31,da=32,ba=2,q=b,O=w,ea=z,fa=T,ga=t,ha=Q,ia=y,ja=v,la=
+4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s="SHA-224"===d?[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]:[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];else if("SHA-384"===d||"SHA-512"===d)ca=80,e=(c+128>>10<<5)+31,da=32,ba=2,q=a,O=w,ea=z,fa=T,ga=t,ha=Q,ia=y,ja=v,la=
p,ka=m,ma=[new q(1116352408,3609767458),new q(1899447441,602891725),new q(3049323471,3964484399),new q(3921009573,2173295548),new q(961987163,4081628472),new q(1508970993,3053834265),new q(2453635748,2937671579),new q(2870763221,3664609560),new q(3624381080,2734883394),new q(310598401,1164996542),new q(607225278,1323610764),new q(1426881987,3590304994),new q(1925078388,4068182383),new q(2162078206,991336113),new q(2614888103,633803317),new q(3248222580,3479774868),new q(3835390401,2666613458),new q(4022224774,
944711139),new q(264347078,2341262773),new q(604807628,2007800933),new q(770255983,1495990901),new q(1249150122,1856431235),new q(1555081692,3175218132),new q(1996064986,2198950837),new q(2554220882,3999719339),new q(2821834349,766784016),new q(2952996808,2566594879),new q(3210313671,3203337956),new q(3336571891,1034457026),new q(3584528711,2466948901),new q(113926993,3758326383),new q(338241895,168717936),new q(666307205,1188179964),new q(773529912,1546045734),new q(1294757372,1522805485),new q(1396182291,
2643833823),new q(1695183700,2343527390),new q(1986661051,1014477480),new q(2177026350,1206759142),new q(2456956037,344077627),new q(2730485921,1290863460),new q(2820302411,3158454273),new q(3259730800,3505952657),new q(3345764771,106217008),new q(3516065817,3606008344),new q(3600352804,1432725776),new q(4094571909,1467031594),new q(275423344,851169720),new q(430227734,3100823752),new q(506948616,1363258195),new q(659060556,3750685593),new q(883997877,3785050280),new q(958139571,3318307427),new q(1322822218,
3812723403),new q(1537002063,2003034995),new q(1747873779,3602036899),new q(1955562222,1575990012),new q(2024104815,1125592928),new q(2227730452,2716904306),new q(2361852424,442776044),new q(2428436474,593698344),new q(2756734187,3733110249),new q(3204031479,2999351573),new q(3329325298,3815920427),new q(3391569614,3928383900),new q(3515267271,566280711),new q(3940187606,3454069534),new q(4118630271,4000239992),new q(116418474,1914138554),new q(174292421,2731055270),new q(289380356,3203993006),new q(460393269,
320620315),new q(685471733,587496836),new q(852142971,1086792851),new q(1017036298,365543100),new q(1126000580,2618297676),new q(1288033470,3409855158),new q(1501505948,4234509866),new q(1607167915,987167468),new q(1816402316,1246189591)],s="SHA-384"===d?[new q(3418070365,3238371032),new q(1654270250,914150663),new q(2438529370,812702999),new q(355462360,4144912697),new q(1731405415,4290775857),new q(41048885895,1750603025),new q(3675008525,1694076839),new q(1203062813,3204075428)]:[new q(1779033703,
-4089235720),new q(3144134277,2227873595),new q(1013904242,4271175723),new q(2773480762,1595750129),new q(1359893119,2917565137),new q(2600822924,725511199),new q(528734635,4215389547),new q(1541459225,327033209)];a[c>>5]|=128<<24-c%32;a[e]=c;ra=a.length;for(Y=0;YL?new q(a[L*ba+Y],a[L*ba+Y+1]):ea(ha(Z[L-2]),Z[L-7],ga(Z[L-15]),Z[L-16]),B=fa(A,ja(h),ka(h,j,k),ma[L],Z[L]),C=O(ia(c),la(c,e,f)),A=k,k=j,j=h,h=O(g,
+4089235720),new q(3144134277,2227873595),new q(1013904242,4271175723),new q(2773480762,1595750129),new q(1359893119,2917565137),new q(2600822924,725511199),new q(528734635,4215389547),new q(1541459225,327033209)];b[c>>5]|=128<<24-c%32;b[e]=c;ra=b.length;for(Y=0;YL?new q(b[L*ba+Y],b[L*ba+Y+1]):ea(ha(Z[L-2]),Z[L-7],ga(Z[L-15]),Z[L-16]),B=fa(A,ja(h),ka(h,j,k),ma[L],Z[L]),C=O(ia(c),la(c,e,f)),A=k,k=j,j=h,h=O(g,
B),g=f,f=e,e=c,c=O(B,C);s[0]=O(c,s[0]);s[1]=O(e,s[1]);s[2]=O(f,s[2]);s[3]=O(g,s[3]);s[4]=O(h,s[4]);s[5]=O(j,s[5]);s[6]=O(k,s[6]);s[7]=O(A,s[7])}switch(d){case "SHA-224":return[s[0],s[1],s[2],s[3],s[4],s[5],s[6]];case "SHA-256":return s;case "SHA-384":return[s[0].highOrder,s[0].lowOrder,s[1].highOrder,s[1].lowOrder,s[2].highOrder,s[2].lowOrder,s[3].highOrder,s[3].lowOrder,s[4].highOrder,s[4].lowOrder,s[5].highOrder,s[5].lowOrder];case "SHA-512":return[s[0].highOrder,s[0].lowOrder,s[1].highOrder,s[1].lowOrder,
-s[2].highOrder,s[2].lowOrder,s[3].highOrder,s[3].lowOrder,s[4].highOrder,s[4].lowOrder,s[5].highOrder,s[5].lowOrder,s[6].highOrder,s[6].lowOrder,s[7].highOrder,s[7].lowOrder];default:return[]}},C=function(b,d){this.strToHash=this.strBinLen=this.sha512=this.sha384=this.sha256=this.sha224=this.sha1=null;if("HEX"===d){if(0!==b.length%2)return"TEXT MUST BE IN BYTE INCREMENTS";this.strBinLen=4*b.length;this.strToHash=c(b)}else if("ASCII"===d||"undefined"===typeof d)this.strBinLen=8*b.length,this.strToHash=
-a(b);else return"UNKNOWN TEXT INPUT TYPE"};C.prototype={getHash:function(a,b){var c=null,g=this.strToHash.slice();switch(b){case "HEX":c=d;break;case "B64":c=e;break;case "ASCII":c=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(a){case "SHA-1":if(null===this.sha1)this.sha1=A(g,this.strBinLen);return c(this.sha1);case "SHA-224":if(null===this.sha224)this.sha224=B(g,this.strBinLen,a);return c(this.sha224);case "SHA-256":if(null===this.sha256)this.sha256=B(g,this.strBinLen,a);return c(this.sha256);
-case "SHA-384":if(null===this.sha384)this.sha384=B(g,this.strBinLen,a);return c(this.sha384);case "SHA-512":if(null===this.sha512)this.sha512=B(g,this.strBinLen,a);return c(this.sha512);default:return"HASH NOT RECOGNIZED"}},getHMAC:function(b,g,h,j){var k,l,m,o,p;l=[];var t=[];switch(j){case "HEX":j=d;break;case "B64":j=e;break;case "ASCII":j=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(h){case "SHA-1":k=64;p=160;break;case "SHA-224":k=64;p=224;break;case "SHA-256":k=64;p=256;break;case "SHA-384":k=
-128;p=384;break;case "SHA-512":k=128;p=512;break;default:return"HASH NOT RECOGNIZED"}if("HEX"===g){if(0!==b.length%2)return"KEY MUST BE IN BYTE INCREMENTS";g=c(b);o=4*b.length}else if("ASCII"===g)g=a(b),o=8*b.length;else return"UNKNOWN KEY INPUT TYPE";b=8*k;m=k/4-1;ko/8&&(g[m]&=4294967040);for(k=0;k<=m;k+=1)l[k]=g[k]^909522486,t[k]=g[k]^1549556828;"SHA-1"===h?(l=A(l.concat(this.strToHash),b+this.strBinLen),l=A(t.concat(l),b+p)):(l=B(l.concat(this.strToHash),
-b+this.strBinLen,h),l=B(t.concat(l),b+p,h));return j(l)}};return C}();function str_sha1(b){return(new jsSHA(b,"ASCII")).getHash("SHA-1","ASCII")}function str_sha224(b){return(new jsSHA(b,"ASCII")).getHash("SHA-224","ASCII")}function str_sha256(b){return(new jsSHA(b,"ASCII")).getHash("SHA-256","ASCII")}function str_sha384(b){return(new jsSHA(b,"ASCII")).getHash("SHA-384","ASCII")}function str_sha512(b){return(new jsSHA(b,"ASCII")).getHash("SHA-512","ASCII")}
-function openpgp_cfb_encrypt(b,a,c,d,e,f){var g=Array(d),h=Array(d),b=b+b.charAt(d-2)+b.charAt(d-1);util.print_debug("prefixrandom:"+util.hexstrdump(b));for(var j="",k=0;ka*g;){for(var e=b(f,c),f=d.substring(g*a,g*a+a),k=0;ka*g;){for(var j=b(f,c),f=d.substring(g*a+0,g*a+a+0),e=0;eb?4:16==b?1:17==b?1:0}function openpgp_crypto_getPrefixRandom(b){switch(b){case 2:case 3:case 4:return openpgp_crypto_getRandomBytes(8);case 7:case 8:case 9:case 10:return openpgp_crypto_getRandomBytes(16);default:return null}}
-function openpgp_crypto_MDCSystemBytes(b,a,c){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nencrypteddata:",c);switch(b){case 0:return c;case 2:return openpgp_cfb_mdc(desede,8,a,c,openpgp_cfb);case 3:return openpgp_cfb_mdc(cast5_encrypt,8,a,c);case 4:return openpgp_cfb_mdc(BFencrypt,8,a,c);case 7:case 8:case 9:return openpgp_cfb_mdc(AESencrypt,16,keyExpansion(a),c);case 10:return openpgp_cfb_mdc(TFencrypt,16,a,c);case 1:util.print_error(""+(1==b?"IDEA Algorithm not implemented":
-"Twofish Algorithm not implemented"))}return null}function openpgp_crypto_generateSessionKey(b){return openpgp_crypto_getRandomBytes(openpgp_crypto_getKeyLength(b))}function openpgp_crypto_getKeyLength(b){switch(b){case 2:case 8:return 24;case 3:case 4:case 7:return 16;case 9:case 10:return 32}return null}function openpgp_crypto_getBlockLength(b){switch(b){case 1:case 2:case 3:return 8;case 4:case 7:case 8:case 9:return 16;case 10:return 32;default:return 0}}
-function openpgp_crypto_verifySignature(b,a,c,d,e){var f=openpgp_crypto_hashData(a,e);switch(b){case 1:case 2:case 3:e=new RSA;b=d[0].toBigInteger();d=d[1].toBigInteger();c=c[0].toBigInteger();d=e.verify(c,d,b);a=openpgp_encoding_emsa_pkcs1_decode(a,d.toMPI().substring(2));return-1==a?(util.print_error("PKCS1 padding in message or key incorrect. Aborting..."),!1):a==f;case 16:return util.print_error("signing with Elgamal is not defined in the OpenPGP standard."),null;case 17:var b=new DSA,f=c[0].toBigInteger(),
-c=c[1].toBigInteger(),g=d[0].toBigInteger(),h=d[1].toBigInteger(),j=d[2].toBigInteger(),d=d[3].toBigInteger(),d=b.verify(a,f,c,e,g,h,j,d);return 0==d.compareTo(f);default:return null}}
-function openpgp_crypto_signData(b,a,c,d,e){switch(a){case 1:case 2:case 3:var a=new RSA,d=d[0].toBigInteger(),f=c[0].toBigInteger(),b=openpgp_encoding_emsa_pkcs1_encode(b,e,c[0].mpiByteLength);util.print_debug("signing using RSA");return a.sign(b,d,f).toMPI();case 17:a=new DSA;util.print_debug("DSA Sign: q size in Bytes:"+c[1].getByteLength());var f=c[0].toBigInteger(),g=c[1].toBigInteger(),h=c[2].toBigInteger();c[3].toBigInteger();c=d[0].toBigInteger();b=a.sign(b,e,h,f,g,c);util.print_debug("signing using DSA\n result:"+
-util.hexstrdump(b[0])+"|"+util.hexstrdump(b[1]));return b[0]+b[1];case 16:return util.print_debug("signing with Elgamal is not defined in the OpenPGP standard."),null;default:return null}}function openpgp_crypto_hashData(b,a){var c=null;switch(b){case 1:c=MD5(a);break;case 2:c=str_sha1(a);break;case 3:c=RMDstring(a);break;case 8:c=str_sha256(a);break;case 9:c=str_sha384(a);break;case 10:c=str_sha512(a);break;case 11:c=str_sha224(a)}return c}
-function openpgp_crypto_getHashByteLength(b){switch(b){case 1:return 16;case 2:case 3:return 20;case 8:return 32;case 9:return 48;case 10:return 64;case 11:return 28}return null}function openpgp_crypto_getRandomBytes(b){for(var a="",c=0;ca-b;)window.crypto.getRandomValues(c);return b+Math.abs(c[0]&Math.pow(2,d)-1)}function openpgp_crypto_getSecureRandomOctet(){var b=new Uint32Array(1);window.crypto.getRandomValues(b);return b[0]&255}
-function openpgp_crypto_getRandomBigInteger(b){if(0>b)return null;var a=openpgp_crypto_getRandomBytes(Math.floor((b+7)/8));0=a.compareTo(b))){for(var c=a.subtract(b),d=openpgp_crypto_getRandomBigInteger(c.bitLength());d>c;)d=openpgp_crypto_getRandomBigInteger(c.bitLength());return b.add(d)}}
-function openpgp_crypto_testRSA(b){debugger;var a=new RSA,c=new openpgp_type_mpi;c.create(openpgp_encoding_eme_pkcs1_encode("ABABABAB",128));c=a.encrypt(c.toBigInteger(),b.ee,b.n);a.decrypt(c,b.d,b.p,b.q,b.u)}
-function openpgp_crypto_generateKeyPair(b,a,c,d,e){var f,g,h=new Date,h=h.getTime()/1E3,h=String.fromCharCode(Math.floor(h/16777216%256))+String.fromCharCode(Math.floor(h/65536%256))+String.fromCharCode(Math.floor(h/256%256))+String.fromCharCode(Math.floor(h%256));switch(b){case 1:a=(new RSA).generate(a,"10001");f=(new openpgp_packet_keymaterial).write_private_key(b,a,c,d,e,h);g=(new openpgp_packet_keymaterial).write_public_key(b,a,h);break;default:util.print_error("Unknown keytype "+b)}return{privateKey:f,
-publicKey:g}}
-function openpgp_crypto_symmetricEncrypt(b,a,c,d,e){switch(a){case 0:return d;case 2:return openpgp_cfb_encrypt(b,desede,d,8,c,e).substring(0,d.length+10);case 3:return openpgp_cfb_encrypt(b,cast5_encrypt,d,8,c,e).substring(0,d.length+10);case 4:return openpgp_cfb_encrypt(b,BFencrypt,d,8,c,e).substring(0,d.length+10);case 7:case 8:case 9:return openpgp_cfb_encrypt(b,AESencrypt,d,16,keyExpansion(c),e).substring(0,d.length+18);case 10:return openpgp_cfb_encrypt(b,TFencrypt,d,16,c,e).substring(0,d.length+
+s[2].highOrder,s[2].lowOrder,s[3].highOrder,s[3].lowOrder,s[4].highOrder,s[4].lowOrder,s[5].highOrder,s[5].lowOrder,s[6].highOrder,s[6].lowOrder,s[7].highOrder,s[7].lowOrder];default:return[]}},C=function(a,d){this.strToHash=this.strBinLen=this.sha512=this.sha384=this.sha256=this.sha224=this.sha1=null;if("HEX"===d){if(0!==a.length%2)return"TEXT MUST BE IN BYTE INCREMENTS";this.strBinLen=4*a.length;this.strToHash=c(a)}else if("ASCII"===d||"undefined"===typeof d)this.strBinLen=8*a.length,this.strToHash=
+b(a);else return"UNKNOWN TEXT INPUT TYPE"};C.prototype={getHash:function(a,b){var c=null,g=this.strToHash.slice();switch(b){case "HEX":c=d;break;case "B64":c=e;break;case "ASCII":c=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(a){case "SHA-1":if(null===this.sha1)this.sha1=A(g,this.strBinLen);return c(this.sha1);case "SHA-224":if(null===this.sha224)this.sha224=B(g,this.strBinLen,a);return c(this.sha224);case "SHA-256":if(null===this.sha256)this.sha256=B(g,this.strBinLen,a);return c(this.sha256);
+case "SHA-384":if(null===this.sha384)this.sha384=B(g,this.strBinLen,a);return c(this.sha384);case "SHA-512":if(null===this.sha512)this.sha512=B(g,this.strBinLen,a);return c(this.sha512);default:return"HASH NOT RECOGNIZED"}},getHMAC:function(a,g,h,j){var k,l,m,o,p;l=[];var t=[];switch(j){case "HEX":j=d;break;case "B64":j=e;break;case "ASCII":j=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(h){case "SHA-1":k=64;p=160;break;case "SHA-224":k=64;p=224;break;case "SHA-256":k=64;p=256;break;case "SHA-384":k=
+128;p=384;break;case "SHA-512":k=128;p=512;break;default:return"HASH NOT RECOGNIZED"}if("HEX"===g){if(0!==a.length%2)return"KEY MUST BE IN BYTE INCREMENTS";g=c(a);o=4*a.length}else if("ASCII"===g)g=b(a),o=8*a.length;else return"UNKNOWN KEY INPUT TYPE";a=8*k;m=k/4-1;ko/8&&(g[m]&=4294967040);for(k=0;k<=m;k+=1)l[k]=g[k]^909522486,t[k]=g[k]^1549556828;"SHA-1"===h?(l=A(l.concat(this.strToHash),a+this.strBinLen),l=A(t.concat(l),a+p)):(l=B(l.concat(this.strToHash),
+a+this.strBinLen,h),l=B(t.concat(l),a+p,h));return j(l)}};return C}();function str_sha1(a){return(new jsSHA(a,"ASCII")).getHash("SHA-1","ASCII")}function str_sha224(a){return(new jsSHA(a,"ASCII")).getHash("SHA-224","ASCII")}function str_sha256(a){return(new jsSHA(a,"ASCII")).getHash("SHA-256","ASCII")}function str_sha384(a){return(new jsSHA(a,"ASCII")).getHash("SHA-384","ASCII")}function str_sha512(a){return(new jsSHA(a,"ASCII")).getHash("SHA-512","ASCII")}
+function openpgp_cfb_encrypt(a,b,c,d,e,f){var h=Array(d),g=Array(d),a=a+a.charAt(d-2)+a.charAt(d-1);util.print_debug("prefixrandom:"+util.hexstrdump(a));for(var j="",k=0;kb*h;){for(var e=a(f,c),f=d.substring(h*b,h*b+b),k=0;kb*h;){for(var j=a(f,c),f=d.substring(h*b+0,h*b+b+0),e=0;ea?4:16==a?1:17==a?1:0}function openpgp_crypto_getPrefixRandom(a){switch(a){case 2:case 3:case 4:return openpgp_crypto_getRandomBytes(8);case 7:case 8:case 9:case 10:return openpgp_crypto_getRandomBytes(16);default:return null}}
+function openpgp_crypto_MDCSystemBytes(a,b,c){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nencrypteddata:",c);switch(a){case 0:return c;case 2:return openpgp_cfb_mdc(desede,8,b,c,openpgp_cfb);case 3:return openpgp_cfb_mdc(cast5_encrypt,8,b,c);case 4:return openpgp_cfb_mdc(BFencrypt,8,b,c);case 7:case 8:case 9:return openpgp_cfb_mdc(AESencrypt,16,keyExpansion(b),c);case 10:return openpgp_cfb_mdc(TFencrypt,16,b,c);case 1:util.print_error(""+(1==a?"IDEA Algorithm not implemented":
+"Twofish Algorithm not implemented"))}return null}function openpgp_crypto_generateSessionKey(a){return openpgp_crypto_getRandomBytes(openpgp_crypto_getKeyLength(a))}function openpgp_crypto_getKeyLength(a){switch(a){case 2:case 8:return 24;case 3:case 4:case 7:return 16;case 9:case 10:return 32}return null}function openpgp_crypto_getBlockLength(a){switch(a){case 1:case 2:case 3:return 8;case 4:case 7:case 8:case 9:return 16;case 10:return 32;default:return 0}}
+function openpgp_crypto_verifySignature(a,b,c,d,e){var f=openpgp_crypto_hashData(b,e);switch(a){case 1:case 2:case 3:e=new RSA;a=d[0].toBigInteger();d=d[1].toBigInteger();c=c[0].toBigInteger();d=e.verify(c,d,a);b=openpgp_encoding_emsa_pkcs1_decode(b,d.toMPI().substring(2));return-1==b?(util.print_error("PKCS1 padding in message or key incorrect. Aborting..."),!1):b==f;case 16:return util.print_error("signing with Elgamal is not defined in the OpenPGP standard."),null;case 17:var a=new DSA,f=c[0].toBigInteger(),
+c=c[1].toBigInteger(),h=d[0].toBigInteger(),g=d[1].toBigInteger(),j=d[2].toBigInteger(),d=d[3].toBigInteger(),d=a.verify(b,f,c,e,h,g,j,d);return 0==d.compareTo(f);default:return null}}
+function openpgp_crypto_signData(a,b,c,d,e){switch(b){case 1:case 2:case 3:var b=new RSA,d=d[0].toBigInteger(),f=c[0].toBigInteger(),a=openpgp_encoding_emsa_pkcs1_encode(a,e,c[0].mpiByteLength);util.print_debug("signing using RSA");return b.sign(a,d,f).toMPI();case 17:b=new DSA;util.print_debug("DSA Sign: q size in Bytes:"+c[1].getByteLength());var f=c[0].toBigInteger(),h=c[1].toBigInteger(),g=c[2].toBigInteger();c[3].toBigInteger();c=d[0].toBigInteger();a=b.sign(a,e,g,f,h,c);util.print_debug("signing using DSA\n result:"+
+util.hexstrdump(a[0])+"|"+util.hexstrdump(a[1]));return a[0]+a[1];case 16:return util.print_debug("signing with Elgamal is not defined in the OpenPGP standard."),null;default:return null}}function openpgp_crypto_hashData(a,b){var c=null;switch(a){case 1:c=MD5(b);break;case 2:c=str_sha1(b);break;case 3:c=RMDstring(b);break;case 8:c=str_sha256(b);break;case 9:c=str_sha384(b);break;case 10:c=str_sha512(b);break;case 11:c=str_sha224(b)}return c}
+function openpgp_crypto_getHashByteLength(a){switch(a){case 1:return 16;case 2:case 3:return 20;case 8:return 32;case 9:return 48;case 10:return 64;case 11:return 28}return null}function openpgp_crypto_getRandomBytes(a){for(var b="",c=0;cb-a;)window.crypto.getRandomValues(c);return a+Math.abs(c[0]&Math.pow(2,d)-1)}function openpgp_crypto_getSecureRandomOctet(){var a=new Uint32Array(1);window.crypto.getRandomValues(a);return a[0]&255}
+function openpgp_crypto_getRandomBigInteger(a){if(0>a)return null;var b=openpgp_crypto_getRandomBytes(Math.floor((a+7)/8));0=b.compareTo(a))){for(var c=b.subtract(a),d=openpgp_crypto_getRandomBigInteger(c.bitLength());d>c;)d=openpgp_crypto_getRandomBigInteger(c.bitLength());return a.add(d)}}
+function openpgp_crypto_testRSA(a){debugger;var b=new RSA,c=new openpgp_type_mpi;c.create(openpgp_encoding_eme_pkcs1_encode("ABABABAB",128));c=b.encrypt(c.toBigInteger(),a.ee,a.n);b.decrypt(c,a.d,a.p,a.q,a.u)}
+function openpgp_crypto_generateKeyPair(a,b,c,d,e){var f,h,g=new Date,g=g.getTime()/1E3,g=String.fromCharCode(Math.floor(g/16777216%256))+String.fromCharCode(Math.floor(g/65536%256))+String.fromCharCode(Math.floor(g/256%256))+String.fromCharCode(Math.floor(g%256));switch(a){case 1:b=(new RSA).generate(b,"10001");f=(new openpgp_packet_keymaterial).write_private_key(a,b,c,d,e,g);h=(new openpgp_packet_keymaterial).write_public_key(a,b,g);break;default:util.print_error("Unknown keytype "+a)}return{privateKey:f,
+publicKey:h}}
+function openpgp_crypto_symmetricEncrypt(a,b,c,d,e){switch(b){case 0:return d;case 2:return openpgp_cfb_encrypt(a,desede,d,8,c,e).substring(0,d.length+10);case 3:return openpgp_cfb_encrypt(a,cast5_encrypt,d,8,c,e).substring(0,d.length+10);case 4:return openpgp_cfb_encrypt(a,BFencrypt,d,8,c,e).substring(0,d.length+10);case 7:case 8:case 9:return openpgp_cfb_encrypt(a,AESencrypt,d,16,keyExpansion(c),e).substring(0,d.length+18);case 10:return openpgp_cfb_encrypt(a,TFencrypt,d,16,c,e).substring(0,d.length+
18);case 1:return util.print_error("IDEA Algorithm not implemented"),null;default:return null}}
-function openpgp_crypto_symmetricDecrypt(b,a,c,d){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nalgo:"+b+"\nencrypteddata:",c);var e=0;d||(e=2);switch(b){case 0:return c;case 2:return openpgp_cfb_decrypt(desede,8,a,c,d).substring(e,c.length+e-10);case 3:return openpgp_cfb_decrypt(cast5_encrypt,8,a,c,d).substring(e,c.length+e-10);case 4:return openpgp_cfb_decrypt(BFencrypt,8,a,c,d).substring(e,c.length+e-10);case 7:case 8:case 9:return openpgp_cfb_decrypt(AESencrypt,16,keyExpansion(a),
-c,d).substring(e,c.length+e-18);case 10:return openpgp_cfb_decrypt(TFencrypt,16,a,c,d).substring(e,c.length+e-18);case 1:util.print_error(""+(1==b?"IDEA Algorithm not implemented":"Twofish Algorithm not implemented"))}return null}
+function openpgp_crypto_symmetricDecrypt(a,b,c,d){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nalgo:"+a+"\nencrypteddata:",c);var e=0;d||(e=2);switch(a){case 0:return c;case 2:return openpgp_cfb_decrypt(desede,8,b,c,d).substring(e,c.length+e-10);case 3:return openpgp_cfb_decrypt(cast5_encrypt,8,b,c,d).substring(e,c.length+e-10);case 4:return openpgp_cfb_decrypt(BFencrypt,8,b,c,d).substring(e,c.length+e-10);case 7:case 8:case 9:return openpgp_cfb_decrypt(AESencrypt,16,keyExpansion(b),
+c,d).substring(e,c.length+e-18);case 10:return openpgp_cfb_decrypt(TFencrypt,16,b,c,d).substring(e,c.length+e-18);case 1:util.print_error(""+(1==a?"IDEA Algorithm not implemented":"Twofish Algorithm not implemented"))}return null}
var Rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,
60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,
153,45,15,176,84,187,22],T1=[2774754246,2222750968,2574743534,2373680118,234025727,3177933782,2976870366,1422247313,1345335392,50397442,2842126286,2099981142,436141799,1658312629,3870010189,2591454956,1170918031,2642575903,1086966153,2273148410,368769775,3948501426,3376891790,200339707,3970805057,1742001331,4255294047,3937382213,3214711843,4154762323,2524082916,1539358875,3266819957,486407649,2928907069,1780885068,1513502316,1094664062,49805301,1338821763,1546925160,4104496465,887481809,150073849,
@@ -149,12 +149,12 @@ var Rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,
3711886307,1584475951,328696964,2801095507,3110654417,0,3240947181,1080041504,3810524412,2043195825,3069008731,3569248874,2370227147,1742323390,1917532473,2497595978,2564049996,2968016984,2236272591,3144405200,3307925487,1340451498,3977706491,2261074755,2597801293,1716859699,294946181,2328839493,3910203897,67502594,4269899647,2700103760,2017737788,632987551,1273211048,2733855057,1576969123,2160083008,92966799,1068339858,566009245,1883781176,4043634165,1675607228,2009183926,2943736538,1113792801,540020752,
3843751935,4245615603,3211645650,2169294285,403966988,641012499,3274697964,3202441055,899848087,2295088196,775493399,2472002756,1441965991,4236410494,2051489085,3366741092,3135724893,841685273,3868554099,3231735904,429425025,2664517455,2743065820,1147544098,1417554474,1001099408,193169544,2362066502,3341414126,1809037496,675025940,2809781982,3168951902,371002123,2910247899,3678134496,1683370546,1951283770,337512970,2463844681,201983494,1215046692,3101973596,2673722050,3178157011,1139780780,3299238498,
967348625,832869781,3543655652,4069226873,3576883175,2336475336,1851340599,3669454189,25988493,2976175573,2631028302,1239460265,3635702892,2902087254,4077384948,3475368682,3400492389,4102978170,1206496942,270010376,1876277946,4035475576,1248797989,1550986798,941890588,1475454630,1942467764,2538718918,3408128232,2709315037,3902567540,1042358047,2531085131,1641856445,226921355,260409994,3767562352,2084716094,1908716981,3433719398,2430093384,100991747,4144101110,470945294,3265487201,1784624437,2935576407,
-1775286713,395413126,2572730817,975641885,666476190,3644383713,3943954680,733190296,573772049,3535497577,2842745305,126455438,866620564,766942107,1008868894,361924487,3374377449,2269761230,2868860245,1350051880,2776293343,59739276,1509466529,159418761,437718285,1708834751,3610371814,2227585602,3501746280,2193834305,699439513,1517759789,504434447,2076946608,2835108948,1842789307,742004246];function B0(b){return b&255}function B1(b){return b>>8&255}function B2(b){return b>>16&255}
-function B3(b){return b>>24&255}function F1(b,a,c,d){return B1(T1[b&255])|B1(T1[a>>8&255])<<8|B1(T1[c>>16&255])<<16|B1(T1[d>>>24])<<24}function packBytes(b){var a,c,d=b.length,e=Array(d/4);if(b&&!(d%4)){for(a=0,c=0;cc;d++,c++)f[b][c]=j[d];4==c&&(b++,c=0)}for(;bc;d++,c++)f[b][c]=j[d];4==c&&(b++,c=0)}}this.rounds=e;this.rk=f;return this}
-function AESencrypt(b,a){var c,d,e,f,g,h=packBytes(b),j=a.rounds,k=h[0],l=h[1],m=h[2];g=h[3];for(c=0;c>8&255]^T3[f>>16&255]^T4[g>>>24],l=T1[e&255]^T2[f>>8&255]^T3[g>>16&255]^T4[d>>>24],m=T1[f&255]^T2[g>>8&255]^T3[d>>16&255]^T4[e>>>24],g=T1[g&255]^T2[d>>8&255]^T3[e>>16&255]^T4[f>>>24];c=j-1;d=k^a.rk[c][0];e=l^a.rk[c][1];f=m^a.rk[c][2];g^=a.rk[c][3];h[0]=F1(d,e,f,g)^a.rk[j][0];h[1]=F1(e,f,g,d)^a.rk[j][1];h[2]=F1(f,
-g,d,e)^a.rk[j][2];h[3]=F1(g,d,e,f)^a.rk[j][3];return unpackBytes(h)}function Blowfish(){}Blowfish.prototype.BLOCKSIZE=8;
+1775286713,395413126,2572730817,975641885,666476190,3644383713,3943954680,733190296,573772049,3535497577,2842745305,126455438,866620564,766942107,1008868894,361924487,3374377449,2269761230,2868860245,1350051880,2776293343,59739276,1509466529,159418761,437718285,1708834751,3610371814,2227585602,3501746280,2193834305,699439513,1517759789,504434447,2076946608,2835108948,1842789307,742004246];function B0(a){return a&255}function B1(a){return a>>8&255}function B2(a){return a>>16&255}
+function B3(a){return a>>24&255}function F1(a,b,c,d){return B1(T1[a&255])|B1(T1[b>>8&255])<<8|B1(T1[c>>16&255])<<16|B1(T1[d>>>24])<<24}function packBytes(a){var b,c,d=a.length,e=Array(d/4);if(a&&!(d%4)){for(b=0,c=0;cc;d++,c++)f[a][c]=j[d];4==c&&(a++,c=0)}for(;ac;d++,c++)f[a][c]=j[d];4==c&&(a++,c=0)}}this.rounds=e;this.rk=f;return this}
+function AESencrypt(a,b){var c,d,e,f,h,g=packBytes(a),j=b.rounds,k=g[0],l=g[1],m=g[2];h=g[3];for(c=0;c>8&255]^T3[f>>16&255]^T4[h>>>24],l=T1[e&255]^T2[f>>8&255]^T3[h>>16&255]^T4[d>>>24],m=T1[f&255]^T2[h>>8&255]^T3[d>>16&255]^T4[e>>>24],h=T1[h&255]^T2[d>>8&255]^T3[e>>16&255]^T4[f>>>24];c=j-1;d=k^b.rk[c][0];e=l^b.rk[c][1];f=m^b.rk[c][2];h^=b.rk[c][3];g[0]=F1(d,e,f,h)^b.rk[j][0];g[1]=F1(e,f,h,d)^b.rk[j][1];g[2]=F1(f,
+h,d,e)^b.rk[j][2];g[3]=F1(h,d,e,f)^b.rk[j][3];return unpackBytes(g)}function Blowfish(){}Blowfish.prototype.BLOCKSIZE=8;
Blowfish.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,
2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,
2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,
@@ -177,17 +177,17 @@ Blowfish.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,310179838
3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409E3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,
3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,
1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];
-Blowfish.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731];Blowfish.prototype.NN=16;Blowfish.prototype._clean=function(b){0>b&&(b=(b&2147483647)+2147483648);return b};Blowfish.prototype._F=function(b){var a,c,d;d=b&255;b>>>=8;c=b&255;b>>>=8;a=b&255;b=this.sboxes[0][b>>>8&255]+this.sboxes[1][a];b^=this.sboxes[2][c];return b+=this.sboxes[3][d]};
-Blowfish.prototype._encrypt_block=function(b){var a=b[0],c=b[1],d;for(d=0;d>>24-8*a&255,b[a+d]=c[1]>>>24-8*a&255;return b};
-Blowfish.prototype._decrypt_block=function(b){var a=b[0],c=b[1],d;for(d=this.NN+1;1e;++e)d=d<<8|b[c]&255,++c>=b.length&&(c=0);this.parray[a]=this.PARRAY[a]^d}this.sboxes=[];for(a=0;4>a;++a){this.sboxes[a]=[];for(c=0;256>c;++c)this.sboxes[a][c]=this.SBOXES[a][c]}b=[0,0];for(a=0;aa;++a)for(c=0;256>c;c+=2)this._encrypt_block(b),this.sboxes[a][c+0]=b[0],this.sboxes[a][c+1]=b[1]};
-function BFencrypt(b,a){var c=new Blowfish;c.init(util.str2bin(a));return c.encrypt_block(b)}function cast5_encrypt(b,a){var c=new openpgp_symenc_cast5;c.setKey(util.str2bin(a));return c.encrypt(b)}
-function openpgp_symenc_cast5(){function b(a,b,c){a=b+a;c=a<>>32-c;return(f[0][c>>>24]^f[1][c>>>16&255])-f[2][c>>>8&255]+f[3][c&255]}function a(a,b,c){a^=b;c=a<>>32-c;return f[0][c>>>24]-f[1][c>>>16&255]+f[2][c>>>8&255]^f[3][c&255]}function c(a,b,c){a=b-a;c=a<>>32-c;return(f[0][c>>>24]+f[1][c>>>16&255]^f[2][c>>>8&255])-f[3][c&255]}this.BlockSize=8;this.KeySize=16;this.setKey=function(a){this.masking=Array(16);this.rotate=Array(16);this.reset();if(a.length==this.KeySize)this.keySchedule(a);
-else return util.print_error("cast5.js: CAST-128: keys must be 16 bytes"),!1;return!0};this.reset=function(){for(var a=0;16>a;a++)this.masking[a]=0,this.rotate[a]=0};this.getBlockSize=function(){return BlockSize};this.encrypt=function(d){for(var e=Array(d.length),f=0;f>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>>16&255;e[f+6]=k>>>8&255;e[f+7]=k&255}return e};this.decrypt=function(d){for(var e=Array(d.length),f=0;f>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>16&255;e[f+6]=k>>8&255;e[f+7]=k&255}return e};var d=Array(4);d[0]=Array(4);d[0][0]=[4,0,13,15,12,14,8];d[0][1]=[5,2,16,18,17,19,10];d[0][2]=[6,3,23,22,21,20,9];d[0][3]=[7,1,26,25,27,24,11];d[1]=Array(4);d[1][0]=[0,
+Blowfish.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731];Blowfish.prototype.NN=16;Blowfish.prototype._clean=function(a){0>a&&(a=(a&2147483647)+2147483648);return a};Blowfish.prototype._F=function(a){var b,c,d;d=a&255;a>>>=8;c=a&255;a>>>=8;b=a&255;a=this.sboxes[0][a>>>8&255]+this.sboxes[1][b];a^=this.sboxes[2][c];return a+=this.sboxes[3][d]};
+Blowfish.prototype._encrypt_block=function(a){var b=a[0],c=a[1],d;for(d=0;d>>24-8*b&255,a[b+d]=c[1]>>>24-8*b&255;return a};
+Blowfish.prototype._decrypt_block=function(a){var b=a[0],c=a[1],d;for(d=this.NN+1;1e;++e)d=d<<8|a[c]&255,++c>=a.length&&(c=0);this.parray[b]=this.PARRAY[b]^d}this.sboxes=[];for(b=0;4>b;++b){this.sboxes[b]=[];for(c=0;256>c;++c)this.sboxes[b][c]=this.SBOXES[b][c]}a=[0,0];for(b=0;bb;++b)for(c=0;256>c;c+=2)this._encrypt_block(a),this.sboxes[b][c+0]=a[0],this.sboxes[b][c+1]=a[1]};
+function BFencrypt(a,b){var c=new Blowfish;c.init(util.str2bin(b));return c.encrypt_block(a)}function cast5_encrypt(a,b){var c=new openpgp_symenc_cast5;c.setKey(util.str2bin(b));return c.encrypt(a)}
+function openpgp_symenc_cast5(){function a(a,b,c){a=b+a;c=a<>>32-c;return(f[0][c>>>24]^f[1][c>>>16&255])-f[2][c>>>8&255]+f[3][c&255]}function b(a,b,c){a^=b;c=a<>>32-c;return f[0][c>>>24]-f[1][c>>>16&255]+f[2][c>>>8&255]^f[3][c&255]}function c(a,b,c){a=b-a;c=a<>>32-c;return(f[0][c>>>24]+f[1][c>>>16&255]^f[2][c>>>8&255])-f[3][c&255]}this.BlockSize=8;this.KeySize=16;this.setKey=function(a){this.masking=Array(16);this.rotate=Array(16);this.reset();if(a.length==this.KeySize)this.keySchedule(a);
+else return util.print_error("cast5.js: CAST-128: keys must be 16 bytes"),!1;return!0};this.reset=function(){for(var a=0;16>a;a++)this.masking[a]=0,this.rotate[a]=0};this.getBlockSize=function(){return BlockSize};this.encrypt=function(d){for(var e=Array(d.length),f=0;f>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>>16&255;e[f+6]=k>>>8&255;e[f+7]=k&255}return e};this.decrypt=function(d){for(var e=Array(d.length),f=0;f>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>16&255;e[f+6]=k>>8&255;e[f+7]=k&255}return e};var d=Array(4);d[0]=Array(4);d[0][0]=[4,0,13,15,12,14,8];d[0][1]=[5,2,16,18,17,19,10];d[0][2]=[6,3,23,22,21,20,9];d[0][3]=[7,1,26,25,27,24,11];d[1]=Array(4);d[1][0]=[0,
6,21,23,20,22,16];d[1][1]=[1,4,0,2,1,3,18];d[1][2]=[2,5,7,6,5,4,17];d[1][3]=[3,7,10,9,11,8,19];d[2]=Array(4);d[2][0]=[4,0,13,15,12,14,8];d[2][1]=[5,2,16,18,17,19,10];d[2][2]=[6,3,23,22,21,20,9];d[2][3]=[7,1,26,25,27,24,11];d[3]=Array(4);d[3][0]=[0,6,21,23,20,22,16];d[3][1]=[1,4,0,2,1,3,18];d[3][2]=[2,5,7,6,5,4,17];d[3][3]=[3,7,10,9,11,8,19];var e=Array(4);e[0]=Array(4);e[0][0]=[24,25,23,22,18];e[0][1]=[26,27,21,20,22];e[0][2]=[28,29,19,18,25];e[0][3]=[30,31,17,16,28];e[1]=Array(4);e[1][0]=[3,2,12,
13,8];e[1][1]=[1,0,14,15,13];e[1][2]=[7,6,8,9,3];e[1][3]=[5,4,10,11,7];e[2]=Array(4);e[2][0]=[19,18,28,29,25];e[2][1]=[17,16,30,31,28];e[2][2]=[23,22,24,25,18];e[2][3]=[21,20,26,27,22];e[3]=Array(4);e[3][0]=[8,9,7,6,3];e[3][1]=[10,11,5,4,7];e[3][2]=[12,13,3,2,8];e[3][3]=[14,15,1,0,13];this.keySchedule=function(a){for(var b=Array(8),c=Array(32),k=0;4>k;k++){var l=4*k;b[k]=a[l]<<24|a[l+1]<<16|a[l+2]<<8|a[l+3]}for(var a=[6,7,4,5],m=k=0;2>m;m++)for(var r=0;4>r;r++){for(l=0;4>l;l++){var p=d[r][l],o=b[p[1]],
o=o^f[4][b[p[2]>>>2]>>>24-8*(p[2]&3)&255],o=o^f[5][b[p[3]>>>2]>>>24-8*(p[3]&3)&255],o=o^f[6][b[p[4]>>>2]>>>24-8*(p[4]&3)&255],o=o^f[7][b[p[5]>>>2]>>>24-8*(p[5]&3)&255],o=o^f[a[l]][b[p[6]>>>2]>>>24-8*(p[6]&3)&255];b[p[0]]=o}for(l=0;4>l;l++)p=e[r][l],o=f[4][b[p[0]>>>2]>>>24-8*(p[0]&3)&255],o^=f[5][b[p[1]>>>2]>>>24-8*(p[1]&3)&255],o^=f[6][b[p[2]>>>2]>>>24-8*(p[2]&3)&255],o^=f[7][b[p[3]>>>2]>>>24-8*(p[3]&3)&255],o^=f[4+l][b[p[4]>>>2]>>>24-8*(p[4]&3)&255],c[k]=o,k++}for(k=0;16>k;k++)this.masking[k]=c[k],
@@ -235,209 +235,196 @@ f[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612
2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,
4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,
2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}
-function desede(b,a){var c=a.substring(0,8),d=a.substring(8,16),e=a.substring(16,24);return util.str2bin(des(des_createKeys(e),des(des_createKeys(d),des(des_createKeys(c),util.bin2str(b),!0,0,null,null),!1,0,null,null),!0,0,null,null))}
-function des(b,a,c,d,e,f){var g=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],h=[-2146402272,-2147450880,
+function desede(a,b){var c=b.substring(0,8),d=b.substring(8,16),e=b.substring(16,24);return util.str2bin(des(des_createKeys(e),des(des_createKeys(d),des(des_createKeys(c),util.bin2str(a),!0,0,null,null),!1,0,null,null),!0,0,null,null))}
+function des(a,b,c,d,e,f){var h=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],g=[-2146402272,-2147450880,
32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,
32800,-2147483648,-2146435040,-2146402272,1081344],j=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,
131592,8,134348808,131584],k=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,
1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],m=[536870928,541065216,
16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],r=[2097152,
69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],p=[268439616,4096,262144,268701760,268435456,
-268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],o=0,y,x,v,u,t,E,Q,D,M,K,w,z,T=a.length,A=0,B=32==b.length?
-3:9;E=3==B?c?[0,32,2]:[30,-2,-2]:c?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2];2==f?a+=" ":1==f?(f=8-T%8,a+=String.fromCharCode(f,f,f,f,f,f,f,f),8==f&&(T+=8)):f||(a+="\x00\x00\x00\x00\x00\x00\x00\x00");tempresult=result="";1==d&&(Q=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),M=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),o=0);for(;o>>4^t)&252645135;t^=f;u^=f<<4;f=(u>>>16^t)&65535;t^=f;u^=f<<16;f=(t>>>2^u)&858993459;u^=f;t^=f<<2;f=(t>>>8^u)&16711935;u^=f;t^=f<<8;f=(u>>>1^t)&1431655765;t^=f;u^=f<<1;u=u<<1|u>>>31;t=t<<1|t>>>31;for(y=0;y>>4|t<<28)^b[e+1],f=u,u=t,t=f^(h[x>>>24&63]|k[x>>>16&63]|m[x>>>8&63]|p[x&63]|g[v>>>24&63]|j[v>>>16&63]|l[v>>>
+268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],o=0,y,x,v,u,t,E,Q,D,M,K,w,z,T=b.length,A=0,B=32==a.length?
+3:9;E=3==B?c?[0,32,2]:[30,-2,-2]:c?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2];2==f?b+=" ":1==f?(f=8-T%8,b+=String.fromCharCode(f,f,f,f,f,f,f,f),8==f&&(T+=8)):f||(b+="\x00\x00\x00\x00\x00\x00\x00\x00");tempresult=result="";1==d&&(Q=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),M=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),o=0);for(;o>>4^t)&252645135;t^=f;u^=f<<4;f=(u>>>16^t)&65535;t^=f;u^=f<<16;f=(t>>>2^u)&858993459;u^=f;t^=f<<2;f=(t>>>8^u)&16711935;u^=f;t^=f<<8;f=(u>>>1^t)&1431655765;t^=f;u^=f<<1;u=u<<1|u>>>31;t=t<<1|t>>>31;for(y=0;y>>4|t<<28)^a[e+1],f=u,u=t,t=f^(g[x>>>24&63]|k[x>>>16&63]|m[x>>>8&63]|p[x&63]|h[v>>>24&63]|j[v>>>16&63]|l[v>>>
8&63]|r[v&63]);f=u;u=t;t=f}u=u>>>1|u<<31;t=t>>>1|t<<31;f=(u>>>1^t)&1431655765;t^=f;u^=f<<1;f=(t>>>8^u)&16711935;u^=f;t^=f<<8;f=(t>>>2^u)&858993459;u^=f;t^=f<<2;f=(u>>>16^t)&65535;t^=f;u^=f<<16;f=(u>>>4^t)&252645135;t^=f;u^=f<<4;1==d&&(c?(Q=u,M=t):(u^=D,t^=K));tempresult+=String.fromCharCode(u>>>24,u>>>16&255,u>>>8&255,u&255,t>>>24,t>>>16&255,t>>>8&255,t&255);A+=8;512==A&&(result+=tempresult,tempresult="",A=0)}result+=tempresult;return result=result.replace(/\0*$/g,"")}
-function des_createKeys(b){pc2bytes0=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964];pc2bytes1=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697];pc2bytes2=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272];pc2bytes3=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,
+function des_createKeys(a){pc2bytes0=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964];pc2bytes1=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697];pc2bytes2=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272];pc2bytes3=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,
139264,2236416,134356992,136454144];pc2bytes4=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256];pc2bytes5=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488];pc2bytes6=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746];pc2bytes7=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,
537069568];pc2bytes8=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578];pc2bytes9=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488];pc2bytes10=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800];pc2bytes11=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744];
-pc2bytes12=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128];pc2bytes13=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261];for(var a=8>>4^right)&252645135;
+pc2bytes12=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128];pc2bytes13=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261];for(var b=8>>4^right)&252645135;
right^=j;left^=j<<4;j=(right>>>-16^left)&65535;left^=j;right^=j<<-16;j=(left>>>2^right)&858993459;right^=j;left^=j<<2;j=(right>>>-16^left)&65535;left^=j;right^=j<<-16;j=(left>>>1^right)&1431655765;right^=j;left^=j<<1;j=(right>>>8^left)&16711935;left^=j;right^=j<<8;j=(left>>>1^right)&1431655765;right^=j;left^=j<<1;j=left<<8|right>>>20&240;left=right<<24|right<<8&16711680|right>>>8&65280|right>>>24&240;right=j;for(i=0;i>>26,right=right<<2|right>>>26):(left=left<<
-1|left>>>27,right=right<<1|right>>>27),left&=-15,right&=-15,e=pc2bytes0[left>>>28]|pc2bytes1[left>>>24&15]|pc2bytes2[left>>>20&15]|pc2bytes3[left>>>16&15]|pc2bytes4[left>>>12&15]|pc2bytes5[left>>>8&15]|pc2bytes6[left>>>4&15],f=pc2bytes7[right>>>28]|pc2bytes8[right>>>24&15]|pc2bytes9[right>>>20&15]|pc2bytes10[right>>>16&15]|pc2bytes11[right>>>12&15]|pc2bytes12[right>>>8&15]|pc2bytes13[right>>>4&15],j=(f>>>16^e)&65535,c[h++]=e^j,c[h++]=f^j<<16}return c}
-function TFencrypt(b,a){var c=[].concat(b),d=createTwofish();d.open(util.str2bin(a),0);c=d.encrypt(c,0);d.close();return c}var MAXINT=4294967295;function rotb(b,a){return(b<>>8-a)&255}function rotw(b,a){return(b<>>32-a)&MAXINT}function getW(b,a){return b[a]|b[a+1]<<8|b[a+2]<<16|b[a+3]<<24}function setW(b,a,c){b.splice(a,4,c&255,c>>>8&255,c>>>16&255,c>>>24&255)}function setWInv(b,a,c){b.splice(a,4,c>>>24&255,c>>>16&255,c>>>8&255,c&255)}function getB(b,a){return b>>>8*a&255}
-function getNrBits(b){for(var a=0;0>>=1;return a}function getMask(b){return(1<d;d++)e=c>>>24,c=c<<8&MAXINT|a>>>24,a=a<<8&MAXINT,f=e<<1,e&128&&(f^=333),c^=e^f<<16,f^=e>>>1,e&1&&(f^=166),c^=f<<24|f<<8;return c}function d(a,b){var c,e,f;c=b>>4;e=b&15;f=t[a][c^
-e];c=E[a][M[e]^K[c]];return D[a][M[c]^K[f]]<<4|Q[a][f^c]}function e(a,b){var c=getB(a,0),d=getB(a,1),f=getB(a,2),g=getB(a,3);switch(x){case 4:c=w[1][c]^getB(b[3],0),d=w[0][d]^getB(b[3],1),f=w[0][f]^getB(b[3],2),g=w[1][g]^getB(b[3],3);case 3:c=w[1][c]^getB(b[2],0),d=w[1][d]^getB(b[2],1),f=w[0][f]^getB(b[2],2),g=w[0][g]^getB(b[2],3);case 2:c=w[0][w[0][c]^getB(b[1],0)]^getB(b[0],0),d=w[0][w[1][d]^getB(b[1],1)]^getB(b[0],1),f=w[1][w[0][f]^getB(b[1],2)]^getB(b[0],2),g=w[1][w[1][g]^getB(b[1],3)]^getB(b[0],
-3)}return z[0][c]^z[1][d]^z[2][f]^z[3][g]}c=a;var m,r,p,o;p=[];o=[];var y=[],x,v=[],u,t=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],E=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],Q=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],D=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],M=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],K=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,
+1|left>>>27,right=right<<1|right>>>27),left&=-15,right&=-15,e=pc2bytes0[left>>>28]|pc2bytes1[left>>>24&15]|pc2bytes2[left>>>20&15]|pc2bytes3[left>>>16&15]|pc2bytes4[left>>>12&15]|pc2bytes5[left>>>8&15]|pc2bytes6[left>>>4&15],f=pc2bytes7[right>>>28]|pc2bytes8[right>>>24&15]|pc2bytes9[right>>>20&15]|pc2bytes10[right>>>16&15]|pc2bytes11[right>>>12&15]|pc2bytes12[right>>>8&15]|pc2bytes13[right>>>4&15],j=(f>>>16^e)&65535,c[g++]=e^j,c[g++]=f^j<<16}return c}
+function TFencrypt(a,b){var c=[].concat(a),d=createTwofish();d.open(util.str2bin(b),0);c=d.encrypt(c,0);d.close();return c}var MAXINT=4294967295;function rotb(a,b){return(a<>>8-b)&255}function rotw(a,b){return(a<>>32-b)&MAXINT}function getW(a,b){return a[b]|a[b+1]<<8|a[b+2]<<16|a[b+3]<<24}function setW(a,b,c){a.splice(b,4,c&255,c>>>8&255,c>>>16&255,c>>>24&255)}function setWInv(a,b,c){a.splice(b,4,c>>>24&255,c>>>16&255,c>>>8&255,c&255)}function getB(a,b){return a>>>8*b&255}
+function getNrBits(a){for(var b=0;0>>=1;return b}function getMask(a){return(1<d;d++)e=c>>>24,c=c<<8&MAXINT|a>>>24,a=a<<8&MAXINT,f=e<<1,e&128&&(f^=333),c^=e^f<<16,f^=e>>>1,e&1&&(f^=166),c^=f<<24|f<<8;return c}function d(a,b){var c,e,f;c=b>>4;e=b&15;f=t[a][c^
+e];c=E[a][M[e]^K[c]];return D[a][M[c]^K[f]]<<4|Q[a][f^c]}function e(a,b){var c=getB(a,0),d=getB(a,1),f=getB(a,2),h=getB(a,3);switch(x){case 4:c=w[1][c]^getB(b[3],0),d=w[0][d]^getB(b[3],1),f=w[0][f]^getB(b[3],2),h=w[1][h]^getB(b[3],3);case 3:c=w[1][c]^getB(b[2],0),d=w[1][d]^getB(b[2],1),f=w[0][f]^getB(b[2],2),h=w[0][h]^getB(b[2],3);case 2:c=w[0][w[0][c]^getB(b[1],0)]^getB(b[0],0),d=w[0][w[1][d]^getB(b[1],1)]^getB(b[0],1),f=w[1][w[0][f]^getB(b[1],2)]^getB(b[0],2),h=w[1][w[1][h]^getB(b[1],3)]^getB(b[0],
+3)}return z[0][c]^z[1][d]^z[2][f]^z[3][h]}c=a;var m,r,p,o;p=[];o=[];var y=[],x,v=[],u,t=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],E=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],Q=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],D=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],M=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],K=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,
7],w=[[],[]],z=[[],[],[],[]];c=c.slice(0,32);for(a=c.length;16!=a&&24!=a&&32!=a;)c[a++]=0;for(a=0;a>2]=getW(c,a);for(a=0;256>a;a++)w[0][a]=d(0,a),w[1][a]=d(1,a);for(a=0;256>a;a++)m=w[1][a],r=m^m>>2^[0,90,180,238][m&3],u=m^m>>1^m>>2^[0,238,180,90][m&3],z[0][a]=m+(r<<8)+(u<<16)+(u<<24),z[2][a]=r+(u<<8)+(m<<16)+(u<<24),m=w[0][a],r=m^m>>2^[0,90,180,238][m&3],u=m^m>>1^m>>2^[0,238,180,90][m&3],z[1][a]=u+(u<<8)+(r<<16)+(m<<24),z[3][a]=r+(m<<8)+(u<<16)+(r<<24);x=y.length/2;for(a=0;aa;a+=2)m=16843009*a,r=m+16843009,m=e(m,p),r=rotw(e(r,o),8),f[a]=m+r&MAXINT,f[a+1]=rotw(m+2*r,9);for(a=0;256>a;a++)switch(m=r=p=o=a,x){case 4:m=w[1][m]^getB(v[3],0),r=w[0][r]^getB(v[3],1),p=w[0][p]^getB(v[3],2),o=w[1][o]^getB(v[3],3);case 3:m=w[1][m]^getB(v[2],0),r=w[1][r]^getB(v[2],1),p=w[0][p]^getB(v[2],2),o=w[0][o]^getB(v[2],3);case 2:g[0][a]=z[0][w[0][w[0][m]^getB(v[1],0)]^getB(v[0],0)],g[1][a]=z[1][w[0][w[1][r]^getB(v[1],1)]^getB(v[0],
-1)],g[2][a]=z[2][w[1][w[0][p]^getB(v[1],2)]^getB(v[0],2)],g[3][a]=z[3][w[1][w[1][o]^getB(v[1],3)]^getB(v[0],3)]}},close:function(){f=[];g=[[],[],[],[]]},encrypt:function(c,g){d=c;e=g;for(var k=[getW(d,e)^f[0],getW(d,e+4)^f[1],getW(d,e+8)^f[2],getW(d,e+12)^f[3]],l=0;8>l;l++){var m=l,r=k,p=b(r[0]),o=a(r[1]);r[2]=rotw(r[2]^p+o+f[4*m+8]&MAXINT,31);r[3]=rotw(r[3],1)^p+2*o+f[4*m+9]&MAXINT;p=b(r[2]);o=a(r[3]);r[0]=rotw(r[0]^p+o+f[4*m+10]&MAXINT,31);r[1]=rotw(r[1],1)^p+2*o+f[4*m+11]&MAXINT}setW(d,e,k[2]^
-f[4]);setW(d,e+4,k[3]^f[5]);setW(d,e+8,k[0]^f[6]);setW(d,e+12,k[1]^f[7]);e+=16;return d},decrypt:function(c,g){d=c;e=g;for(var k=[getW(d,e)^f[4],getW(d,e+4)^f[5],getW(d,e+8)^f[6],getW(d,e+12)^f[7]],l=7;0<=l;l--){var m=l,r=k,p=b(r[0]),o=a(r[1]);r[2]=rotw(r[2],1)^p+o+f[4*m+10]&MAXINT;r[3]=rotw(r[3]^p+2*o+f[4*m+11]&MAXINT,31);p=b(r[2]);o=a(r[3]);r[0]=rotw(r[0],1)^p+o+f[4*m+8]&MAXINT;r[1]=rotw(r[1]^p+2*o+f[4*m+9]&MAXINT,31)}setW(d,e,k[2]^f[0]);setW(d,e+4,k[3]^f[1]);setW(d,e+8,k[0]^f[2]);setW(d,e+12,k[1]^
-f[3]);e+=16},finalize:function(){return d}}}JXG={exists:function(b){return function(a){return!(a===b||null===a)}}()};JXG.decompress=function(b){return unescape((new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(b))).unzip()[0][0])};JXG.Util={};
-JXG.Util.Unzip=function(b){function a(){$+=8;return B>=1;0==C&&(C=a(),b=C&1,C=C>>1|128);return b}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=D[b]>>8-a);return b}function e(a){Q++;u[t++]=a;p.push(String.fromCharCode(a));32768==t&&(t=0)}function f(){this.b1=this.b0=0;this.jump=null;this.jumppos=-1}function g(){for(;;){if(W[N]>=qa)return-1;if(pa[W[N]]==N)return W[N]++;W[N]++}}function h(){var a=V[U],b;o&&document.write("
len:"+N+" treepos:"+
-U);if(17==N)return-1;U++;N++;b=g();o&&document.write("
IsPat "+b);if(0<=b)a.b0=b,o&&document.write("
b0 "+a.b0);else if(a.b0=32768,o&&document.write("
b0 "+a.b0),h())return-1;b=g();if(0<=b)a.b1=b,o&&document.write("
b1 "+a.b1),a.jump=null;else if(a.b1=32768,o&&document.write("
b1 "+a.b1),a.jump=V[U],a.jumppos=U,h())return-1;N--;return 0}function j(a,b,c,d){o&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show "+d);V=a;U=0;pa=c;qa=b;for(a=0;17>a;a++)W[a]=0;N=0;if(h())return o&&
+y[a+a],p[a]=m,r=y[a+a+1],o[a]=r,v[x-a-1]=b(m,r);for(a=0;40>a;a+=2)m=16843009*a,r=m+16843009,m=e(m,p),r=rotw(e(r,o),8),f[a]=m+r&MAXINT,f[a+1]=rotw(m+2*r,9);for(a=0;256>a;a++)switch(m=r=p=o=a,x){case 4:m=w[1][m]^getB(v[3],0),r=w[0][r]^getB(v[3],1),p=w[0][p]^getB(v[3],2),o=w[1][o]^getB(v[3],3);case 3:m=w[1][m]^getB(v[2],0),r=w[1][r]^getB(v[2],1),p=w[0][p]^getB(v[2],2),o=w[0][o]^getB(v[2],3);case 2:h[0][a]=z[0][w[0][w[0][m]^getB(v[1],0)]^getB(v[0],0)],h[1][a]=z[1][w[0][w[1][r]^getB(v[1],1)]^getB(v[0],
+1)],h[2][a]=z[2][w[1][w[0][p]^getB(v[1],2)]^getB(v[0],2)],h[3][a]=z[3][w[1][w[1][o]^getB(v[1],3)]^getB(v[0],3)]}},close:function(){f=[];h=[[],[],[],[]]},encrypt:function(c,h){d=c;e=h;for(var k=[getW(d,e)^f[0],getW(d,e+4)^f[1],getW(d,e+8)^f[2],getW(d,e+12)^f[3]],l=0;8>l;l++){var m=l,r=k,p=a(r[0]),o=b(r[1]);r[2]=rotw(r[2]^p+o+f[4*m+8]&MAXINT,31);r[3]=rotw(r[3],1)^p+2*o+f[4*m+9]&MAXINT;p=a(r[2]);o=b(r[3]);r[0]=rotw(r[0]^p+o+f[4*m+10]&MAXINT,31);r[1]=rotw(r[1],1)^p+2*o+f[4*m+11]&MAXINT}setW(d,e,k[2]^
+f[4]);setW(d,e+4,k[3]^f[5]);setW(d,e+8,k[0]^f[6]);setW(d,e+12,k[1]^f[7]);e+=16;return d},decrypt:function(c,h){d=c;e=h;for(var k=[getW(d,e)^f[4],getW(d,e+4)^f[5],getW(d,e+8)^f[6],getW(d,e+12)^f[7]],l=7;0<=l;l--){var m=l,r=k,p=a(r[0]),o=b(r[1]);r[2]=rotw(r[2],1)^p+o+f[4*m+10]&MAXINT;r[3]=rotw(r[3]^p+2*o+f[4*m+11]&MAXINT,31);p=a(r[2]);o=b(r[3]);r[0]=rotw(r[0],1)^p+o+f[4*m+8]&MAXINT;r[1]=rotw(r[1]^p+2*o+f[4*m+9]&MAXINT,31)}setW(d,e,k[2]^f[0]);setW(d,e+4,k[3]^f[1]);setW(d,e+8,k[0]^f[2]);setW(d,e+12,k[1]^
+f[3]);e+=16},finalize:function(){return d}}}JXG={exists:function(a){return function(b){return!(b===a||null===b)}}()};JXG.decompress=function(a){return unescape((new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(a))).unzip()[0][0])};JXG.Util={};
+JXG.Util.Unzip=function(a){function b(){$+=8;return B>=1;0==C&&(C=b(),a=C&1,C=C>>1|128);return a}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=D[b]>>8-a);return b}function e(a){Q++;u[t++]=a;p.push(String.fromCharCode(a));32768==t&&(t=0)}function f(){this.b1=this.b0=0;this.jump=null;this.jumppos=-1}function h(){for(;;){if(W[N]>=qa)return-1;if(pa[W[N]]==N)return W[N]++;W[N]++}}function g(){var a=V[U],b;o&&document.write("
len:"+N+" treepos:"+
+U);if(17==N)return-1;U++;N++;b=h();o&&document.write("
IsPat "+b);if(0<=b)a.b0=b,o&&document.write("
b0 "+a.b0);else if(a.b0=32768,o&&document.write("
b0 "+a.b0),g())return-1;b=h();if(0<=b)a.b1=b,o&&document.write("
b1 "+a.b1),a.jump=null;else if(a.b1=32768,o&&document.write("
b1 "+a.b1),a.jump=V[U],a.jumppos=U,g())return-1;N--;return 0}function j(a,b,c,d){o&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show "+d);V=a;U=0;pa=c;qa=b;for(a=0;17>a;a++)W[a]=0;N=0;if(g())return o&&
alert("invalid huffman tree\n"),-1;if(o){document.write("
Tree: "+V.length);for(a=0;32>a;a++)document.write("Places["+a+"].b0="+V[a].b0+"
"),document.write("Places["+a+"].b1="+V[a].b1+"
")}return 0}function k(a){for(var b,d,e=0,f=a[e];;)if(b=c(),o&&document.write("b="+b),b){if(!(f.b1&32768))return o&&document.write("ret1"),f.b1;f=f.jump;b=a.length;for(d=0;d>1,23h)e(h);else if(256==h)break;else{var p;h-=257;m=d(K[h])+M[h];h=D[d(5)]>>3;8h;h++)r[h]=0;for(h=0;hdistanceTree");for(h=0;h"+P[h].b0+" "+P[h].b1+" "+P[h].jump+" "+P[h].jumppos)}m=g+p;l=0;var v=
--1;for(o&&document.write("
n="+m+" bits: "+$+"
");l"+v+" i:"+l+" decode: "+h+" bits "+$+"
"),16>h)r[l++]=h;else if(16==h){var x;h=3+d(2);if(l+h>m)return t=0,1;for(x=l?r[l-1]:0;h--;)r[l++]=x}else{h=17==h?3+d(3):11+d(7);if(l+h>m)return t=0,1;for(;h--;)r[l++]=0}m=aa.length;for(l=0;lliteralTree");
-a:for(;;)if(h=k(aa),256<=h){h-=256;if(0==h)break;h--;m=d(K[h])+M[h];h=k(P);8t-p)break a;g=u[t-p&32767];e(g)}}else e(h)}}while(!b);t=0;C=1;return 0}function m(){o&&alert("NEXTFILE");p=[];var b=[];E=!1;b[0]=a();b[1]=a();o&&alert("type: "+b[0]+" "+b[1]);120==b[0]&&218==b[1]&&(o&&alert("GEONExT-GZIP"),l(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="geonext.gxt",x++);120==b[0]&&156==b[1]&&(o&&alert("ZLIB"),l(),o&&alert(p.join("")),
-v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="ZLIB",x++);31==b[0]&&139==b[1]&&(o&&alert("GZIP"),r(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="file",x++);if(80==b[0]&&75==b[1]&&(E=!0,b[2]=a(),b[3]=a(),3==b[2]&&4==b[3])){b[0]=a();b[1]=a();o&&alert("ZIP-Version: "+b[1]+" "+b[0]/10+"."+b[0]%10);y=a();y|=a()<<8;o&&alert("gpflags: "+y);b=a();b|=a()<<8;o&&alert("method: "+b);a();a();a();a();var c=a(),c=c|a()<<8,c=c|a()<<16,c=c|a()<<24,d=a(),d=d|a()<<8,d=d|a()<<16,d=d|a()<<24,e=a(),e=e|a()<<
-8,e=e|a()<<16,e=e|a()<<24;o&&alert("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=a();c|=a()<<8;d=a();d|=a()<<8;o&&alert("filelen "+c);f=0;for(R=[];c--;)e=a(),"/"==e|":"==e?f=0:f>1,23g)e(g);else if(256==g)break;else{var p;g-=257;m=d(K[g])+M[g];g=D[d(5)]>>3;8g;g++)r[g]=0;for(g=0;gdistanceTree");for(g=0;g"+P[g].b0+" "+P[g].b1+" "+P[g].jump+" "+P[g].jumppos)}m=h+p;l=0;var v=
+-1;for(o&&document.write("
n="+m+" bits: "+$+"
");l"+v+" i:"+l+" decode: "+g+" bits "+$+"
"),16>g)r[l++]=g;else if(16==g){var x;g=3+d(2);if(l+g>m)return t=0,1;for(x=l?r[l-1]:0;g--;)r[l++]=x}else{g=17==g?3+d(3):11+d(7);if(l+g>m)return t=0,1;for(;g--;)r[l++]=0}m=aa.length;for(l=0;lliteralTree");
+a:for(;;)if(g=k(aa),256<=g){g-=256;if(0==g)break;g--;m=d(K[g])+M[g];g=k(P);8t-p)break a;h=u[t-p&32767];e(h)}}else e(g)}}while(!a);t=0;C=1;return 0}function m(){o&&alert("NEXTFILE");p=[];var a=[];E=!1;a[0]=b();a[1]=b();o&&alert("type: "+a[0]+" "+a[1]);120==a[0]&&218==a[1]&&(o&&alert("GEONExT-GZIP"),l(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="geonext.gxt",x++);120==a[0]&&156==a[1]&&(o&&alert("ZLIB"),l(),o&&alert(p.join("")),
+v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="ZLIB",x++);31==a[0]&&139==a[1]&&(o&&alert("GZIP"),r(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="file",x++);if(80==a[0]&&75==a[1]&&(E=!0,a[2]=b(),a[3]=b(),3==a[2]&&4==a[3])){a[0]=b();a[1]=b();o&&alert("ZIP-Version: "+a[1]+" "+a[0]/10+"."+a[0]%10);y=b();y|=b()<<8;o&&alert("gpflags: "+y);a=b();a|=b()<<8;o&&alert("method: "+a);b();b();b();b();var c=b(),c=c|b()<<8,c=c|b()<<16,c=c|b()<<24,d=b(),d=d|b()<<8,d=d|b()<<16,d=d|b()<<24,e=b(),e=e|b()<<
+8,e=e|b()<<16,e=e|b()<<24;o&&alert("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=b();c|=b()<<8;d=b();d|=b()<<8;o&&alert("filelen "+c);f=0;for(R=[];c--;)e=b(),"/"==e|":"==e?f=0:f>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,h=e&63,isNaN(d)?g=h=64:isNaN(e)&&(h=64),a.push([this._keyStr.charAt(f),this._keyStr.charAt(c),this._keyStr.charAt(g),this._keyStr.charAt(h)].join(""));return a.join("")},decode:function(b,a){for(var c=[],d,e,f,g,h,
-j=0,b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,e=(e&15)<<4|g>>2,f=(g&3)<<6|h,c.push(String.fromCharCode(d)),64!=g&&c.push(String.fromCharCode(e)),64!=h&&c.push(String.fromCharCode(f));c=c.join("");a&&(c=JXG.Util.Base64._utf8_decode(c));return c},_utf8_encode:function(b){for(var b=b.replace(/\r\n/g,"\n"),a="",c=0;cd?a+=String.fromCharCode(d):(127d?a+=String.fromCharCode(d>>6|192):(a+=String.fromCharCode(d>>12|224),a+=String.fromCharCode(d>>6&63|128)),a+=String.fromCharCode(d&63|128))}return a},_utf8_decode:function(b){for(var a=[],c=0,d=0,e=0,f=0;cd?(a.push(String.fromCharCode(d)),c++):191d?(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("")},_destrip:function(b,a){var c=[],d,e,f=[];null==a&&(a=76);b.replace(/ /g,"");d=b.length/a;for(e=0;e>2,c=(c&3)<<4|d>>4,h=(d&15)<<2|e>>6,g=e&63,isNaN(d)?h=g=64:isNaN(e)&&(g=64),b.push([this._keyStr.charAt(f),this._keyStr.charAt(c),this._keyStr.charAt(h),this._keyStr.charAt(g)].join(""));return b.join("")},decode:function(a,b){for(var c=[],d,e,f,h,g,
+j=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,e=(e&15)<<4|h>>2,f=(h&3)<<6|g,c.push(String.fromCharCode(d)),64!=h&&c.push(String.fromCharCode(e)),64!=g&&c.push(String.fromCharCode(f));c=c.join("");b&&(c=JXG.Util.Base64._utf8_decode(c));return c},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),b="",c=0;cd?b+=String.fromCharCode(d):(127d?b+=String.fromCharCode(d>>6|192):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128)),b+=String.fromCharCode(d&63|128))}return b},_utf8_decode:function(a){for(var b=[],c=0,d=0,e=0,f=0;cd?(b.push(String.fromCharCode(d)),c++):191d?(e=a.charCodeAt(c+1),b.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b.push(String.fromCharCode((d&15)<<12|
+(e&63)<<6|f&63)),c+=3);return b.join("")},_destrip:function(a,b){var c=[],d,e,f=[];null==b&&(b=76);a.replace(/ /g,"");d=a.length/b;for(e=0;ed?(a.push(String.fromCharCode(d)),c++):191d?(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("")};
-function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:8,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.20130427";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>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>6-e&255)),e=e+2&7,f=a<>16)+String.fromCharCode(b>>8&255)+String.fromCharCode(b&255);return openpgp_encoding_base64_encode(b)}function verifyCheckSum(b,a){var c=getCheckSum(b);return c[0]==a[0]&&c[1]==a[1]&&c[2]==a[2]}
+JXG.Util.utf8Decode=function(a){var b=[],c=0,d=0,e=0,f;if(!JXG.exists(a))return"";for(;cd?(b.push(String.fromCharCode(d)),c++):191d?(e=a.charCodeAt(c+1),b.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b.push(String.fromCharCode((d&15)<<12|(e&63)<<6|f&63)),c+=3);return b.join("")};
+JXG.Util.genUUID=function(){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d,e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")};
+function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:8,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.20130508";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var a=JSON.parse(window.localStorage.getItem("config"));null==a?(this.config=this.default_config,this.write()):this.config=a};this.write=function(){window.localStorage.setItem("config",
+JSON.stringify(this.config))}}var b64s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function s2r(a){var b,c,d,e="",f=0,h=0,g=a.length;for(d=0;d>2&63),b=(c&3)<<4):1==h?(e+=b64s.charAt(b|c>>4&15),b=(c&15)<<2):2==h&&(e+=b64s.charAt(b|c>>6&3),f+=1,0==f%60&&(e+="\n"),e+=b64s.charAt(c&63)),f+=1,0==f%60&&(e+="\n"),h+=1,3==h&&(h=0);0>6-e&255)),e=e+2&7,f=b<>16)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255);return openpgp_encoding_base64_encode(a)}function verifyCheckSum(a,b){var c=getCheckSum(a);return c[0]==b[0]&&c[1]==b[1]&&c[2]==b[2]}
var crc_table=[0,8801531,25875725,17603062,60024545,51751450,35206124,44007191,128024889,120049090,103502900,112007375,70412248,78916387,95990485,88014382,264588937,256049778,240098180,248108927,207005800,215016595,232553829,224014750,140824496,149062475,166599357,157832774,200747345,191980970,176028764,184266919,520933865,529177874,512099556,503334943,480196360,471432179,487973381,496217854,414011600,405478443,422020573,430033190,457094705,465107658,448029500,439496647,281648992,273666971,289622637,
298124950,324696449,333198714,315665548,307683447,392699481,401494690,383961940,375687087,352057528,343782467,359738805,368533838,1041867730,1050668841,1066628831,1058355748,1032471859,1024199112,1006669886,1015471301,968368875,960392720,942864358,951368477,975946762,984451313,1000411399,992435708,836562267,828023200,810956886,818967725,844041146,852051777,868605623,860066380,914189410,922427545,938981743,930215316,904825475,896059E3,878993294,887231349,555053627,563297984,547333942,538569677,579245274,
570480673,588005847,596249900,649392898,640860153,658384399,666397428,623318499,631331096,615366894,606833685,785398962,777416777,794487231,802989380,759421523,767923880,751374174,743392165,695319947,704115056,687564934,679289981,719477610,711202705,728272487,737067676,2083735460,2092239711,2109313705,2101337682,2141233477,2133257662,2116711496,2125215923,2073216669,2064943718,2048398224,2057199467,2013339772,2022141063,2039215473,2030942602,1945504045,1936737750,1920785440,1929023707,1885728716,
1893966647,1911503553,1902736954,1951893524,1959904495,1977441561,1968902626,2009362165,2000822798,1984871416,1992881923,1665111629,1673124534,1656046400,1647513531,1621913772,1613380695,1629922721,1637935450,1688082292,1679317903,1695859321,1704103554,1728967061,1737211246,1720132760,1711368291,1828378820,1820103743,1836060105,1844855090,1869168165,1877963486,1860430632,1852155859,1801148925,1809650950,1792118E3,1784135691,1757986588,1750004711,1765960209,1774462698,1110107254,1118611597,1134571899,
1126595968,1102643863,1094667884,1077139354,1085643617,1166763343,1158490548,1140961346,1149762745,1176011694,1184812885,1200772771,1192499800,1307552511,1298785796,1281720306,1289958153,1316768798,1325007077,1341561107,1332794856,1246636998,1254647613,1271201483,1262662192,1239272743,1230733788,1213667370,1221678289,1562785183,1570797924,1554833554,1546300521,1588974462,1580441477,1597965939,1605978760,1518843046,1510078557,1527603627,1535847760,1494504007,1502748348,1486784330,1478020017,1390639894,
1382365165,1399434779,1408230112,1366334967,1375129868,1358579962,1350304769,1430452783,1438955220,1422405410,1414423513,1456544974,1448562741,1465633219,1474135352];
-function createcrc24(b){for(var a=11994318,c=0;16>16^b.charCodeAt(c))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+1))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+2))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+3))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+4))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+5))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+6))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+7))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+8))&255],a=a<<8^crc_table[(a>>
-16^b.charCodeAt(c+9))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+10))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+11))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+12))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+13))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+14))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+15))&255],c+=16;for(var d=c;d>16^b.charCodeAt(c++))&255];return a&16777215}function openpgp_encoding_base64_encode(b){return s2r(b)}
-function openpgp_encoding_base64_decode(b){return r2s(b)}function openpgp_encoding_eme_pkcs1_encode(b,a){if(b.length>a-11)return-1;var c;c=""+String.fromCharCode(0);c+=String.fromCharCode(2);for(var d=0;db.length||0!=b.charCodeAt(0)||2!=b.charCodeAt(1))return-1;for(var c=2;0!=b.charCodeAt(c)&&b.length>c;)c++;return b.substring(c+1,b.length)}hash_headers=[,[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20]];hash_headers[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32];
+function createcrc24(a){for(var b=11994318,c=0;16>16^a.charCodeAt(c))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+1))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+2))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+3))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+4))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+5))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+6))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+7))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+8))&255],b=b<<8^crc_table[(b>>
+16^a.charCodeAt(c+9))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+10))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+11))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+12))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+13))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+14))&255],b=b<<8^crc_table[(b>>16^a.charCodeAt(c+15))&255],c+=16;for(var d=c;d>16^a.charCodeAt(c++))&255];return b&16777215}function openpgp_encoding_base64_encode(a){return s2r(a)}
+function openpgp_encoding_base64_decode(a){return r2s(a)}function openpgp_encoding_eme_pkcs1_encode(a,b){if(a.length>b-11)return-1;var c;c=""+String.fromCharCode(0);c+=String.fromCharCode(2);for(var d=0;da.length||0!=a.charCodeAt(0)||2!=a.charCodeAt(1))return-1;for(var c=2;0!=a.charCodeAt(c)&&a.length>c;)c++;return a.substring(c+1,a.length)}hash_headers=[,[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20]];hash_headers[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32];
hash_headers[9]=[48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48];hash_headers[10]=[48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64];hash_headers[11]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28];
-function openpgp_encoding_emsa_pkcs1_encode(b,a,c){var d;d=""+String.fromCharCode(0);d+=String.fromCharCode(1);for(var e=0;ej.signatureType||3==j.tagType||4==j.tagType||8==j.tagType||9==j.tagType||10==j.tagType||11==j.tagType||18==j.tagType||19==j.tagType)if(e[e.length]=new openpgp_msg_message,e[f].messagePacket=j,e[f].type=a.type,9==j.tagType||1==j.tagType||3==j.tagType||18==j.tagType)if(9==j.tagType){util.print_error("unexpected openpgp packet");
-break}else if(1==j.tagType){util.print_debug("session key found:\n "+j.toString());var k=!0;e[f].sessionKeys=[];for(var l=0;k;)e[f].sessionKeys[l]=j,g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,j=openpgp_packet.read_packet(b,g,h),1!=j.tagType&&3!=j.tagType&&(k=!1),l++;18==j.tagType||9==j.tagType?(util.print_debug("encrypted data found:\n "+j.toString()),e[f].encryptedData=j,g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,f++):util.print_debug("something is wrong: "+
-j.tagType)}else{if(18==j.tagType){util.print_debug("symmetric encrypted data");break}}else 2==j.tagType&&3>j.signatureType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,e[f].text=d,e[f].signature=j,f++):4==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength):8==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,j=j.decompress(),e=e.concat(openpgp.read_messages_dearmored({text:j,openpgp:j}))):10==j.tagType?(e.length=0,g+=j.packetLength+
-j.headerLength,h-=j.packetLength+j.headerLength):11==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,d=j.data,e[f].data=j.data,f++):19==j.tagType&&(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength);else return util.print_error("no message found!"),null}return e}this.tostring="";this.generate_key_pair=function(a,b,d,e){var f=(new openpgp_packet_userid).write_packet(d),b=openpgp_crypto_generateKeyPair(a,b,e,openpgp.config.config.prefer_hash_algorithm,3),
-a=b.privateKey,g=(new openpgp_packet_keymaterial).read_priv_key(a.string,3,a.string.length);g.decryptSecretMPIs(e)||util.print_error("Issue creating key. Unable to read resulting private key");e=new openpgp_msg_privatekey;e.privateKeyPacket=g;e.getPreferredSignatureHashAlgorithm=function(){return openpgp.config.config.prefer_hash_algorithm};g=e.privateKeyPacket.publicKey.data;g=String.fromCharCode(153)+String.fromCharCode(g.length>>8&255)+String.fromCharCode(g.length&255)+g+String.fromCharCode(180)+
-String.fromCharCode(d.length>>24)+String.fromCharCode(d.length>>16&255)+String.fromCharCode(d.length>>8&255)+String.fromCharCode(d.length&255)+d;d=new openpgp_packet_signature;d=d.write_message_signature(16,g,e);b=openpgp_encoding_armor(4,b.publicKey.string+f+d.openpgp);f=openpgp_encoding_armor(5,a.string+f+d.openpgp);return{privateKey:e,privateKeyArmored:f,publicKeyArmored:b}};this.write_signed_message=function(a,b){var d=(new openpgp_packet_signature).write_message_signature(1,b.replace(/\r\n/g,
-"\n").replace(/\n/,"\r\n"),a),d={text:b.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"),openpgp:d.openpgp,hash:d.hash};return openpgp_encoding_armor(2,d,null,null)};this.write_signed_and_encrypted_message=function(a,b,d){var e="",f=(new openpgp_packet_literaldata).write_packet(d.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"));util.print_debug_hexstr_dump("literal_packet: |"+f+"|\n",f);for(var g=0;gj.signatureType||3==j.tagType||4==j.tagType||8==j.tagType||9==j.tagType||10==j.tagType||11==j.tagType||18==j.tagType||19==j.tagType)if(e[e.length]=new openpgp_msg_message,e[f].messagePacket=j,e[f].type=a.type,9==j.tagType||1==j.tagType||3==j.tagType||18==j.tagType)if(9==j.tagType){util.print_error("unexpected openpgp packet");
+break}else if(1==j.tagType){util.print_debug("session key found:\n "+j.toString());var k=!0;e[f].sessionKeys=[];for(var l=0;k;)e[f].sessionKeys[l]=j,h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength,j=openpgp_packet.read_packet(c,h,g),1!=j.tagType&&3!=j.tagType&&(k=!1),l++;18==j.tagType||9==j.tagType?(util.print_debug("encrypted data found:\n "+j.toString()),e[f].encryptedData=j,h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength,f++):util.print_debug("something is wrong: "+
+j.tagType)}else{if(18==j.tagType){util.print_debug("symmetric encrypted data");break}}else 2==j.tagType&&3>j.signatureType?(h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength,e[f].text=d,e[f].signature=j,f++):4==j.tagType?(h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength):8==j.tagType?(h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength,j=j.decompress(),e=e.concat(openpgp.read_messages_dearmored({text:j,openpgp:j}))):10==j.tagType?(e.length=0,h+=j.packetLength+
+j.headerLength,g-=j.packetLength+j.headerLength):11==j.tagType?(h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength,d=j.data,e[f].data=j.data,f++):19==j.tagType&&(h+=j.packetLength+j.headerLength,g-=j.packetLength+j.headerLength);else return util.print_error("no message found!"),null}return e}this.tostring="";this.generate_key_pair=function(a,c,d,e){var f=(new openpgp_packet_userid).write_packet(d),c=openpgp_crypto_generateKeyPair(a,c,e,openpgp.config.config.prefer_hash_algorithm,3),
+a=c.privateKey,h=(new openpgp_packet_keymaterial).read_priv_key(a.string,3,a.string.length);h.decryptSecretMPIs(e)||util.print_error("Issue creating key. Unable to read resulting private key");e=new openpgp_msg_privatekey;e.privateKeyPacket=h;e.getPreferredSignatureHashAlgorithm=function(){return openpgp.config.config.prefer_hash_algorithm};h=e.privateKeyPacket.publicKey.data;h=String.fromCharCode(153)+String.fromCharCode(h.length>>8&255)+String.fromCharCode(h.length&255)+h+String.fromCharCode(180)+
+String.fromCharCode(d.length>>24)+String.fromCharCode(d.length>>16&255)+String.fromCharCode(d.length>>8&255)+String.fromCharCode(d.length&255)+d;d=new openpgp_packet_signature;d=d.write_message_signature(16,h,e);c=openpgp_encoding_armor(4,c.publicKey.string+f+d.openpgp);f=openpgp_encoding_armor(5,a.string+f+d.openpgp);return{privateKey:e,privateKeyArmored:f,publicKeyArmored:c}};this.write_signed_message=function(a,c){var d=(new openpgp_packet_signature).write_message_signature(1,c.replace(/\r\n/g,
+"\n").replace(/\n/,"\r\n"),a),d={text:c.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"),openpgp:d.openpgp,hash:d.hash};return openpgp_encoding_armor(2,d,null,null)};this.write_signed_and_encrypted_message=function(a,c,d){var e="",f=(new openpgp_packet_literaldata).write_packet(d.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"));util.print_debug_hexstr_dump("literal_packet: |"+f+"|\n",f);for(var h=0;h")[0]:
-b.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return a;for(b=0;b")[0]:b.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return a;for(b=0;b
-b;){var e=openpgp_packet.read_packet(a,b,a.length-b);if(null==e){util.print_error("openpgp.msg.messge decrypt:\n[pub/priv_key]parsing ends here @:"+b+" l:"+d);break}else switch(e.tagType){case 2:if(32==e.signatureType)this.revocationSignatures[this.revocationSignatures.length]=e;else if(15e.signatureType){if(null==this.certificationsignatures)this.certificationSignatures=[];this.certificationSignatures[this.certificationSignatures.length]=e}else util.print_error("openpgp.msg.messge decrypt:\nunknown signature type directly on key "+
-e.signatureType+" @"+b);b+=e.packetLength+e.headerLength;break;case 7:this.subKeys[this.subKeys.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;case 17:this.userAttributes[this.userAttributes.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;case 13:this.userIds[this.userIds.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;default:return this.position=
-c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength,this.len=b-c}}this.position=c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength;return this.len=b-c};this.decryptSecretMPIs=function(b){return this.privateKeyPacket.decryptSecretMPIs(b)};this.getSubKeyIds=function(){if(4==this.privateKeyPacket.publicKey.version)var b=[];for(var a=0;a")[0]:
+a.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return b;for(a=0;a")[0]:a.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return b;for(a=0;a
+a;){var e=openpgp_packet.read_packet(b,a,b.length-a);if(null==e){util.print_error("openpgp.msg.messge decrypt:\n[pub/priv_key]parsing ends here @:"+a+" l:"+d);break}else switch(e.tagType){case 2:if(32==e.signatureType)this.revocationSignatures[this.revocationSignatures.length]=e;else if(15e.signatureType){if(null==this.certificationsignatures)this.certificationSignatures=[];this.certificationSignatures[this.certificationSignatures.length]=e}else util.print_error("openpgp.msg.messge decrypt:\nunknown signature type directly on key "+
+e.signatureType+" @"+a);a+=e.packetLength+e.headerLength;break;case 7:this.subKeys[this.subKeys.length]=e;a+=e.packetLength+e.headerLength;a+=e.read_nodes(this.privateKeyPacket,b,a,b.length-a);break;case 17:this.userAttributes[this.userAttributes.length]=e;a+=e.packetLength+e.headerLength;a+=e.read_nodes(this.privateKeyPacket,b,a,b.length-a);break;case 13:this.userIds[this.userIds.length]=e;a+=e.packetLength+e.headerLength;a+=e.read_nodes(this.privateKeyPacket,b,a,b.length-a);break;default:return this.position=
+c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength,this.len=a-c}}this.position=c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength;return this.len=a-c};this.decryptSecretMPIs=function(a){return this.privateKeyPacket.decryptSecretMPIs(a)};this.getSubKeyIds=function(){if(4==this.privateKeyPacket.publicKey.version)var a=[];for(var b=0;bd&&util.print_debug("openpgp.packet.signature.js\n_raw_read_signature_sub_packet length < 0 @:"+b);var e=b,f=0;192>a[e].charCodeAt()?f=a[e++].charCodeAt():192<=a[e].charCodeAt()&&224>a[e].charCodeAt()?f=(a[e++].charCodeAt()-192<<8)+a[e++].charCodeAt()+192:223a[e].charCodeAt()?f=1<<(a[e++].charCodeAt()&31):255>a[e].charCodeAt()&&(e++,f=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<
-8|a[e++].charCodeAt());var g=a[e++].charCodeAt()&127;switch(g){case 2:this.creationTime=new Date(1E3*(a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt()));break;case 3:this.signatureExpirationTime=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();this.signatureNeverExpires=0==this.signature_expiration_time;break;case 4:this.exportable=1==a[e++].charCodeAt();break;case 5:this.trustLevel=a[e++].charCodeAt();this.trustAmount=
-a[e++].charCodeAt();break;case 6:this.regular_expression=new String;for(g=0;gg;g++)this.revocationKeyFingerprint=a[e++].charCodeAt();break;case 16:this.issuerKeyId=a.substring(e,e+8);e+=8;break;case 20:this.notationFlags=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();d=a[e++].charCodeAt()<<8|a[e++].charCodeAt();f=a[e++].charCodeAt()<<8|a[e++].charCodeAt();this.notationName="";for(g=0;g>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)),h=b(16,d.getKeyId()),g=g+String.fromCharCode(a.length+h.length>>8&255),g=g+String.fromCharCode(a.length+h.length&255),g=g+a+h,a=""+String.fromCharCode(4),a=a+String.fromCharCode(255),a=a+String.fromCharCode(g.length>>24),a=a+String.fromCharCode(g.length>>16&255),a=a+String.fromCharCode(g.length>>8&255),a=a+String.fromCharCode(g.length&255),h=String.fromCharCode(0),
-h=h+String.fromCharCode(0),j=openpgp_crypto_hashData(f,c+g+a);util.print_debug("DSA Signature is calculated with:|"+c+g+a+"|\n"+util.hexstrdump(c+g+a)+"\n hash:"+util.hexstrdump(j));h+=j.charAt(0);h+=j.charAt(1);h+=openpgp_crypto_signData(f,d.privateKeyPacket.publicKey.publicKeyAlgorithm,e.MPIs,d.privateKeyPacket.secMPIs,c+g+a);return{openpgp:openpgp_packet.write_packet_header(2,(g+h).length)+g+h,hash:util.get_hashAlgorithmString(f)}};this.verify=function(a,b){var d;d=""+String.fromCharCode(this.version);
-d+=String.fromCharCode(255);d+=String.fromCharCode(this.signatureData.length>>24);d+=String.fromCharCode(this.signatureData.length>>16&255);d+=String.fromCharCode(this.signatureData.length>>8&255);d+=String.fromCharCode(this.signatureData.length&255);switch(this.signatureType){case 0:if(4==this.version)this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,a+this.signatureData+d);break;case 1:if(4==this.version){this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
-this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,a+this.signatureData+d);break}break;case 2:if(3==this.version){this.verified=!1;break}this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,this.signatureData+d);break;case 16:case 17:case 18:case 19:case 48:this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;case 24:if(3==this.version){this.verified=
-!1;break}this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;case 25:case 31:case 32:case 40:this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;default:util.print_error("openpgp.packet.signature.js\nsignature verification for type"+this.signatureType+" not implemented")}return this.verified};this.read_packet=function(a,b,d){this.data=
-a.substring(b,b+d);if(0>d)return util.print_debug("openpgp.packet.signature.js\nopenpgp_packet_signature read_packet length < 0 @:"+b),null;var e=b;this.packetLength=d;this.version=a[e++].charCodeAt();switch(this.version){case 3:5!=a[e++].charCodeAt()&&util.print_debug("openpgp.packet.signature.js\ninvalid One-octet length of following hashed material. MUST be 5. @:"+(e-1));this.signatureType=a[e++].charCodeAt();this.creationTime=new Date(1E3*(a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<
-8|a[e++].charCodeAt()));this.signatureData=a.substring(b,e);this.keyId=a.substring(e,e+8);e+=8;this.publicKeyAlgorithm=a[e++].charCodeAt();this.hashAlgorithm=a[e++].charCodeAt();this.signedHashValue=a[e++].charCodeAt()<<8|a[e++].charCodeAt();d=0;0this.publicKeyAlgorithm?d=1:17==this.publicKeyAlgorithm&&(d=2);this.MPIs=[];for(var f=0;fthis.publicKeyAlgorithm?d=1:17==this.publicKeyAlgorithm&&(d=2);this.MPIs=[];for(f=0;fb[a].charCodeAt()?(packet_length=b[a++].charCodeAt(),c=1):192<=b[a].charCodeAt()&&224>b[a].charCodeAt()?(packet_length=(b[a++].charCodeAt()-192<<8)+b[a++].charCodeAt()+192,c=2):223b[a].charCodeAt()?(packet_length=1<<(b[a++].charCodeAt()&
-31),c=1):(c=5,a++,packet_length=b[a++].charCodeAt()<<24|b[a++].charCodeAt()<<16|b[a++].charCodeAt()<<8|b[a++].charCodeAt());b[a++].charCodeAt();packet_length--;c++;this.userattributes[0]=[];this.userattributes[0]=b.substring(a,a+0);a+=packet_length;total_len+=c+0}return this};this.read_packet=read_packet;this.read_nodes=function(b,a,c,d){this.parentNode=b;for(var e=c,f=d;a.length!=e;){var g=openpgp_packet.read_packet(a,e,f);if(null==g){util.print_error("openpgp.packet.userattribute.js\n[user_attr] parsing ends here @:"+
-e+" l:"+f);break}else switch(g.tagType){case 2:15g.signatureType?this.certificationSignatures[this.certificationSignatures.length]=g:32==g.signatureType&&(this.certificationRevocationSignatures[this.certificationRevocationSignatures.length]=g);e+=g.packetLength+g.headerLength;f=d-(e-c);break;default:return this.data=a,this.position=c-b.packetLength,this.len=e-c}}this.data=a;this.position=c-b.packetLength;return this.len=e-c};this.toString=function(){for(var b="5.12. User Attribute Packet (Tag 17)\n AttributePackets: (count = "+
-this.userattributes.length+")\n",a=0;aa?b+=String.fromCharCode(a):191a?(b+=String.fromCharCode((a-192>>8)+192),b+=String.fromCharCode(a-192&255)):(b+=String.fromCharCode(255),b+=String.fromCharCode(a>>24&255),b+=String.fromCharCode(a>>16&255),b+=String.fromCharCode(a>>8&255),b+=String.fromCharCode(a&255));return b}this.encode_length=b;this.write_old_packet_header=function(a,b){var d="";256>b?(d+=String.fromCharCode(128|a<<2),d+=String.fromCharCode(b)):(65536>b?(d+=String.fromCharCode(a<<
-2|129),d+=String.fromCharCode(b>>8)):(d+=String.fromCharCode(a<<2|130),d+=String.fromCharCode(b>>24&255),d+=String.fromCharCode(b>>16&255),d+=String.fromCharCode(b>>8&255)),d+=String.fromCharCode(b&255));return d};this.write_packet_header=function(a,c){var d;d=""+String.fromCharCode(192|a);return d+=b(c)};this.read_packet=function(a,b,d){if(null==a||a.length<=b||2>a.substring(b).length||0==(a[b].charCodeAt()&128))return util.print_error("Error during parsing. This message / key is probably not containing a valid OpenPGP format."),
-null;var e=-1,f=-1,f=0;0!=(a[b].charCodeAt()&64)&&(f=1);var g;f?e=a[b].charCodeAt()&63:(e=(a[b].charCodeAt()&63)>>2,g=a[b].charCodeAt()&3);b++;var h=null,j=-1;if(f)if(192>a[b].charCodeAt())d=a[b++].charCodeAt(),util.print_debug("1 byte length:"+d);else if(192<=a[b].charCodeAt()&&224>a[b].charCodeAt())d=(a[b++].charCodeAt()-192<<8)+a[b++].charCodeAt()+192,util.print_debug("2 byte length:"+d);else if(223a[b].charCodeAt()){d=1<<(a[b++].charCodeAt()&31);util.print_debug("4 byte length:"+
-d);j=b+d;for(h=a.substring(b,b+d);;)if(192>a[j].charCodeAt()){g=a[j++].charCodeAt();d+=g;h+=a.substring(j,j+g);j+=g;break}else if(192<=a[j].charCodeAt()&&224>a[j].charCodeAt()){g=(a[j++].charCodeAt()-192<<8)+a[j++].charCodeAt()+192;d+=g;h+=a.substring(j,j+g);j+=g;break}else if(223a[j].charCodeAt())g=1<<(a[j++].charCodeAt()&31),d+=g,h+=a.substring(j,j+g),j+=g;else{j++;g=a[j++].charCodeAt()<<24|a[j++].charCodeAt()<<16|a[j++].charCodeAt()<<8|a[j++].charCodeAt();h+=a.substring(j,
-j+g);d+=g;j+=g;break}}else b++,d=a[b++].charCodeAt()<<24|a[b++].charCodeAt()<<16|a[b++].charCodeAt()<<8|a[b++].charCodeAt();else switch(g){case 0:d=a[b++].charCodeAt();break;case 1:d=a[b++].charCodeAt()<<8|a[b++].charCodeAt();break;case 2:d=a[b++].charCodeAt()<<24|a[b++].charCodeAt()<<16|a[b++].charCodeAt()<<8|a[b++].charCodeAt();break}-1==j&&(j=d);null==h&&(h=a.substring(b,b+j));var a={},k;for(k in this.type)a[this.type[k]]=k;k="openpgp_packet_"+a[e];a=window[k];if(void 0==a)throw k;k=new a;k.read(h);
-return{packet:k,offset:b+j}};this.type={reserved:0,public_key_encrypted_session_key:1,signature:2,sym_encrypted_session_key:3,one_pass_signature:4,secret_key:5,public_key:6,secret_subkey:7,compressed:8,symmetrically_encrypted:9,marker:10,literal:11,trust:12,userid:13,public_subkey:14,user_attribute:17,sym_encrypted_integrity_protected:18,modification_detection_code:19}}var openpgp_packet=new _openpgp_packet;
-function openpgp_packetlist(){this.length=0;this.read=function(b){for(var a=0;ab.length)return util.print_error("openpgp.packet.encryptedsessionkey.js\ninvalid length"),null;this.version=b[0].charCodeAt();this.public_key_id.read_packet(b,1);this.public_key_algorithm=b[9].charCodeAt();
-var a=10;switch(this.public_key_algorithm){case openpgp.publickey.rsa_encrypt:case openpgp.publickey.rsa_encrypt_sign:this.encrypted=[];this.encrypted[0]=new openpgp_type_mpi;this.encrypted[0].read(b.substr(a));break;case openpgp.publickey.elgamal:this.encrypted=[];this.encrypted[0]=new openpgp_type_mpi;a+=this.encrypted[0].read(b.substr(a));this.encrypted[1]=new openpgp_type_mpi;this.encrypted[1].read(b.substr(a));break;default:util.print_error("openpgp.packet.encryptedsessionkey.js\nunknown public key packet algorithm type "+
-this.public_key_algorithm)}};this.write=function(){for(var b=String.fromCharCode(this.version),b=b+this.public_key_id.bytes,b=b+String.fromCharCode(this.public_key_algorithm),a=0;a>8&255),a=a+String.fromCharCode(c&255),c=new openpgp_type_mpi;c.fromBytes(openpgp_encoding_eme_pkcs1_encode(a,
-b[0].byteLength()));this.encrypted=openpgp_crypto_asymetricEncrypt(this.public_key_algorithm,b,c)};this.decrypt=function(b,a){var c=openpgp_crypto_asymetricDecrypt(this.public_key_algorithm,b,a,this.encrypted).toBytes(),d=(c.charCodeAt(c.length-2)<<8)+c.charCodeAt(c.length-1),c=openpgp_encoding_eme_pkcs1_decode(c,b[0].byteLength()),e=c.substring(1,c.length-2);d!=util.calc_checksum(e)?util.print_error("Checksum mismatch"):(this.symmetric_key=e,this.symmetric_algorithm=c.charCodeAt(0))};this.toString=
-function(){for(var b="5.1. Public-Key Encrypted Session Key Packets (Tag 1)\n KeyId: "+this.keyId.toString()+"\n length: "+this.packetLength+"\n version:"+this.version+"\n pubAlgUs:"+this.publicKeyAlgorithmUsed+"\n",a=0;athis.algorithm?2:16==this.algorithm?3:17==this.algorithm?4:0;this.mpi=[];for(var b=b.substr(6),c=0,d=0;db.length&&util.print_error("openpgp.packet.keymaterial.js\nerror reading MPI @:"+c);return c+6}util.print_error("Unknown packet version")}};this.write=function(){var b=String.fromCharCode(4),b=b+openpgp_packet_time_write(this.created),b=b+String.fromCharCode(this.algorithm),a;for(a in this.mpi)b+=this.mpi[a].write();return b}}function openpgp_packet_public_subkey(){openpgp_packet_public_key.call(this);this.tag=14}
-function openpgp_packet_secret_key(){function b(a){return a==openpgp.hash.sha1?str_sha1:function(a){return openpgp_packet_number_write(util.calc_checksum(a),2)}}function a(a,d,e){var f=a==openpgp.hash.sha1?20:2,a=b(a),g=d.substr(d.length-f),d=d.substr(0,d.length-f);if(a(d)!=g)throw"Hash mismatch!";e=openpgp_crypto_getPrivateMpiCount(e);f=0;a=[];for(g=0;ga[b].charCodeAt()?(packet_length=a[b++].charCodeAt(),c=1):192<=a[b].charCodeAt()&&224>a[b].charCodeAt()?(packet_length=(a[b++].charCodeAt()-192<<8)+a[b++].charCodeAt()+192,c=2):223a[b].charCodeAt()?(packet_length=1<<(a[b++].charCodeAt()&
+31),c=1):(c=5,b++,packet_length=a[b++].charCodeAt()<<24|a[b++].charCodeAt()<<16|a[b++].charCodeAt()<<8|a[b++].charCodeAt());a[b++].charCodeAt();packet_length--;c++;this.userattributes[0]=[];this.userattributes[0]=a.substring(b,b+0);b+=packet_length;total_len+=c+0}return this};this.read_packet=read_packet;this.read_nodes=function(a,b,c,d){this.parentNode=a;for(var e=c,f=d;b.length!=e;){var h=openpgp_packet.read_packet(b,e,f);if(null==h){util.print_error("openpgp.packet.userattribute.js\n[user_attr] parsing ends here @:"+
+e+" l:"+f);break}else switch(h.tagType){case 2:15h.signatureType?this.certificationSignatures[this.certificationSignatures.length]=h:32==h.signatureType&&(this.certificationRevocationSignatures[this.certificationRevocationSignatures.length]=h);e+=h.packetLength+h.headerLength;f=d-(e-c);break;default:return this.data=b,this.position=c-a.packetLength,this.len=e-c}}this.data=b;this.position=c-a.packetLength;return this.len=e-c};this.toString=function(){for(var a="5.12. User Attribute Packet (Tag 17)\n AttributePackets: (count = "+
+this.userattributes.length+")\n",b=0;bd?(b=a[0].charCodeAt(),c=1):255>d?(b=(a[0].charCodeAt()-192<<8)+a[1].charCodeAt()+192,c=2):255==d&&(b=openpgp_packet_integer_read(a.substr(1,4)),c=5);return{len:b,offset:c}};this.encode_length=function(a){var b="";192>a?b+=String.fromCharCode(a):191a?(b+=String.fromCharCode((a-192>>8)+192),b+=String.fromCharCode(a-192&255)):(b+=String.fromCharCode(255),b+=String.fromCharCode(a>>24&255),b+=String.fromCharCode(a>>
+16&255),b+=String.fromCharCode(a>>8&255),b+=String.fromCharCode(a&255));return b};this.write_old_packet_header=function(a,b){var c="";256>b?(c+=String.fromCharCode(128|a<<2),c+=String.fromCharCode(b)):(65536>b?(c+=String.fromCharCode(a<<2|129),c+=String.fromCharCode(b>>8)):(c+=String.fromCharCode(a<<2|130),c+=String.fromCharCode(b>>24&255),c+=String.fromCharCode(b>>16&255),c+=String.fromCharCode(b>>8&255)),c+=String.fromCharCode(b&255));return c};this.write_packet_header=function(a,b){var c;c=""+
+String.fromCharCode(192|a);return c+=this.encode_length(b)};this.read_packet=function(a,b,c){if(null==a||a.length<=b||2>a.substring(b).length||0==(a[b].charCodeAt()&128))return util.print_error("Error during parsing. This message / key is probably not containing a valid OpenPGP format."),null;var d=-1,e=-1,e=0;0!=(a[b].charCodeAt()&64)&&(e=1);var f;e?d=a[b].charCodeAt()&63:(d=(a[b].charCodeAt()&63)>>2,f=a[b].charCodeAt()&3);b++;var h=null,g=-1;if(e)if(192>a[b].charCodeAt())c=a[b++].charCodeAt(),util.print_debug("1 byte length:"+
+c);else if(192<=a[b].charCodeAt()&&224>a[b].charCodeAt())c=(a[b++].charCodeAt()-192<<8)+a[b++].charCodeAt()+192,util.print_debug("2 byte length:"+c);else if(223a[b].charCodeAt()){c=1<<(a[b++].charCodeAt()&31);util.print_debug("4 byte length:"+c);g=b+c;for(h=a.substring(b,b+c);;)if(192>a[g].charCodeAt()){f=a[g++].charCodeAt();c+=f;h+=a.substring(g,g+f);g+=f;break}else if(192<=a[g].charCodeAt()&&224>a[g].charCodeAt()){f=(a[g++].charCodeAt()-192<<8)+a[g++].charCodeAt()+192;c+=
+f;h+=a.substring(g,g+f);g+=f;break}else if(223a[g].charCodeAt())f=1<<(a[g++].charCodeAt()&31),c+=f,h+=a.substring(g,g+f),g+=f;else{g++;f=a[g++].charCodeAt()<<24|a[g++].charCodeAt()<<16|a[g++].charCodeAt()<<8|a[g++].charCodeAt();h+=a.substring(g,g+f);c+=f;g+=f;break}}else b++,c=a[b++].charCodeAt()<<24|a[b++].charCodeAt()<<16|a[b++].charCodeAt()<<8|a[b++].charCodeAt();else switch(f){case 0:c=a[b++].charCodeAt();break;case 1:c=a[b++].charCodeAt()<<8|a[b++].charCodeAt();break;
+case 2:c=a[b++].charCodeAt()<<24|a[b++].charCodeAt()<<16|a[b++].charCodeAt()<<8|a[b++].charCodeAt();break}-1==g&&(g=c);null==h&&(h=a.substring(b,b+g));var a={},j;for(j in this.type)a[this.type[j]]=j;j="openpgp_packet_"+a[d];a=window[j];if(void 0==a)throw j;j=new a;j.read(h);return{packet:j,offset:b+g}};this.type={reserved:0,public_key_encrypted_session_key:1,signature:2,sym_encrypted_session_key:3,one_pass_signature:4,secret_key:5,public_key:6,secret_subkey:7,compressed:8,symmetrically_encrypted:9,
+marker:10,literal:11,trust:12,userid:13,public_subkey:14,user_attribute:17,sym_encrypted_integrity_protected:18,modification_detection_code:19}}var openpgp_packet=new _openpgp_packet;
+function openpgp_packetlist(){this.length=0;this.read=function(a){for(var b=0;ba.length)return util.print_error("openpgp.packet.encryptedsessionkey.js\ninvalid length"),null;this.version=a[0].charCodeAt();this.public_key_id.read_packet(a,1);this.public_key_algorithm=a[9].charCodeAt();
+var b=10;switch(this.public_key_algorithm){case openpgp.publickey.rsa_encrypt:case openpgp.publickey.rsa_encrypt_sign:this.encrypted=[];this.encrypted[0]=new openpgp_type_mpi;this.encrypted[0].read(a.substr(b));break;case openpgp.publickey.elgamal:this.encrypted=[];this.encrypted[0]=new openpgp_type_mpi;b+=this.encrypted[0].read(a.substr(b));this.encrypted[1]=new openpgp_type_mpi;this.encrypted[1].read(a.substr(b));break;default:util.print_error("openpgp.packet.encryptedsessionkey.js\nunknown public key packet algorithm type "+
+this.public_key_algorithm)}};this.write=function(){for(var a=String.fromCharCode(this.version),a=a+this.public_key_id.bytes,a=a+String.fromCharCode(this.public_key_algorithm),b=0;b>8&255),b=b+String.fromCharCode(c&255),c=new openpgp_type_mpi;c.fromBytes(openpgp_encoding_eme_pkcs1_encode(b,
+a[0].byteLength()));this.encrypted=openpgp_crypto_asymetricEncrypt(this.public_key_algorithm,a,c)};this.decrypt=function(a,b){var c=openpgp_crypto_asymetricDecrypt(this.public_key_algorithm,a,b,this.encrypted).toBytes(),d=(c.charCodeAt(c.length-2)<<8)+c.charCodeAt(c.length-1),c=openpgp_encoding_eme_pkcs1_decode(c,a[0].byteLength()),e=c.substring(1,c.length-2);d!=util.calc_checksum(e)?util.print_error("Checksum mismatch"):(this.symmetric_key=e,this.symmetric_algorithm=c.charCodeAt(0))};this.toString=
+function(){for(var a="5.1. Public-Key Encrypted Session Key Packets (Tag 1)\n KeyId: "+this.keyId.toString()+"\n length: "+this.packetLength+"\n version:"+this.version+"\n pubAlgUs:"+this.publicKeyAlgorithmUsed+"\n",b=0;bthis.algorithm?2:16==this.algorithm?3:17==this.algorithm?4:0;this.mpi=[];for(var a=a.substr(6),c=0,d=0;da.length&&util.print_error("openpgp.packet.keymaterial.js\nerror reading MPI @:"+c);return c+6}util.print_error("Unknown packet version")}};this.write=function(){var a=String.fromCharCode(4),a=a+openpgp_packet_time_write(this.created),a=a+String.fromCharCode(this.algorithm),b;for(b in this.mpi)a+=this.mpi[b].write();return a}}function openpgp_packet_public_subkey(){openpgp_packet_public_key.call(this);this.tag=14}
+function openpgp_packet_secret_key(){function a(a){return a==openpgp.hash.sha1?str_sha1:function(a){return openpgp_packet_number_write(util.calc_checksum(a),2)}}function b(b,d,e){var f=b==openpgp.hash.sha1?20:2,b=a(b),h=d.substr(d.length-f),d=d.substr(0,d.length-f);if(b(d)!=h)throw"Hash mismatch!";e=openpgp_crypto_getPrivateMpiCount(e);f=0;b=[];for(h=0;hthis.publicKeyAlgorithm?c=1:17==this.publicKeyAlgorithm&&(c=2);this.mpi=[];for(var d=0;d