Commit Graph

111 Commits

Author SHA1 Message Date
Daniel Huigens
1101a05b10 Don't return streams inside unarmored generated keys and signatures
When not requested, we convert the streams to Uint8Arrays.

This makes the generated key safe to pass to a Worker more than once.

Partially reverts 735aa1da.
2018-08-14 16:35:36 +02:00
Daniel Huigens
2b30ab9c8f Replace data with message parameter in encrypt() and sign()
When encrypting/signing a stream, this allows you to indicate whether it's a
stream of Strings or Uint8Arrays (using message.fromText or message.fromBinary,
respectively.)

When signing text, this allows you to control whether to create a cleartext
message or a regular armored text message.

When creating a detached signature, it allows you to control whether it's "meant
for" (verifying against) a cleartext message. A cleartext message has trailing
whitespace trimmed before signing. This fixes the case of passing a detached
signature from sign() to encrypt(). Since encrypt() doesn't create a cleartext
message, the signature would be invalid if the text contained lines with
trailing whitespace.
2018-08-10 14:46:29 +02:00
Daniel Huigens
95413cc6ed Fix signatures of messages with leading/trailing whitespace 2018-08-10 14:46:29 +02:00
Daniel Huigens
9f0f00e087 Make signature.verified a Promise instead of result.signatures
Also, fix verifying detached signatures
2018-08-10 14:46:28 +02:00
Daniel Huigens
d2ba6b3c6c Wait for data to be read before resolving signatures 2018-08-10 14:46:28 +02:00
Daniel Huigens
4d82d25559 Pass more tests
We now use streams internally in more places.
2018-08-10 14:46:26 +02:00
Daniel Huigens
56ec5b3a8d Don't keep extra copies of streams in memory 2018-08-10 14:46:22 +02:00
Daniel Huigens
f0633f00ea Don't repeatedly decrypt the same key in unit tests 2018-08-10 14:44:01 +02:00
Daniel Huigens
d67526338e Streaming (de)compression (Web)
compressjs has a streaming API, but it is synchronous, so we can't use it
(at least in the browser).
2018-08-10 14:44:01 +02:00
Daniel Huigens
db39e616ca Replace stream.tee() with stream.clone()
Also some other fixes to pass more tests.
2018-08-10 14:44:01 +02:00
Daniel Huigens
0372bf78f1 Make (de)armoring and packet reading asynchronous 2018-08-10 14:44:01 +02:00
Sanjana Rajan
8f01d4b0b5 clean up tests 2018-08-01 17:47:07 +03:00
Kay Lukas
6f176f8b30 Fix multiple workers 2018-07-26 18:33:30 +02:00
Daniel Huigens
91b7165b78 Add key/subKey.getKeyId, getFingerprint, getAlgorithmInfo, getCreationTime, isDecrypted 2018-07-19 15:03:25 +02:00
Daniel Huigens
8cfe817b18 Remove getEncryptionKeyPacket and getSigningKeyPacket
Also, rename subKey.subKey to keyPacket and alias key.primaryKey as keyPacket.
2018-07-19 13:31:03 +02:00
Daniel Huigens
3fd0fa8f68 Various key revocation fixes 2018-07-13 17:45:09 +02:00
Daniel Huigens
1ed7943bf9 Create openpgp.revokeKey 2018-07-11 17:57:31 +02:00
Maximilian Krambach
1eb3902a96 Run tests with randomly generated strings 2018-05-17 12:40:30 +02:00
Daniel Huigens
6c2fec3450 Parse user IDs
Also, support comments when creating user IDs
2018-05-01 13:39:23 +02:00
Daniel Huigens
8ec01ae07a Reduce duplicate tests 2018-04-30 16:58:38 +02:00
Daniel Huigens
550b758d57 Fall back to asm for CTR and CBC in old Safari 2018-04-30 16:58:35 +02:00
Daniel Huigens
7ce3f5521f Set default draft version to 4 2018-04-30 15:55:38 +02:00
Daniel Huigens
04651e359a Rename enums.aead.gcm to experimental_gcm
So that (1) if the spec ever defines GCM differently than we do, we have a
clean upgrade path and (2) it makes it clear that it's experimental.
2018-04-30 15:55:37 +02:00
Daniel Huigens
4568d080d5 Fix decryption with multiple chunks 2018-04-30 15:55:34 +02:00
Daniel Huigens
343c64eca0 Add tests for signing and verifying messages with trailing spaces 2018-04-30 15:55:33 +02:00
Daniel Huigens
e061df113c Implement GCM mode in the new draft
Also, implement additional data for GCM
2018-04-30 15:55:31 +02:00
Daniel Huigens
6f2abdc2cf Implement MIME message type (Literal Data Packet format 'm') 2018-04-27 14:06:19 +02:00
Daniel Huigens
e24b46192d Only AEAD-protect when target keys support it 2018-04-27 14:06:18 +02:00
Daniel Huigens
e44fbbccab Add more OCB tests 2018-04-27 14:06:18 +02:00
Daniel Huigens
28dbbadcff Add config.aead_protect_version option 2018-04-27 14:06:17 +02:00
Daniel Huigens
7b3f51c0d4 Implement AEAD Encrypted Data Packet 2018-04-25 20:12:10 +02:00
Sanjana Rajan
e4bd27ce2f tests 2018-04-16 10:51:07 -07:00
Sanjana Rajan
2f351985c4 tests 2018-03-19 18:55:30 -07:00
Mahrud Sayrafi
6fefe22c09 Finished fixing key.js; fixes async tests 2018-03-08 10:01:55 +01:00
Mahrud Sayrafi
0b2817ba39 Last little things become async ... 2018-03-08 10:01:55 +01:00
Bart Butler
2bb5db2cf4 multiple web workers 2018-03-05 21:36:53 -08:00
Bart Butler
572abadc91 random number web worker buffer automatic refill 2018-03-05 17:57:35 -08:00
Bart Butler
f57888fe55 change all calls of getRandomBytes and getRandomBN to be async 2018-03-05 16:31:56 -08:00
Bart Butler
0186ca8a24 tree shake sinon to just get what we need 2018-02-26 14:45:05 -08:00
KAYLukas
56ad9a00e0 Fix testcases 2018-02-21 22:32:09 +01:00
KAYLukas
6b4d44dbb1 Fix browser tests 2018-02-19 22:12:24 +01:00
KAYLukas
071fc35f38 Check created time to be valid and discard milliseconds from date objects 2018-02-17 11:28:04 +01:00
KAYLukas
6ca8bc2180 Add timeparameter for verification and remove verify_expired_keys 2018-02-16 17:20:48 +01:00
KAYLukas
7e66ea20db Add timeparameter to signing and encryption 2018-02-16 17:20:48 +01:00
Bart Butler
7e1731f2bb remove excess compression testing, fix cleartext signing with multiple keys test 2018-02-14 15:19:52 -08:00
Bart Butler
fa2672fcc1
Merge pull request #642 from mmso/feat/bzip2
Fix #607 - Add support for bzip2 de/compression
2018-02-14 11:00:56 -08:00
Sanjana Rajan
b5d19b6f8d pull out common signature code 2018-02-14 19:00:13 +01:00
Sanjana Rajan
2ffd81553d test multiple private key signing cleartext 2018-02-14 17:30:35 +01:00
mmso
8808fdb8ed
Fix #607 - Add support for bzip2 de/compression 2018-02-14 14:14:07 +01:00
BafS
b672f1936a Use let and const ES6 features.
Remove var, for let or const if possible, clean some syntax, enforce one var per declaration and semicolons
2018-02-13 23:33:09 +01:00