Commit Graph

158 Commits

Author SHA1 Message Date
Ilya Chesnokov
6d626ea70c Style fixes and new style rules for eslint (#919) 2019-06-28 15:33:18 +02:00
Daniel Huigens
5dcaf85f5a Optimize reading large messages with lots of tiny partial body parts (#864)
* Fix pako decompression

* Optimize base64-decoding

* Don't stream-parse packets when not stream-reading data
2019-02-21 08:33:55 -08:00
Sanjana Rajan
1bee091f2a
Merge pull request #815 from twiss/userIds
Make fromUserIds/toUserIds params plural, and accept arrays of User IDs
2018-12-23 17:50:46 +01:00
Daniel Huigens
113c4a5f1e Add CAST5 to always-allowed algorithms
Golang's OpenPGP implementation uses CAST5 as its fallback.
(The spec mandates TripleDES as fallback.)

Fixes #819.
2018-12-22 00:00:47 -05:00
Daniel Huigens
e727097bb0 Always look at the same literal data packet in getText() and verify() 2018-12-17 12:27:05 -05:00
Daniel Huigens
3b9676f2e9 Reject messages encrypted with a symmetric algo not in preferred algos 2018-12-17 12:27:03 -05:00
Daniel Huigens
65772d86b3 Make fromUserIds/toUserIds params plural, and accept arrays of User IDs
Each User ID object is used for the key object at the corresponding index
in the privateKeys/publicKeys arrays.
2018-12-14 16:54:44 +01:00
Daniel Huigens
c7339f6f78 Check whether signing key was non-expired at signature creation time 2018-12-10 16:34:44 +01:00
Daniel Huigens
787965981a Check whether message signatures are expired when verifying them 2018-12-10 15:20:24 +01:00
Daniel Huigens
92230d2055 Consider non-expired signatures from expired keys to still be valid 2018-12-10 15:20:11 +01:00
Daniel Huigens
997f3e8e38 Compute signed data based on expected signature type 2018-11-05 17:13:40 +01:00
Daniel Huigens
327d3e5392 Only accept binary or text signatures when verifying messages 2018-11-05 11:47:39 +01:00
Daniel Huigens
abce79b509 Use Web Crypto for hashing 2018-11-01 14:11:22 +01:00
Sanjana Rajan
3c45b6f18a
Merge pull request #793 from twiss/signature-errors
Check that one-pass signatures match their corresponding signature
2018-11-01 12:13:02 +01:00
Daniel Huigens
13c29b1fc9 Fix decryption with multiple passwords 2018-11-01 11:46:27 +01:00
Daniel Huigens
9c82bf491e Reject signatures[*].verified and signatures[*].signature on read errors
However, don't throw "unhandled promise rejection" when not using these
properties at all, or when they reject before the user has a chance to
handle them.
2018-10-29 11:47:36 +01:00
Daniel Huigens
3751731330 Don't hang when signature packet corresponding to one-pass sig is missing 2018-10-04 22:13:10 +02:00
Daniel Huigens
e055d86062 Update documentation 2018-08-14 17:50:26 +02:00
Daniel Huigens
052fa444be Support Node streams 2018-08-14 17:19:54 +02:00
Daniel Huigens
0ddff3ae7d Rename asStream to streaming
Also, break up `postProcess`.
2018-08-14 17:19:51 +02:00
Daniel Huigens
52c4fa9639 Move streams library to a separate package 2018-08-14 16:35:40 +02:00
Daniel Huigens
ca537e439d Comments & code style 2018-08-14 16:35:38 +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
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
ad92ac7c3a Fix signature type of one-pass signatures when passing a signature
If the type of the signature passed to openpgp.encrypt() did not
match the "expected" type (text for literal text packets, etc)
the signature type would be set incorrectly.
2018-08-10 14:46:26 +02:00
Daniel Huigens
eb72d4dd63 Don't use asmcrypto's streaming API when not necessary
Optimization for Firefox
2018-08-10 14:46:26 +02:00
Daniel Huigens
ddda6a0b16 Implement cancellation by manually linking together input and output streams 2018-08-10 14:46:24 +02:00
Daniel Huigens
de2971d84a Use TransformStreams 2018-08-10 14:46:24 +02:00
Daniel Huigens
9c1c28bc59 Add option to read unauthenticated data from stream 2018-08-10 14:46:23 +02:00
Daniel Huigens
56ec5b3a8d Don't keep extra copies of streams in memory 2018-08-10 14:46:22 +02:00
Daniel Huigens
ade2627bca Streaming verify one-pass signatures 2018-08-10 14:44:01 +02:00
Daniel Huigens
05479e6e6b Don't warn about await in loops 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
403bdc5346 Streaming decryption (Web) 2018-08-10 14:44:01 +02:00
Daniel Huigens
9853d3d830 Streaming encryption (Web) 2018-08-10 14:44:01 +02:00
Daniel Huigens
15e6f0d654 Replace get(Sub)KeyPackets with get(Sub)Keys 2018-07-19 15:03:25 +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
e411839ae3 Deduplicate signature packet creation 2018-07-11 18:05:01 +02:00
Daniel Huigens
fe3c1b4f31 Add fromUserId / toUserId parameters to openpgp.encrypt and sign
To select the user whose algorithm preferences, expiration time etc to use.
2018-05-01 13:39:23 +02:00
Daniel Huigens
0376f49e01 Deduplicate getPreferredSymAlgo / getPreferredAEADAlgo 2018-04-30 15:55:35 +02:00
Daniel Huigens
6f2abdc2cf Implement MIME message type (Literal Data Packet format 'm') 2018-04-27 14:06:19 +02:00
Daniel Huigens
3b81088aaf Decouple signature type from data packet type
Instead of creating a text signature for text packets and a binary signature for
binary packets, we determine the signature type based on whether a String or
Uint8Array was originally passed. This is useful for the new MIME data packet
type (implemented in the next commit) which you can pass in either format.

This also partly reverts a22c9e4. Instead of canonicalizing the literal data
packet, we canonicalize the data when signing. This fixes a hypothetical case
where an uncanonicalized text packet has both a text and a binary signature.

This also partly reverts c28f7ad. GPG does not strip trailing whitespace when
creating text signatures of literal data packets.
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
5f97a8c937 Implement preferred AEAD algorithms 2018-04-27 14:06:16 +02:00
Daniel Huigens
5d43b44e50 Log swallowed errors in debug mode 2018-04-27 14:06:14 +02:00
Sanjana Rajan
614640ee42 add comment 2018-03-22 16:55:40 -07:00
Sanjana Rajan
a22c9e4770 WIP text signatures 2018-03-22 16:10:21 -07:00
Mahrud Sayrafi
96c9cd0d73
Fixes dead links in the documentation 2018-03-13 00:13:04 -07:00