larabr
8854b097b4
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.
2021-02-09 19:25:20 +01:00
Ilya Chesnokov
6e648b1cbc
Rename enums to use camelCase ( #1093 )
2021-02-09 19:25:20 +01:00
Ilya Chesnokov
e16807505f
Switch util function names to camelCase ( #1091 )
2021-02-09 19:25:20 +01: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
Daniel Huigens
5a24bc7698
Fix verifying RSA signatures with leading zero in Web Crypto
2019-11-29 11:39:38 +01:00
Ilya Chesnokov
6e7f399eb3
Use Web Crypto & Node crypto for RSA signing and verifying ( #999 )
...
Also, when generating RSA keys in JS, generate them with p < q, as per
the spec.
Also, when generating RSA keys using Web Crypto or Node crypto, swap the
generated p and q around, so that will satisfy p < q in most browsers
(but not old Microsoft Edge, 50% of the time) and so that we can use the
generated u coefficient (p^-1 mod q in OpenPGP, q^-1 mod p in RFC3447).
Then, when signing and verifying, swap p and q again, so that the key
hopefully satisfies Safari's requirement that p > q, and so that we can
keep using u again.
2019-11-18 14:59:01 +01:00
Daniel Huigens
a6d7c466e2
Use serialized EdDSA public key when signing instead of deriving it
2019-11-08 17:10:47 +01:00
Ilya Chesnokov
08b7725b8c
Create lightweight build that can lazily load indutny/elliptic if needed ( #956 )
...
This PR adds four config options to configure whether and how to load
indutny/elliptic: use_indutny_elliptic, external_indutny_elliptic,
indutny_elliptic_path and indutny_elliptic_fetch_options.
Also:
- Use tweetnacl.js instead of indutny/elliptic for curve25519 key generation
- Don't initialize indutny's curve25519, improving performance when using that curve
- Verify NIST signatures using Web Crypto instead of indutny/elliptic when not streaming
- Move KeyPair.sign/verify to ecdsa.js
- Move KeyPair.derive to ecdh.js
- Move keyFromPrivate and keyFromPublic to a new indutnyKey.js file
2019-10-25 16:07:57 +02:00
Ilya Chesnokov
6d626ea70c
Style fixes and new style rules for eslint ( #919 )
2019-06-28 15:33:18 +02:00
Daniel Huigens
1090464a70
Throw more informative error when trying to use a key with missing params
...
E.g. when trying to sign with a GPG stripped key without a valid signing
subkey.
2019-05-03 14:29:43 +02:00
Daniel Huigens
be1b4df140
Use tweetnacl's Ed25519 implementation
2019-05-02 12:08:08 +02:00
Daniel Huigens
ca537e439d
Comments & code style
2018-08-14 16:35:38 +02:00
Daniel Huigens
ade2627bca
Streaming verify one-pass signatures
2018-08-10 14:44:01 +02:00
Daniel Huigens
4ada3fa590
Don't mutate prototypes of Uint8Array, ReadableStream and ReadableStreamDefaultWriter
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
Mahrud Sayrafi
a5e7562066
Many documentation improvements; more to come
2018-03-08 19:27:57 -08:00
Mahrud Sayrafi
08da24de27
documentation fixes
2018-03-08 10:55:58 -08:00
Bart Butler
f57888fe55
change all calls of getRandomBytes and getRandomBN to be async
2018-03-05 16:31:56 -08:00
Mahrud Sayrafi
9e1236c04c
Modernizes util.js
2018-02-28 15:49:41 -08:00
Mahrud Sayrafi
3df0997f4d
Cleanups
2018-02-26 20:01:01 -05:00
Mahrud Sayrafi
1812166a53
RSA using asmcrypto with asmcrypto bignum
2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
605021af3b
Various quickfixes and cleanups
2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
e1d85ba682
ElGamal and MPI use bn.js; TODO: RSA Key Generation
2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
490b1dc0f0
ECDH, ECDSA, EdDSA are all on BN.js; TODO: ElGamal & type_mpi
2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
9200f026f3
Starting to change MPI
2018-02-22 00:37:42 -08:00
Mahrud Sayrafi
2f3c0a86e9
DSA uses BN.js
...
added toBN for type_mpi
2018-02-22 00:37:41 -08:00
Mahrud Sayrafi
b126fd5be7
RSA encrypt/decrypt use asmcrypto as well
...
TODO: RSA key generation, removing jsbn from dsa, elgamal, mpi, etc.
2018-02-22 00:37:41 -08:00
Mahrud Sayrafi
aee8974ef5
RSA signatures now use asmcrypto.js; various fixes and tweaks
2018-02-22 00:37:41 -08: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
Mahrud Sayrafi
d851398b0c
Merge branch 'master' into http-to-https
2018-02-08 10:56:46 -08:00
Mahrud Sayrafi
1383107202
Fixed and unmuted a few eslint errors, ~10 remain
2018-02-07 04:23:16 -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
Sanjana Rajan
a173a63b16
doc fixes
2018-01-30 18:36:26 +01:00
Mahrud Sayrafi
35f18444b0
keygen and sign/verify with ed25519 works
2018-01-30 18:34:54 +01:00
Mahrud Sayrafi
21ae66c604
encrypt/decrypt/sign/verify will always return promises
...
Note: publicKeyEncryptedSessionKey uses promises, symEncryptedSessionKey does not
2018-01-30 18:33:55 +01:00
Mahrud Sayrafi
1a714cec73
ECC with async/await is 'Done, without errors.'
2018-01-30 18:33:55 +01:00
Sanjana Rajan
8794446a66
change some variable names, add some curve parameters
2018-01-30 18:30:17 +01:00
Ismael Bejarano
673151ec87
Read and write ECDSA packets
2018-01-30 18:30:14 +01:00
Tankred Hase
dea42df209
Refactor src/crypto/**/*.js to use import & export
2016-02-05 10:36:09 +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
Thomas Oberndörfer
357d49f7e9
OP-01-026 Errors in EMSA-PKCS1-v1_5 decoding routine (High) and OP-01-018 Suggested improvement in RSA signature verification (Low). Do RSA signature verification as described in RFC 3447 Section 8.2.2. Remove pkcs1.emsa.decode(). Rewrite pkcs1.emsa.encode(). Hash algorithms: throw exception on error condition.
2014-03-26 18:04:58 +01:00
Robert Nelson
f436c85482
Add a bunch of links to documentation
2014-01-05 23:10:19 -08:00
Robert Nelson
dba6f379e8
Fix all the lint noise, mostly semicolons, duplicate var definitions and ==0
2014-01-02 12:24:10 -08:00
Robert Nelson
17ad1f5fed
More documentation fixes
2013-12-26 22:49:37 -08:00
Robert Nelson
8923813580
Fix jsdoc generation and make keyring multiple instance.
...
Add jsdoc @module definitions.
Fix references to old class names.
Make keyring a multiple instance module.
Eliminate unit test dependency on running npm test.
2013-12-22 12:39:11 -08:00
seancolyer
7abaa43497
Initial gruntfile support. Forcing a standardized style.
2013-10-08 22:33:36 -04:00