Commit Graph

95 Commits

Author SHA1 Message Date
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
a6a701df7f Streaming signing 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
3475843d82 Don't hack util.concatUint8Array() to handle Streams
Use util.concat() instead.
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
Daniel Huigens
95b9e5188a Remove some ESLint silencers 2018-05-01 17:36:15 +02:00
Daniel Huigens
e8adeef278 Implement Issuer Fingerprint subpacket 2018-04-30 15:55:37 +02:00
Daniel Huigens
ebeedd3443 Fix removing whitespace from the last line of cleartext signed messages
Also, move normalizing line endings and removing whitespace to util functions
2018-04-30 15:55:33 +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
5f97a8c937 Implement preferred AEAD algorithms 2018-04-27 14:06:16 +02:00
Emeric Chevalier
e257e7a570 Fix parsing of revocation subkey fingerprint 2018-03-18 19:45:12 +01:00
Sanjana Rajan
75cd4e5e6f some fixes, add expired key test 2018-03-17 07:32:56 -07:00
Sanjana Rajan
a41fc29b44 typo fix 2018-03-16 11:52:45 -07:00
Mahrud Sayrafi
96c9cd0d73
Fixes dead links in the documentation 2018-03-13 00:13:04 -07:00
Mahrud Sayrafi
4ded3f9d58
Documentation improvements in src/packet 2018-03-09 08:01:06 -08:00
Mahrud Sayrafi
08da24de27
documentation fixes 2018-03-08 10:55:58 -08:00
Mahrud Sayrafi
0b2817ba39 Last little things become async ... 2018-03-08 10:01:55 +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
1cd9018346 some cleanup 2018-03-06 10:04:33 -08:00
Mahrud Sayrafi
9e1236c04c
Modernizes util.js 2018-02-28 15:49:41 -08:00
Mahrud Sayrafi
9275119dbc
Enables JSDoc Markdown Plugin 2018-02-28 14:13:44 -08:00
Mahrud Sayrafi
1812166a53
RSA using asmcrypto with asmcrypto bignum 2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
aee8974ef5
RSA signatures now use asmcrypto.js; various fixes and tweaks 2018-02-22 00:37:41 -08:00
KAYLukas
a5b30468ef Check creation time in expiration checks 2018-02-22 00:41:12 +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
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
Mahrud Sayrafi
d851398b0c
Merge branch 'master' into http-to-https 2018-02-08 10:56:46 -08:00
Mahrud Sayrafi
115d1c0949
A better patch for EdDSA truncation issue.
The last test in test/general/x25519.js is commented, as it seems to defy logic.
Yet it can be successfully imported by GPG2. TODO: How?
2018-02-03 14:36:20 -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
a4134b9f55
Addresses various review comments by @bartbutler + some cleanups 2018-01-31 17:52:38 -08:00
Mahrud Sayrafi
35f18444b0 keygen and sign/verify with ed25519 works 2018-01-30 18:34:54 +01:00
Mahrud Sayrafi
1a714cec73 ECC with async/await is 'Done, without errors.' 2018-01-30 18:33:55 +01:00
Mahrud Sayrafi
11a2d0070b ESLint is happy! 2018-01-30 18:31:30 +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
Ismael Bejarano
673151ec87 Read and write ECDSA packets 2018-01-30 18:30:14 +01:00
Sanjana Rajan
28e5f5d3f4 allow cleartext msg data to be string or byte array 2017-07-04 14:15:39 -07:00
Alax Villmann
e526cf0a3b Generate valid version 3 signatures 2017-01-26 12:49:49 -08:00
Tankred Hase
70ac662073 Refactor src/packet/*.js to use import & export 2016-02-05 14:44:22 +07:00
Tankred Hase
90a7457b71 Refactor most src files to strict mode, delint 2016-02-04 00:37:00 +07:00
Bart Butler
5711028449 does not pass tests yet 2016-02-03 20:24:54 +07:00
Bart Butler
b4916e29a3 binary strings to typed arrays in most places 2016-02-03 20:24:54 +07:00
Tankred Hase
bbe174828f Upgrade license to LGPL version 3.0 or later. 2014-09-30 18:16:58 +02:00