Commit Graph

88 Commits

Author SHA1 Message Date
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
00a2c0c0c2 Support unicode surrogate code points 2018-08-14 17:24:40 +02:00
Daniel Huigens
b35b167e63 Add openpgp.cleartext.fromText
For symmetry with message.fromText
2018-08-14 16:35:41 +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
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
4e749965f2 Remove support for V3 keys and signatures 2018-08-10 14:46:26 +02:00
Daniel Huigens
de2971d84a Use TransformStreams 2018-08-10 14:46:24 +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
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
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
0372bf78f1 Make (de)armoring and packet reading asynchronous 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
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
Sanjana Rajan
80aab5d94f Merge pull request #712 from openpgpjs/signature_formatting
Fix #710
2018-05-22 17:32:22 -07:00
Sanjana Rajan
bcfb9c037a fix case with binary signatures on text data 2018-05-22 14:58:13 -07:00
Sanjana Rajan
6efcce1069 prioritize signing with subkeys when possible 2018-05-09 12:23:35 -07:00
Daniel Huigens
343c64eca0 Add tests for signing and verifying messages with trailing spaces 2018-04-30 15:55:33 +02:00
Daniel Huigens
c63ed980a1 Fix dash-escaping the first line of cleartext signed messages 2018-04-25 19:46:43 +02:00
Sanjana Rajan
8778490061 tests 2018-03-22 16:11:39 -07: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
Mahrud Sayrafi
ec22dabac3 Slightly simplifies key.js; adds key.verifyKeyPackets which should be run before getEncryption/SigningKeyPacket 2018-03-08 10:01:54 +01:00
Bart Butler
5564b67cc8 remove readSignedContent in favor of appendSignature 2018-03-01 11:55:09 -08:00
Mahrud Sayrafi
9e1236c04c
Modernizes util.js 2018-02-28 15:49:41 -08:00
KAYLukas
071fc35f38 Check created time to be valid and discard milliseconds from date objects 2018-02-17 11:28:04 +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
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
Sanjana Rajan
989ad5077e cleanup, docs 2018-02-12 13:40:23 +01:00
Sanjana Rajan
d5022a3a4a rename vars in old tests 2018-02-12 09:47:51 +01:00
Mahrud Sayrafi
d851398b0c
Merge branch 'master' into http-to-https 2018-02-08 10:56:46 -08:00
Daniel Kahn Gillmor
4da28fcc29 move from http to https where possible.
There are dozens of links in the OpenPGP.js codebase that are http but
could be replaced with https links.  I've converted as many of them as
i could find.
2018-02-01 09:58:06 -05:00
Mahrud Sayrafi
d02b9c7bf0 Fixes problems with user certificate verification.
TODO: if using lower level functions, key.verifyPrimaryUser() MUST be
called and resolved before calling key.getSigning/EncryptionKeyPacket(),
key.getPrimaryUser(), etc.

Also: adds a flag to allow verification with expired keys from:
(cherry picked from commit b9d175d998)
(cherry picked from commit 50940b2a1e)
2018-01-30 18:36:37 +01:00
Mahrud Sayrafi
e6820d7b2a Passing all tests, on Node, Firefox, and Chrome 2018-01-30 18:34:28 +01:00
Mahrud Sayrafi
1a714cec73 ECC with async/await is 'Done, without errors.' 2018-01-30 18:33:55 +01:00
Sanjana Rajan
b9d175d998 tests 2018-01-17 19:36:51 +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
Sanjana Rajan
a896003fda remove console logs 2017-07-13 12:07:12 +02:00
Sanjana Rajan
95c5e3af01 use message obj when signing uint8 array 2017-07-08 13:25:24 +02:00
Sanjana Rajan
cc831cde4a more tests 2017-07-04 21:08:48 -07:00
Sanjana Rajan
697eab19cd add tests 2017-07-04 17:03:56 -07:00
Bart Butler
3522bcf2fe remove useless test 2017-03-14 19:13:17 -07:00
Bart Butler
875e475221 small test bugfix 2017-03-14 18:49:05 -07:00
Sanjana Rajan
4ec07672a7 return signature object inside verification object 2017-03-10 10:38:59 -08:00
Sanjana Rajan
4ed7f25836 more tests 2017-03-07 13:59:17 -08:00