Commit Graph

353 Commits

Author SHA1 Message Date
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
9302fdcc56 Don't cache literal.getBytes() when signing with textMode=false
This partially reverts bcfb9c0.
2018-08-10 14:44:01 +02:00
Sanjana Rajan
8f01d4b0b5 clean up tests 2018-08-01 17:47:07 +03:00
Sanjana Rajan
d1416cbe2c
Merge pull request #746 from KAYLukas/fix/worker
Fix multiple workers
2018-07-27 10:41:35 +02:00
Sanjana Rajan
01abfc507d remove unnecessary trims 2018-07-27 09:50:54 +02:00
Kay Lukas
6f176f8b30 Fix multiple workers 2018-07-26 18:33:30 +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
Daniel Huigens
a49276a158 Allow checking expiry of subkeys by capability, keyId or userId 2018-07-18 14:40:28 +02:00
Sanjana Rajan
53f473bfa7
Merge pull request #734 from twiss/key-revocation
Key revocation
2018-07-13 17:46:48 +02:00
Daniel Huigens
3fd0fa8f68 Various key revocation fixes 2018-07-13 17:45:09 +02:00
Sanjana Rajan
76f583902e name fixes 2018-07-12 15:05:08 +02:00
Sanjana Rajan
8865103e17
Merge pull request #733 from wiktor-k/fix-primary-uid
Fix Key#getPrimaryUser on keys without valid UIDs
2018-07-12 15:03:01 +02:00
Wiktor Kwapisiewicz
c3d4bf3529
Fix Key#getPrimaryUser on keys without valid UIDs
During tests of weird keys [0] it was found out that OpenPGP.js does not
handle keys without valid UIDs well.

There are two issues that this change corrects, first one is adding
filtering of user IDs in `getPrimaryUser` such as only users with self
certifications are considered. Without that change using
`getPrimaryUser` on a key without valid UIDs would throw an exception
(`Cannot read property 'verified' of undefined` [1]).

Second issue is correcting condition whether to throw if no UID was
found. Previous condition checked for `userId` variable, but this is
initialized by default and as such is almost always set. This causes
`key.getPrimaryUser()` (without condition) to throw `Could not find user
that matches that user ID`. The condition has been modified to match the
filter condition (checking if any property of `userId` has been
initialized).

[0]: https://gitlab.com/sequoia-pgp/weird-keys/tree/master/openpgpjs

[1]: 576ed08a54/openpgpjs/results/no-bound-uid.pgp.txt
2018-07-12 14:04:07 +02:00
Daniel Huigens
1ed7943bf9 Create openpgp.revokeKey 2018-07-11 17:57:31 +02:00
Daniel Huigens
368d80245a Subkey revocation 2018-07-11 17:46:49 +02:00
Daniel Huigens
a3484c3116 Key revocation 2018-07-11 17:45:59 +02:00
Sanjana Rajan
1bb86231af camel case some variables 2018-07-11 16:53:12 +02:00
Maximilian Krambach
11029e4162 Key merging with non-UserID user attribute
fix #678
2018-07-09 16:53:55 +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
Sanjana Rajan
c83c81ca56
Merge pull request #708 from MaximilianKrambach/tests
Run tests with randomly generated strings
2018-06-08 09:06:43 -07:00
Maximilian Krambach
4beb31333e change some variable names in tests to camelCase 2018-06-04 12:33:01 +02:00
Wiktor Kwapisiewicz
043e77a6ea
Add Web Key Directory lookup
This change implements Web Key Directory lookup using user's e-mail
address. The target host is the same as the e-mail's domain and the
local-part is hashed with SHA-1 and encoded using Z-Base32 encoding.

Implemented is basic flow of version 06 of OpenPGP Web Key Directory
draft [0].

It was necessary to update node-fetch package to allow returning array
buffers from HTTP responses.

If openpgpjs is used in the browser all keys retrieved from Web Key
Directory should have `Access-Control-Allow-Origin` header set to `*`
(including 404 Not found responses).

[0]: https://datatracker.ietf.org/doc/draft-koch-openpgp-webkey-service/
2018-05-29 21:21:24 +02:00
Wiktor Kwapisiewicz
da98ccb421
Add ZBase32 encoding function
See: https://tools.ietf.org/html/rfc6189#section-5.1.6
2018-05-29 09:55:47 +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
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
Sanjana Rajan
6efcce1069 prioritize signing with subkeys when possible 2018-05-09 12:23:35 -07:00
Daniel Huigens
887e832635 Throw when user ID matches no users 2018-05-03 13:04:32 +02:00
Daniel Huigens
3c224379f6 Remove util.isUserId()
It was not really correct anyway; a user id can just be an email address
without < > brackets.
2018-05-01 13:39:24 +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
6c2fec3450 Parse user IDs
Also, support comments when creating user IDs
2018-05-01 13:39:23 +02:00
Daniel Huigens
49c9fb193d Only call webCrypto.generateKey once in tests 2018-04-30 16:58:39 +02:00
Daniel Huigens
8ec01ae07a Reduce duplicate tests 2018-04-30 16:58:38 +02:00
Daniel Huigens
550b758d57 Fall back to asm for CTR and CBC in old Safari 2018-04-30 16:58:35 +02:00
Daniel Huigens
7ce3f5521f Set default draft version to 4 2018-04-30 15:55:38 +02:00
Daniel Huigens
04651e359a Rename enums.aead.gcm to experimental_gcm
So that (1) if the spec ever defines GCM differently than we do, we have a
clean upgrade path and (2) it makes it clear that it's experimental.
2018-04-30 15:55:37 +02:00
Daniel Huigens
310d8dd9b9 Fix V5 key fingerprint in ECDH parameters 2018-04-30 15:55:36 +02:00
Daniel Huigens
0376f49e01 Deduplicate getPreferredSymAlgo / getPreferredAEADAlgo 2018-04-30 15:55:35 +02:00
Daniel Huigens
4568d080d5 Fix decryption with multiple chunks 2018-04-30 15:55:34 +02:00
Daniel Huigens
343c64eca0 Add tests for signing and verifying messages with trailing spaces 2018-04-30 15:55:33 +02:00
Daniel Huigens
e061df113c Implement GCM mode in the new draft
Also, implement additional data for GCM
2018-04-30 15:55:31 +02:00
Daniel Huigens
6f2abdc2cf Implement MIME message type (Literal Data Packet format 'm') 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
e44fbbccab Add more OCB tests 2018-04-27 14:06:18 +02:00