diff --git a/resources/openpgp.js b/resources/openpgp.js index d1458166..da86a4cb 100644 --- a/resources/openpgp.js +++ b/resources/openpgp.js @@ -1072,6 +1072,11 @@ function openpgp_packet_encryptedintegrityprotecteddata() { } function toString() { + var data = ''; + if(openpgp.config.debug) + data = ' data: Bytes [' + + util.hexstrdump(this.encryptedData) + ']'; + return '5.13. Sym. Encrypted Integrity Protected Data Packet (Tag 18)\n' + ' length: ' + this.packetLength @@ -1079,8 +1084,7 @@ function openpgp_packet_encryptedintegrityprotecteddata() { + ' version: ' + this.version + '\n' - + ' data: Bytes [' - + util.hexstrdump(this.encryptedData) + ']'; + + data; } this.write_packet = write_packet; @@ -9035,7 +9039,8 @@ function openpgp_cfb_decrypt(blockcipherencryptfn, block_size, key, ciphertext, util.print_debug("resync:"+resync); var iblock = new Array(block_size); var ablock = new Array(block_size); - var i, n, text = ''; + var i, n = ''; + var text = []; // initialisation vector for(i=0; i < block_size; i++) iblock[i] = 0; @@ -9057,7 +9062,7 @@ function openpgp_cfb_decrypt(blockcipherencryptfn, block_size, key, ciphertext, || iblock[block_size-1]!=(ablock[1]^ciphertext.charCodeAt(block_size+1))) { util.print_eror("error duding decryption. Symmectric encrypted data not valid."); - return text; + return text.join(''); } /* RFC4880: Tag 18 and Resync: @@ -9076,7 +9081,7 @@ function openpgp_cfb_decrypt(blockcipherencryptfn, block_size, key, ciphertext, for(i = 0; i 38) - util.print_debug("openpgp.msg.messge decrypt:\n"+util.hexstrdump(decrypted.substring(position))); + util.print_debug_hexstr_dump("openpgp.msg.messge decrypt:\n",decrypted.substring(position)); len = decrypted.length - position; if (packet.tagType == 11) { this.text = packet.data; @@ -11088,7 +11093,8 @@ function openpgp_msg_message() { this.decrypt = decrypt; this.verifySignature = verifySignature; this.toString = toString; -}// GPG4Browsers - An OpenPGP implementation in javascript +} +// GPG4Browsers - An OpenPGP implementation in javascript // Copyright (C) 2011 Recurity Labs GmbH // // This library is free software; you can redistribute it and/or diff --git a/resources/openpgp.min.js b/resources/openpgp.min.js index 3b5f04bc..6c2d9d22 100644 --- a/resources/openpgp.min.js +++ b/resources/openpgp.min.js @@ -32,8 +32,8 @@ this.preferredCompressionAlgorithms+"\nKey Server Preferences :"+thi this.reasonForRevocationFlag+"\n Reason :"+this.reasonForRevocationString+"\nMPI:\n",c=0;cb*f;){blocka=d.substring(f*b,f*b+b);a("",c);for(var h=0;hb*g;){for(var k=a(f,c),f=d.substring(g*b+0,g*b+b+0),e=0;eb*f;){blocka=d.substring(f*b,f*b+b);a("",c);for(var h=0;hb*g;){for(var k=a(f,c),f=d.substring(g*b+0,g*b+b+0),e=0;e>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_msg_message(){this.text="";this.decrypt=function(a,b){if(null==a||null==b||""==b)return null;var c=b.decrypt(this,a.keymaterial);if(null==c)return null;var d,e=0,f=c.length;for(util.print_debug("openpgp.msg.messge decrypt:\n"+util.hexstrdump(c));e!=c.length&&null!=(d=openpgp_packet.read_packet(c,e,f));){if(8==d.tagType)this.text=d.decompress(),c=d.decompress();util.print_debug(d.toString());e+=d.headerLength+d.packetLength;38d.signatureType){var g=openpgp.keyring.getPublicKeysForKeyId(d.issuerKeyId);0==g.length?util.print_warning("Unable to verify signature of issuer: "+util.hexstrdump(d.issuerKeyId)+". Public key not found in keyring."):d.verify(this.text.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"),g[0])&&g[0].obj.validate()?util.print_info("Found Good Signature from "+g[0].obj.userIds[0].text+ +function openpgp_msg_message(){this.text="";this.decrypt=function(a,b){if(null==a||null==b||""==b)return null;var c=b.decrypt(this,a.keymaterial);if(null==c)return null;var d,e=0,f=c.length;for(util.print_debug_hexstr_dump("openpgp.msg.messge decrypt:\n",c);e!=c.length&&null!=(d=openpgp_packet.read_packet(c,e,f));){if(8==d.tagType)this.text=d.decompress(),c=d.decompress();util.print_debug(d.toString());e+=d.headerLength+d.packetLength;38d.signatureType){var g=openpgp.keyring.getPublicKeysForKeyId(d.issuerKeyId);0==g.length?util.print_warning("Unable to verify signature of issuer: "+util.hexstrdump(d.issuerKeyId)+". Public key not found in keyring."):d.verify(this.text.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"),g[0])&&g[0].obj.validate()?util.print_info("Found Good Signature from "+g[0].obj.userIds[0].text+ " (0x"+util.hexstrdump(g[0].obj.getKeyId()).substring(8)+")"):util.print_error("Signature verification failed: Bad Signature from "+g[0].obj.userIds[0].text+" (0x"+util.hexstrdump(g[0].obj.getKeyId()).substring(8)+")")}}if(""==this.text)this.text=c;return this.text};this.verifySignature=function(){var a=!1;if(2==this.type){var b;if(4==this.signature.version)b=openpgp.keyring.getPublicKeysForKeyId(this.signature.issuerKeyId);else if(3==this.signature.version)b=openpgp.keyring.getPublicKeysForKeyId(this.signature.keyId); else return util.print_error("unknown signature type on message!"),!1;if(0==b.length)util.print_warning("Unable to verify signature of issuer: "+util.hexstrdump(this.signature.issuerKeyId)+". Public key not found in keyring.");else for(var c=0;c