Comparing version 3.0.10 to 3.0.11
@@ -1,2 +0,2 @@ | ||
/*! OpenPGP.js v3.0.10 - 2018-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
/*! OpenPGP.js v3.0.11 - 2018-05-22 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
!function e(n,t,r){function o(a,f){if(!t[a]){if(!n[a]){var c="function"==typeof require&&require;if(!f&&c)return c(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=t[a]={exports:{}};n[a][0].call(u.exports,function(e){var t=n[a][1][e];return o(t||e)},u,u.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,n,t){self.window=self,importScripts("openpgp.min.js");var r=window.openpgp,o=[],i=6e4;function a(e){self.postMessage(e,r.util.getTransferables(e.data))}r.crypto.random.randomBuffer.init(i,function(){return o.length||self.postMessage({event:"request-seed",amount:i}),new Promise(function(e){o.push(e)})}),self.onmessage=function(e){var n,t=e.data||{};switch(t.event){case"configure":n=t.config,Object.keys(n).forEach(function(e){r.config[e]=n[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));r.crypto.random.randomBuffer.set(e)}(t.buf);var i=o;o=[];for(var f=0;f<i.length;f++)i[f]();break;default:!function(e,n,t){if("function"!=typeof r[n])return void a({id:e,event:"method-return",err:"Unknown Worker Event"});t=r.packet.clone.parseClonedPackets(t,n),r[n](t).then(function(n){a({id:e,event:"method-return",data:r.packet.clone.clonePackets(n)})}).catch(function(n){a({id:e,event:"method-return",err:n.message,stack:n.stack})})}(t.id,t.event,t.options||{})}}},{}]},{},[1]); |
{ | ||
"name": "openpgp", | ||
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.", | ||
"version": "3.0.10", | ||
"version": "3.0.11", | ||
"license": "LGPL-3.0+", | ||
@@ -6,0 +6,0 @@ "homepage": "https://openpgpjs.org/", |
@@ -89,3 +89,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
*/ | ||
Literal.prototype.getBytes = function() { | ||
Literal.prototype.getBytes = function(textMode=false) { | ||
if (this.data !== null) { | ||
@@ -95,6 +95,8 @@ return this.data; | ||
// normalize EOL to \r\n | ||
const text = util.canonicalizeEOL(this.text); | ||
// encode UTF8 | ||
this.data = util.str_to_Uint8Array(util.encode_utf8(text)); | ||
if (textMode) { | ||
// normalize EOL to \r\n and UTF-8 encode | ||
this.data = util.str_to_Uint8Array(util.encode_utf8(util.canonicalizeEOL(this.text))); | ||
} else { | ||
this.data = util.str_to_Uint8Array(this.text); | ||
} | ||
return this.data; | ||
@@ -153,3 +155,3 @@ }; | ||
const date = util.writeDate(this.date); | ||
const data = this.getBytes(); | ||
const data = this.getBytes(format !== 'binary'); | ||
@@ -156,0 +158,0 @@ return util.concatUint8Array([format, filename_length, filename, date, data]); |
@@ -18,5 +18,6 @@ /* eslint-disable import/no-extraneous-dependencies */ | ||
} | ||
if (typeof Promise === 'undefined') { | ||
require('core-js/fn/promise'); | ||
} | ||
// No if-statement on Promise because of IE11. Otherwise Promise is undefined in the service worker. | ||
require('core-js/fn/promise'); | ||
if (typeof Uint8Array.from === 'undefined') { | ||
@@ -23,0 +24,0 @@ require('core-js/fn/typed/uint8-array'); |
@@ -33,4 +33,5 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
const isIE11 = typeof navigator !== 'undefined' && !!navigator.userAgent.match(/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/); | ||
export default { | ||
isString: function(data) { | ||
@@ -55,2 +56,6 @@ return typeof data === 'string' || String.prototype.isPrototypeOf(data); | ||
getTransferables: function(obj) { | ||
// Internet Explorer does not support Transferable objects. | ||
if (isIE11) { | ||
return undefined; | ||
} | ||
if (config.zero_copy && Object.prototype.isPrototypeOf(obj)) { | ||
@@ -57,0 +62,0 @@ const transferables = []; |
@@ -768,2 +768,19 @@ const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); | ||
it('Should verify cleartext message correctly when using a detached binary signature and text literal data', async function () { | ||
const plaintext = 'short message\nnext line\n한국어/조선말'; | ||
const plaintextArray = openpgp.util.str_to_Uint8Array(plaintext); | ||
const pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0]; | ||
const privKey = openpgp.key.readArmored(priv_key_arm2).keys[0]; | ||
await privKey.decrypt('hello world'); | ||
return openpgp.sign({ privateKeys:[privKey], data:plaintextArray, detached: true}).then(function(signed) { | ||
const signature = openpgp.signature.readArmored(signed.signature); | ||
return openpgp.verify({ publicKeys:[pubKey], message: openpgp.message.fromText(plaintext), signature: signature }); | ||
}).then(function(cleartextSig) { | ||
expect(cleartextSig).to.exist; | ||
expect(cleartextSig.signatures).to.have.length(1); | ||
expect(cleartextSig.signatures[0].valid).to.be.true; | ||
expect(cleartextSig.signatures[0].signature.packets.length).to.equal(1); | ||
}); | ||
}); | ||
it('Should verify encrypted cleartext message correctly when encrypting binary literal data with a canonical text signature', async function () { | ||
@@ -770,0 +787,0 @@ const plaintext = 'short message\nnext line\n한국어/조선말'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3594498
68206