Daniel Huigens
e83bc4b4fb
Don't use unexported low-level functions in tests
2020-09-16 12:43:02 +02:00
Daniel Huigens
25118c3f28
Don't export default objects / namespaces
...
Import individual functions, instead.
2020-09-16 12:43:02 +02:00
Daniel Huigens
9a6d391f3b
Export key, message, signature, cleartext functions and classes directly
...
Instead of as modules.
Replace *.read with read*, *.readArmored with readArmored*, etc.
Replace cleartext.readArmored with readArmoredCleartextMessage.
Replace message.fromText with Message.fromText, etc.
2020-09-16 12:43:02 +02:00
larabr
7776c0f7d1
Store named key params in key objects ( #1141 )
...
- Store private and public params separately and by name in objects,
instead of as an array
- Do not keep params in MPI form, but convert them to Uint8Arrays when
generating/parsing the key
- Modify low-level crypto functions to always accept and return
Uint8Arrays instead of BigIntegers
- Move PKCS1 padding to lower level functions
2020-09-14 15:35:27 +02:00
larabr
94848ecac4
Use native BigInt when available instead of bn.js ( #1119 )
...
In the lightweight build, lazily load bn.js only when necessary.
Also, use Uint8Arrays instead of strings in PKCS1 padding functions, and
check that the leading zero is present when decoding EME-PKCS1 padding.
2020-09-14 15:35:27 +02:00
Wiktor Kwapisiewicz
559772f25f
Allow parsing keys without User IDs ( #1146 )
2020-09-14 15:35:27 +02:00
larabr
f795e24a71
Use higher level functions in key validation tests ( #1128 )
...
Use `key.keyPacket.validate` instead of `crypto.publicKey.validateParams`, see
https://github.com/openpgpjs/openpgpjs/pull/1116#discussion_r447781386 .
Also, `key.decrypt` now only throws on error, no other value is returned.
Also, fix typo (rebase error) that caused tests to fail in Safari for p521.
2020-09-14 15:35:27 +02:00
Dan Ristea
ca2fb080af
JSdoc types & ESLint fixes ( #1132 )
2020-09-14 15:35:27 +02:00
larabr
3b39ce8d37
Finish merging key validation
2020-09-14 15:35:27 +02:00
Daniel Huigens
635c92bc6a
Rename SymEncryptedAEADProtectedDataPacket to AEADEncryptedDataPacket
2020-09-14 15:35:27 +02:00
Daniel Huigens
fcf0a4b189
Allow dead code elimination
2020-09-14 15:35:27 +02:00
Daniel Huigens
38af2d18cb
Use dynamic import in lightweight build
...
Instead of dynamically loading a <script> tag.
This also removes the non-module lightweight build.
2020-09-14 15:35:26 +02:00
Daniel Huigens
815dba04d8
Remove compat polyfills
2020-09-14 15:35:26 +02:00
Daniel Huigens
4be4052f91
Replace remaining grunt tasks with npm scripts
2020-09-14 15:35:26 +02:00
Daniel Huigens
9cf2d56595
Switch build system to rollup
...
Also, default to minimized builds.
2020-09-14 15:35:26 +02:00
Ilya Chesnokov
483798701f
Rename enums to use camelCase ( #1093 )
2020-09-14 15:35:26 +02:00
Ilya Chesnokov
a15c5c81f1
Switch util function names to camelCase ( #1091 )
2020-09-14 15:35:26 +02:00
Ilya Chesnokov
a75ecf1169
Rename config option names to camelCase ( #1088 )
2020-09-14 15:35:23 +02:00
Daniel Huigens
962486c7c3
Allow key.validate() to pass if it has a GNU dummy primary key
...
A valid signing subkey is required, in this case.
2020-09-14 15:34:57 +02:00
larabr
c869cb668c
Remove worker ( #1072 )
2020-09-14 15:34:57 +02:00
larabr
8f89ec9c0c
Remove 3DES and CAST5 from default preferred symmetric algorithms ( #1068 )
2020-09-14 15:34:57 +02:00
larabr
ca9129322d
Remove SHA-1 from default preferred hash algorithms ( #1067 )
...
Also, remove SHA-1 from the (unused) KDF params constructor defaults.
2020-09-14 15:34:57 +02:00
larabr
54ea245c81
Generate ECC keys by default ( #1065 )
...
Also, remove the deprecated numBits options of generateKey in favor of rsaBits.
2020-09-14 15:34:57 +02:00
larabr
75dd25661a
Use V5 keys by default ( #1063 )
2020-09-14 15:34:57 +02:00
larabr
f8f8d3e387
Use AEAD protection by default ( #1062 )
2020-09-14 15:34:57 +02:00
Daniel Huigens
e9ffee50b2
Return only one key in key.read[Armored], add readAll[Armored]
2020-09-14 15:34:48 +02:00
Daniel Huigens
fe90df2b5e
Throw on unarmored messages with garbage data appended
2020-09-14 15:22:57 +02:00
Daniel Huigens
5af597fe03
Don't mutate key in openpgp.encryptKey/decryptKey
2020-09-14 15:22:57 +02:00
Daniel Huigens
86c85a4341
Throw in openpgp.initWorker if worker failed to load
2020-09-14 15:22:57 +02:00
Daniel Huigens
c4d5f2325b
Unit tests: Fix autoscroll with skipped tests
2020-09-14 15:22:57 +02:00
Daniel Huigens
bd856de0c8
Don't unnecessarily return objects in top-level functions
...
openpgp.encrypt, sign, encryptSessionKey, encryptKey and decryptKey now
return their result directly without wrapping it in a "result" object.
Also, remove the `detached` and `returnSessionKey` options of
openpgp.encrypt.
2020-09-14 15:22:57 +02:00
Daniel Huigens
bc91ac302d
Skip test for OpenPGP.js inside an application worker in old Edge
...
Old Edge doesn't support crypto.getRandomValues inside a Worker.
2020-09-14 15:22:57 +02:00
Daniel Huigens
741961f809
Don't use native streams in old Edge
2020-09-14 15:22:57 +02:00
Daniel Huigens
020b337a3a
Don't overwrite Web Streams Polyfill to globals
...
Instead, use the ponyfill that's now included in web-stream-tools.
Also, convert back to native ReadableStream when we used the ponyfill.
2020-09-14 15:22:57 +02:00
Daniel Huigens
479cd2e4e5
Return strings in Node streams where appropriate
2020-09-14 15:22:56 +02:00
Daniel Huigens
3f737965db
Return data instead of message in encryptSessionKey
...
Add `armor=true/false` parameter to decide whether `data` is an armored
String or an unarmored Uint8Array.
2020-09-14 15:22:56 +02:00
Daniel Huigens
75c41eacfd
Return data as string in openpgp.verify by default
...
Add format='utf8'/'binary' param to openpgp.verify in order to be able
to return binary data instead.
2020-09-14 15:22:56 +02:00
Daniel Huigens
d2ac8933e2
Return Uint8Array(Stream) instead of object when armor = false
2020-09-14 15:22:56 +02:00
larabr
2eab8a1ebc
Add config option to allow insecure decryption with RSA signing keys ( #1148 )
2020-08-28 16:09:56 +02:00
larabr
cc1bdcbae8
Allow decryption with revoked keys ( #1135 )
...
However, when decrypting session keys, check that the public key
algorithm matches that of the decryption key.
2020-08-18 15:49:27 +02:00
Wiktor Kwapisiewicz
2e26509723
Add test case for unknown binary notations ( #1140 )
2020-08-18 13:37:36 +02:00
Wiktor Kwapisiewicz
0712e8af2d
Support non-human-readable notation values ( #983 )
...
This change adds support for binary (non-human-readable) values in
signature notations through `rawNotations` property on signature objects.
Human-readable notations will additionally appear in `notations` object
where the value of the notation will be deserialized into a string.
Additionally the check for human-readable flag was modified to check the
existence of the flag instead of comparison with the whole value.
2020-08-18 11:07:58 +02:00
larabr
25bf080871
Add SecretKey.prototype.makeDummy ( #1131 )
2020-08-03 15:52:50 +02:00
larabr
e29de76dc1
Use correct algorithm in ECC validation tests
2020-07-23 19:21:34 +02:00
larabr
14f244a80f
Fix decryption tests
2020-07-17 15:14:21 +02:00
larabr
8783caa828
Fix key validation tests
2020-07-16 22:56:06 +02:00
larabr
00c5f38689
Cipher-specific key validation ( #1116 )
...
Also, check binding signatures for decryption keys.
Also, do not always fallback on Web Crypto ECC errors.
2020-07-13 19:57:33 +02:00
larabr
35b0012f2f
Pass around KDF params as object ( #1104 )
2020-06-03 14:16:54 +02:00
Daniel Huigens
5d71ae8691
Fix normalizing \n after \r\n
...
Broken in c4a7455 .
2020-04-22 19:09:50 +02:00
larabr
6119dbb08e
Support verification of text signatures on non-UTF-8 messages ( #1071 )
2020-03-30 12:51:07 +02:00