Commit graph

65 commits

Author SHA1 Message Date
Filip Skokan
5b53cb0155 fix: limit calculation of missing RSA private components
- this deprecates the use of `JWK.importKey` in favor of
`JWK.asKey`
- this deprecates the use of `JWKS.KeyStore.fromJWKS` in favor of
`JWKS.asKeyStore`

Both `JWK.importKey` and `JWKS.KeyStore.fromJWKS` could have resulted
in the process getting blocked when large bitsize RSA private keys
were missing their components and could also result in an endless
calculation loop when the private key's private exponent was outright
invalid or tampered with.

The new methods still allow to import private RSA keys with these
optimization key parameters missing but its disabled by default and one
should choose to enable it when working with keys from trusted sources

It is recommended not to use @panva/jose versions with this feature in
its original on-by-default form - v1.1.0 and v1.2.0 These will
2019-06-20 23:32:13 +02:00
Filip Skokan
9d46c48fd5 feat: add support for JWK x5c, x5t and x5t#S256 2019-05-25 22:34:28 +02:00
Filip Skokan
2eae293760 feat: instances of JWKS.KeyStore are now iterable (e.g. for ... of) 2019-05-25 22:18:27 +02:00
Filip Skokan
6e3d6fd111 feat: compute private RSA key p, q, dp, dq, qi when omitted
resolves #26
2019-05-23 19:51:45 +02:00
Filip Skokan
b0ff436daf fix: reject rsa keys without all factors and exponents with a specific message 2019-05-23 19:20:30 +02:00
Filip Skokan
46eb7edb80 refactor: mention thumbprint rather then kid in ref oct key thumbprint 2019-03-01 19:42:10 +02:00
Filip Skokan
857dc2b51b fix: fail to import invalid PEM formatted strings and buffers 2019-04-23 14:30:51 +02:00
Filip Skokan
23b874cc20 feat: add JWK key_ops support, fix .algorithms() op returns
BREAKING CHANGE: key.algorithms(op) un+wrapKey was split into correct
wrapKey/unwrapKey/deriveKey returns

BREAKING CHANGE: keystore.all and keystore.get `operation` option was
removed, `key_ops: string[]` supersedes it
2019-04-23 14:30:51 +02:00
Filip Skokan
4ace4be99d test: check kid/thumbprint is not the same when kid is provided 2019-04-23 14:30:50 +02:00
Filip Skokan
1159b0df4e feat: add key.toPEM() export function with optional encryption 2019-04-23 14:30:50 +02:00
Filip Skokan
2dbd3ed43a feat: add OKP Key and EdDSA sign/verify support
BREAKING CHANGE: node.js minimal version is now v12.0.0 due to its
added EdDSA support (crypto.sign, crypto.verify and eddsa key objects)

