Commit Graph

1486 Commits

Author SHA1 Message Date
Sanjana Rajan
01abfc507d remove unnecessary trims 2018-07-27 09:50:54 +02:00
Sanjana Rajan
438d47f634 handle case where primary user doesn't exist when getting exp time 2018-07-24 17:17:12 +02:00
Sanjana Rajan
49153db63b
Merge pull request #742 from wiktor-k/fix-uat-verification
Fix verification of User Attributes
2018-07-24 14:18:14 +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
Sanjana Rajan
5c574d92ca remove package-lock 2018-07-23 15:12:01 +02:00
Sanjana Rajan
21449ebd50 Release new version 2018-07-19 18:13:51 +02:00
Sanjana Rajan
11b2d2de3c
Merge pull request #739 from twiss/key-expiry-capabilities
Allow checking expiry of key by capabilities
2018-07-19 15:23:25 +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
Daniel Huigens
06746b6a77 Use latest created subkey when possible 2018-07-18 14:29:59 +02:00
Daniel Huigens
8f3e448fa6 Remove obsolete JSDoc comment 2018-07-13 18:15:53 +02:00
Sanjana Rajan
21c908a86a Release new version 2018-07-13 18:00: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
e411839ae3 Deduplicate signature packet creation 2018-07-11 18:05:01 +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
Sanjana Rajan
5455b4f546
Merge pull request #728 from MaximilianKrambach/user_packets_678
Key merging with non-UserID user attribute
2018-07-11 15:42:07 +02:00
Maximilian Krambach
11029e4162 Key merging with non-UserID user attribute
fix #678
2018-07-09 16:53:55 +02:00
Sanjana Rajan
96c1c2158e Release new version 2018-07-02 11:55:53 +02:00
Sanjana Rajan
99d3849ff3 style fix 2018-07-02 11:44:06 +02:00
Sanjana Rajan
b56afca063
Merge pull request #725 from FlowCrypt/master
configurable max uid length | close #724
2018-07-02 11:44:38 +02:00
Tom James Holub
35260cb5db configurable max uid length | close #724 2018-06-30 04:35:08 +00:00
Sanjana Rajan
7736db7acb
Merge pull request #723 from wiktor-k/fix-signersuid
Fix reading signersUserId packet in signatures
2018-06-29 23:38:03 +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
c7a65ccd16 fix #716 2018-06-13 15:05:10 +02:00
Sanjana Rajan
0248604a96 more helpful error messages when rsa message and sig sizes exceed that of modulus 2018-06-13 13:06:07 +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
Sanjana Rajan
75f291839e
Merge pull request #714 from wiktor-k/wkd
Add support for Web Key Directory lookups
2018-05-29 14:37:05 -07: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
be26302d99
Merge pull request #703 from nguyendviet/master
new Encrypt and decrypt String data with PGP keys example
2018-05-28 15:17:24 -07:00
Sanjana Rajan
bf428b80d4 Release new version 2018-05-22 17:39:26 -07: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
5111a2ba43
Merge pull request #705 from mmso/fix/ie11
Fix IE11 support
2018-05-19 12:50:54 -07:00
mmso
11ff845c3e
Don't include transferable on IE11 on postMessage 2018-05-18 09:16:57 +02:00
Maximilian Krambach
1eb3902a96 Run tests with randomly generated strings 2018-05-17 12:40:30 +02:00
Sanjana Rajan
7cd2aded63 Release new version 2018-05-15 00:05:10 -07: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
Viet Nguyen
65be3ed77a new Encrypt and decrypt String data with PGP keys example 2018-05-09 21:48:00 -04:00
Sanjana Rajan
6efcce1069 prioritize signing with subkeys when possible 2018-05-09 12:23:35 -07:00