Daniel Huigens
b35b167e63
Add openpgp.cleartext.fromText
...
For symmetry with message.fromText
2018-08-14 16:35:41 +02:00
Daniel Huigens
52c4fa9639
Move streams library to a separate package
2018-08-14 16:35:40 +02:00
Daniel Huigens
252da44419
Don't depend on util in stream.js
2018-08-14 16:35:40 +02:00
Daniel Huigens
bb15ffc2a0
Fix streaming verify when using Worker and streams polyfill
2018-08-14 16:35:40 +02:00
Daniel Huigens
61a0e3fa69
Fix tests on IE11
2018-08-14 16:35:40 +02:00
Daniel Huigens
29271accef
Enable Transferables in IE11
...
Reverts 11ff845c
.
2018-08-14 16:35:40 +02:00
Daniel Huigens
c75e2323c0
Support IE11 for streaming
2018-08-14 16:35:39 +02:00
Daniel Huigens
721e522b17
Don't increase buffering in transformWithCancel
...
Keep backpressure the same as in default TransformStream().
2018-08-14 16:35:39 +02:00
Daniel Huigens
0b0112d1e6
En/decrypt all AEAD chunks in parallel when not returning a stream
2018-08-14 16:35:39 +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
54d5bd7d39
Add testcase for verifying messages without one-pass-signatures
2018-08-14 16:35:39 +02:00
Daniel Huigens
ca537e439d
Comments & code style
2018-08-14 16:35:38 +02:00
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
85223093a4
Switch to fork of asmcrypto.js
...
Fixes performance issues in Firefox.
2018-08-10 14:46:30 +02:00
Daniel Huigens
d489f3369f
Update to asmcrypto.js 2
2018-08-10 14:46:30 +02:00
Daniel Huigens
e66d44e42d
Rename config.unsafe_stream to allow_unauthenticated_stream
2018-08-10 14:46:29 +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
160b03451f
Fix key generation in Firefox
...
Previously broken by daa0188e.
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
0db32bea39
Backpressure and cancellation in sign/verify
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
3113976dd2
Don't throw in result.signatures
...
- The caller might not await them, in which case you get an "unhandled rejection"
- The caller might await them but only after reading the data, in which case you
get an unhandled rejection if there's an error before the end of the data
2018-08-10 14:46:27 +02:00
Daniel Huigens
b6e988b6a6
Convert result.signatures to a Promise
...
Also, throw armor checksum errors inside the data stream
2018-08-10 14:46:27 +02:00
Daniel Huigens
0cabf72682
Add TextDecoder polyfill
2018-08-10 14:46:27 +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
4d82d25559
Pass more tests
...
We now use streams internally in more places.
2018-08-10 14:46:26 +02:00
Daniel Huigens
4e749965f2
Remove support for V3 keys and signatures
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
e1a8b17753
Fix literalPacket.getText()
...
We now close streams after reading them, so we can no longer use
stream.locked for a proxy for "has been read". What we want is the
internal [[disturbed]] property, but we can't access it for native
streams.
Since we always read the stream when calling getText(), it's not
an issue.
2018-08-10 14:46:25 +02:00
Daniel Huigens
411b626149
Work around timing difference between Chrome and polyfill
...
When piping a stream to a writable stream and erroring that,
the input (readable) stream only gets cancelled after pipeTo()
returns in Chrome.
2018-08-10 14:46:25 +02:00
Daniel Huigens
55fd292fba
Fix armor errors
...
Also, fix error handling in transformPair()
2018-08-10 14:46:25 +02:00
Daniel Huigens
304cbf4783
Fix backpressure
2018-08-10 14:46:25 +02:00
Daniel Huigens
589b666ac7
Don't clone stream in packet.parse()
2018-08-10 14:46:24 +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
51c897b073
Cancelling
2018-08-10 14:46:23 +02:00
Daniel Huigens
a6a701df7f
Streaming signing
2018-08-10 14:46:23 +02:00
Daniel Huigens
9c1c28bc59
Add option to read unauthenticated data from stream
2018-08-10 14:46:23 +02:00
Daniel Huigens
1effe19c1d
Allow simultaneously reading data and waiting for signature verification
...
This makes openpgp.{decrypt,verify}().signatures a Promise when passing a
stream or when asStream=true
2018-08-10 14:46:22 +02:00
Daniel Huigens
4bbbdaee9f
Rename stream.subarray() to stream.slice()
...
Also, support ReadableStream[String] in stream.* and reader.* functions
2018-08-10 14:46:22 +02:00
Daniel Huigens
56ec5b3a8d
Don't keep extra copies of streams in memory
2018-08-10 14:46:22 +02:00
Daniel Huigens
78a0ca937e
Cache browserified modules
...
Adding asmcrypto's SHA1 and SHA512 made browserify a lot slower,
this makes it a lot faster on the second run at least.
2018-08-10 14:46:21 +02:00
Daniel Huigens
f79a3f718d
Fix streaming UTF8 decoding
2018-08-10 14:44:01 +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
253e1c572b
Switch to asmcrypto for hashing where available
2018-08-10 14:44:01 +02:00
Daniel Huigens
ade2627bca
Streaming verify one-pass signatures
2018-08-10 14:44:01 +02:00
Daniel Huigens
ead3ddd706
Streaming decrypt old-format packets
2018-08-10 14:44:01 +02:00
Daniel Huigens
9fcc075f0b
Streaming decrypt non-partial-length-encoded packets
2018-08-10 14:44:01 +02:00
Daniel Huigens
fb155ffae0
Streaming support on Node
2018-08-10 14:44:01 +02:00