resolves #12
2019-04-23 14:30:49 +02:00
Filip Skokan
e21fea106b revert: add EC P-256K JWK and ES256K sign/verify support
BREAKING CHANGE: removing ES256K alg and EC P-256K crv support until the
IETF WG decides on what the final names will be.
2019-04-07 14:13:10 +02:00
Filip Skokan
2dd7053a4a feat: add key.secret<boolean> and key.type<string> for completeness 2019-04-01 20:26:47 +02:00
Filip Skokan
764b86309c fix: properly restrict EC curves in generate(Sync) 2019-03-28 09:42:27 +01:00
Filip Skokan
cfa4222e6c fix: throw on unsupported EC curves 2019-03-27 11:13:01 +01:00
Filip Skokan
2e33e1cc2b feat: add EC P-256K JWK and ES256K sign/verify support 2019-03-27 10:35:02 +01:00
Filip Skokan
a6d83d1d8e refactor: explicitly check EC curves supported 2019-03-26 09:42:22 +01:00
Filip Skokan
fe0003603d refactor: remove ec length, generate only returns keyobject 2019-03-20 18:46:36 +01:00
Filip Skokan
9af295bdb2 fix: restrict RS key algorithms by the key's bit size 2019-03-17 17:44:36 +01:00
Filip Skokan
cc70c5d4ec fix: all JWA defined RSA operations require key of 2048 or more
BREAKING CHANGE: all [JWA](https://tools.ietf.org/html/rfc7518) defined
RSA based operations require key size of 2048 bits or more.
2019-03-16 09:44:34 +01:00
Filip Skokan
be215f48cd test: check unsupported JWA algorithms 2019-03-11 22:35:00 +01:00
Filip Skokan
d15be00284 test: check unsupported key object import fails 2019-03-11 22:29:07 +01:00
Filip Skokan
17b37d3dc9 fix: do not list "dir" under wrap/unwrapKey operations
BREAKING CHANGE: "dir" is no longer returned as wrap/unwrapKey key
operation
2019-03-11 21:51:13 +01:00
Filip Skokan
2ad441831d refactor: use import rather then new 2019-03-11 21:28:45 +01:00
Filip Skokan
6453e1ffc9 refactor: require order and base64url split encode buffer/string 2019-03-06 22:12:43 +01:00
Filip Skokan
3d8b3a5fe8 test: re-enable lint, test with min node, remove BLNS 2019-03-06 21:50:25 +01:00
Filip Skokan
68548603da fix: "dir" is only available on keys with correct lengths 2019-03-04 23:04:55 +01:00
Filip Skokan
be3f4e4b7e fix: do not 'in' operator when importing keys as string 2019-03-04 22:56:25 +01:00
Filip Skokan
d5fc18e4d2 refactor: less relying on KeyObject prototype 2019-03-04 20:04:42 +01:00
Filip Skokan
4460c4c88f refactor: key keyObject property is private 2019-02-28 21:08:31 +01:00
Filip Skokan
ca4355be19 chore: include third party license 2019-02-27 22:51:38 +01:00
Filip Skokan
dba1abdaf3 feat: add JWT.sign/verify/decode 2019-02-27 22:38:30 +01:00
Filip Skokan
8dd95426dc feat: add JWKS.KeyStore.fromJWKS() and JWK.isKey() 2019-02-26 22:51:25 +01:00
Filip Skokan
e9f5fdcfc8 feat: verify and decrypt complete option returns the matched key as well 2019-02-26 22:45:02 +01:00
Filip Skokan
0a6027d62a refactor: add .d.ts and simplify errors 2019-02-25 21:27:39 +01:00
Filip Skokan
546840d55c feat: throw JOSEMultiError when general formats and keystore use 2019-02-24 14:05:57 +01:00
Filip Skokan
77fe241aa7 feat: add decrypt/verify complete and algorithm options 2019-02-22 22:26:33 +01:00
Filip Skokan
581215f5d7 test: cleanup cookbook 2019-02-21 23:48:21 +01:00
Filip Skokan
cb718b545b feat: add JWE zip support 2019-02-21 23:39:32 +01:00
Filip Skokan
962c1f5021 feat: b64 (rfc7797) support 2019-02-21 22:51:32 +01:00
Filip Skokan
7bc3cc4c71 feat: resolving alg/enc, crit members, add tests 2019-02-20 23:12:08 +01:00
Filip Skokan
869438c798 refactor: jwe/jws serializer detection 2019-02-19 23:30:57 +01:00
Filip Skokan
505fe3c35d test: enc/dec input check tests 2019-02-17 09:29:44 +01:00
Filip Skokan
de352bf209 test: add keystore tests 2019-02-17 17:14:16 +01:00
Filip Skokan
1eb041355e test: keystore decrypt and verify 2019-02-17 16:23:09 +01:00
Filip Skokan
6f44bf4b7d test: add generate failure tests 2019-02-16 14:54:49 +01:00
Filip Skokan
44848fd879 test: add timingSafeEqual tests 2019-02-16 14:18:30 +01:00
Filip Skokan
bcd920600d test: keystore verify 2019-02-16 14:12:47 +01:00
Filip Skokan
cc89d4e02b refactor: cleanup, TODO chores 2019-02-10 21:39:59 +01:00
Filip Skokan
775ea638b6 chore: cleanup 2019-02-10 17:45:55 +01:00