Commit Graph

92 Commits

Author SHA1 Message Date
Ilya Chesnokov
d415bc2546 Rename config option names to camelCase (#1088) 2021-02-09 19:25:20 +01:00
larabr
4c93abb9f9 Use V5 keys by default (#1063) 2021-02-09 19:25:20 +01:00
Daniel Huigens
2bc24f354b Return only one key in key.read[Armored], add readAll[Armored] 2021-02-09 19:25:20 +01:00
Daniel Huigens
2fffc76060 Don't overwrite Web Streams Polyfill to globals
Instead, use the ponyfill that's now included in web-stream-tools.
Also, convert back to native ReadableStream when we used the ponyfill.
2021-02-09 19:25:20 +01:00
larabr
cc1bdcbae8
Allow decryption with revoked keys (#1135)
However, when decrypting session keys, check that the public key
algorithm matches that of the decryption key.
2020-08-18 15:49:27 +02:00
Wiktor Kwapisiewicz
0712e8af2d
Support non-human-readable notation values (#983)
This change adds support for binary (non-human-readable) values in
signature notations through `rawNotations` property on signature objects.
Human-readable notations will additionally appear in `notations` object
where the value of the notation will be deserialized into a string.

Additionally the check for human-readable flag was modified to check the
existence of the flag instead of comparison with the whole value.
2020-08-18 11:07:58 +02:00
Daniel Huigens
a7cc71e35e
Throw when trying to encrypt a key that's already encrypted (#950) 2019-08-19 13:27:52 +02:00
Daniel Huigens
a184ef6ec4 Remove support for the previous draft00 AEAD 2019-08-12 17:46:37 +02:00
Wiktor Kwapisiewicz
16b12d7f55
Expose all signature notations
Previous implementation used an object to hold notations so if multiple
notations had the same key name only the last one was visible.

After this change notations are exposed as an array of key-value pairs
that can be converted to a map through `new Map(notations)`.

See #897.
2019-05-09 12:12:22 +02:00
Daniel Huigens
997f3e8e38 Compute signed data based on expected signature type 2018-11-05 17:13:40 +01:00
Daniel Huigens
11fd2313a7 Fix unhandled promise rejection when decrypting non-MDC message 2018-11-01 11:46:43 +01:00
Daniel Huigens
4bdc5e92ab Add --compat option
Without it, the generated build is for recent versions of
Chrome, Firefox, Safari and Edge.

With it, the generated build is for IE11+.
2018-08-14 17:24:41 +02:00
Daniel Huigens
d844b8b06c Add minimum AEAD buffer size
This enables parallelism for streaming AEAD chunked encryption.

The reason we can't do so at the very end of the pipe chain
(e.g., in `readToEnd`) is because requests for increased
buffering (i.e. `desiredSize > 1`) do not propagate backwards,
only requests for backpressure (i.e. `desiredSize <= 0`) do.
2018-08-14 16:35:39 +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
ade2627bca Streaming verify one-pass signatures 2018-08-10 14:44:01 +02:00
Daniel Huigens
37014ecf30 Pass more tests
- Allow leading spaces in headers (since we were already accepting
leading spaces everywhere else in the armored text).
- Read ReadableStreams before passing them to a Worker
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
16ba26c298 Streaming AEAD 2018-08-10 14:44:01 +02:00
Daniel Huigens
4ada3fa590 Don't mutate prototypes of Uint8Array, ReadableStream and ReadableStreamDefaultWriter 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
Daniel Huigens
9302fdcc56 Don't cache literal.getBytes() when signing with textMode=false
This partially reverts bcfb9c0.
2018-08-10 14:44:01 +02:00
Wiktor Kwapisiewicz
19e3c344fd
Fix verification of User Attributes
This change corrects verification of certifications over User Attributes
(such as photos).

Before this change the code did not differentiate between User IDs and
User Attributes as both of them were stored in `data.userid` [0] and
incorrectly used the User ID constant (0xB4) for both cases.

This change fixes the bug by storing User IDs in `userId` property and
User Attributes in `userAttribute` property. The check for property
existence has been modified to avoid comparisons with `undefined` as the
`User` class sets `null` for not assigned packets instead of
`undefined`.

Only data structures for signing and verification were modified and not
the properties used in the `User` class.

[0]: 11b2d2de3c/src/key.js (L872)
2018-07-24 13:03:46 +02:00
Wiktor Kwapisiewicz
0099c373d2
Fix reading signersUserId packet in signatures
This bug caused all signersUserIds strings to be prefixed with `"null"`
string. Changed to use only the last value for this packet type.

Previous implementation probably assumed that there will be more than one
signersUserId packet but I haven't been able to generate such signature
using gpg (only last user id was embedded). Moreover signature
serialization function `write_all_sub_packets` writes only one value of
this packet as a UTF-8 string.
2018-06-27 12:17:19 +02:00
Maximilian Krambach
4beb31333e change some variable names in tests to camelCase 2018-06-04 12:33:01 +02:00
Maximilian Krambach
1eb3902a96 Run tests with randomly generated strings 2018-05-17 12:40:30 +02:00
Sanjana Rajan
33d5b158f8 fix #706 - if ignore_mdc_error is set to false then MDC is required for all symmetrically encrypted data 2018-05-15 00:04:58 -07:00
Daniel Huigens
310d8dd9b9 Fix V5 key fingerprint in ECDH parameters 2018-04-30 15:55:36 +02:00
Daniel Huigens
28dbbadcff Add config.aead_protect_version option 2018-04-27 14:06:17 +02:00
Daniel Huigens
f225f994ec Add AEAD-OCB test vector 2018-04-27 14:06:16 +02:00
Daniel Huigens
5f891d28d6 Switch cipher/aes.js to Uint8Arrays 2018-04-27 14:06:14 +02:00
Daniel Huigens
c2f898279b Implement version 5 Secret-Key Packet Format 2018-04-27 14:06:14 +02:00
Daniel Huigens
17ad654d60 Implement version 5 Symmetric-Key Encrypted Session Key packet 2018-04-27 14:06:13 +02:00
Daniel Huigens
7b3f51c0d4 Implement AEAD Encrypted Data Packet 2018-04-25 20:12:10 +02:00
Mahrud Sayrafi
6fefe22c09 Finished fixing key.js; fixes async tests 2018-03-08 10:01:55 +01:00
Mahrud Sayrafi
73a240df6c Simplifies (Key|User|SubKey).isRevoked, API changes in key.js
For User s/revocationCertifications/revocationSignatures/g
For Key/SubKey s/revocationSignature/revocationSignatures/g is now an array.
2018-03-08 10:01:54 +01:00
Bart Butler
f57888fe55 change all calls of getRandomBytes and getRandomBN to be async 2018-03-05 16:31:56 -08:00
Mahrud Sayrafi
3b912d2fae
Cleaning mpi.js; TODO: store MPI.data as Uint8Array instead of BN
Also improved asynchronousity in packet tests
2018-02-22 14:51:57 -08:00
Mahrud Sayrafi
1812166a53
RSA using asmcrypto with asmcrypto bignum 2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
e1d85ba682
ElGamal and MPI use bn.js; TODO: RSA Key Generation 2018-02-22 00:37:42 -08: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
BafS
de6ffc2f76 Remove 'user strict'
'use strict' is unnecessary inside modules because module code is always strict mode code. Ref: https://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code
2018-02-13 23:33:09 +01:00
Mahrud Sayrafi
21ae66c604 encrypt/decrypt/sign/verify will always return promises
Note: publicKeyEncryptedSessionKey uses promises, symEncryptedSessionKey does not
2018-01-30 18:33:55 +01:00
Mahrud Sayrafi
1a714cec73 ECC with async/await is 'Done, without errors.' 2018-01-30 18:33:55 +01:00
Sanjana Rajan
cdc7004b96 refactor mpi, generalize mpi to params to account for non-mpi algorithm-specific data 2018-01-30 18:30:15 +01:00
Bart Butler
318d86e5e9 do not use arrow syntax for tests (old node/browser versions) 2017-11-28 10:18:26 -08:00
Sanjana Rajan
e2c15fe558 don't use done inside promises 2017-11-27 22:17:13 -08:00
Tankred Hase
453a9cee07 Use web worker for encrypt/decrypt if no native gcm 2016-03-23 21:17:36 +08:00
Tankred Hase
8f8218e9de Cleanup and test AEAD protected packet 2016-03-22 17:45:19 +08:00
Tankred Hase
25131e0df9 Added unit tests for util.getTransferables 2016-02-10 12:52:13 +07:00