Commit Graph

131 Commits

Author SHA1 Message Date
Vincent Prouillet c9442834ed Make DecodingKey own all the data
Closes #120
Supersedes #128
2022-02-02 22:10:11 +01:00
Vincent Prouillet 60c92f2882 Fix clippy 2022-02-02 22:10:11 +01:00
Vincent Prouillet f50e4901cb Avoid allocation 2022-02-02 22:10:11 +01:00
Adrian Black 2aad217087 add verify_sig fn (#161)
* add verify_sig fn

* fix missing comma

* fmt whitespace changes
2022-02-02 22:10:11 +01:00
Vincent Prouillet d2c8ae3f11 Impl PartialEq for ErrorKind
Closes #125
2022-02-02 22:10:11 +01:00
Vincent Prouillet 5c706b005a Remove deprecated fn 2022-02-02 22:10:11 +01:00
Vincent Prouillet 2c9c57fc4b Expose get_current_timestamp
Closes #152
2022-02-02 22:10:11 +01:00
Vincent Prouillet 30571cafd2 Keep RSA key error message from ring
Closes #164
2022-02-02 22:10:11 +01:00
Vincent Prouillet ea4ed55551 Bytes everywhere for sign/verify 2022-02-02 22:10:11 +01:00
Charles Lehner 4aee8bc382 Add sign and verify on bytes (#150) 2022-02-02 22:10:11 +01:00
Charles Lehner 2178cc7506 Add EdDSA (Ed25519) (#154) 2022-02-02 22:10:11 +01:00
Arniu Tseng 2f25cbed0a
Add note about encoding keys (#163)
* Add note about encoding keys

* Update encoding.rs

* Format code
2020-12-07 16:00:44 +01:00
Piotr Maks 90b9700748
Clippy (#146)
* Bump minimum required Rust version to 1.40

Motivation for this change is use of `#[non_exhaustive]` attribute that
was stabilized in Rust 1.40.0

* Migrate benchmarks to criterion

Remove use of unstable features in favour of criterion benchmarks

* Enable clippy in Github Actions

* Fix clippy::manual_non_exhaustive

Remove manual implementations of the non-exhaustive pattern. Instead
use the `#[non_exhaustive]` attribute.

* Allow reexport of deprecated function

Silence rustc `deprecated` working in function reexport

* Remove redundant clone

* Fix various clippy warnings

* Remove redundant pattern
* Use `unreachable!()` to fail test
* No need to add `&` to all patterns
2020-08-31 12:04:57 +02:00
Piotr Maks 29aad97739
Format code and check style in Github Actions (#145) 2020-08-07 18:10:26 +02:00
Craig Colegrove 64f276c814
Add new function and tests (#138)
Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-06-30 20:03:53 +02:00
Vincent Prouillet 6262b4700b Slight tweaks 2020-06-30 19:58:11 +02:00
Craig Colegrove 636c0dc203
Rename dangerous_unsafe_decode to dangerous_insecure_decode (#139)
* Rename dangerous_unsafe_decode to dangerous_insecure_decode

* Add back old function name with deprecation flag
2020-06-30 19:50:45 +02:00
Craig Colegrove 693a100128
Derive Hash for Header and Algorithm (#137) 2020-06-16 12:04:22 +02:00
Hexilee 946aef1b57 revert breaking change of DecodingKey 2020-02-28 15:20:41 +08:00
Hexilee a750d5586f fix issue 120: DecodingKey can be converted to static 2020-02-28 01:26:58 +08:00
FujiApple 2f359b515c - Fix recursive `Display::fmt` implementation on `Error` to avoid stack overflow
- Added unit test to cover a sample case
2020-01-31 13:11:40 +08:00
Vincent Prouillet c2f6093309 Get rid of deprecrated std error description 2020-01-27 20:52:46 -08:00
Vincent Prouillet 689cc6d32e Validate key type with algo in encode/decode 2020-01-13 19:41:06 +01:00
Vincent Prouillet 4dd2f12c6d Remove EncodingKey lifetime 2020-01-02 19:40:53 +01:00
Vincent Prouillet 77ae0effc8 Add DecodingKey 2019-12-29 21:50:06 +01:00
Vincent Prouillet 0abeeac25f Add EncodingKey 2019-12-29 19:33:17 +01:00
Vincent Prouillet bfcfc1d341 Handle aud not being a sequence
Closes #110
2019-11-28 19:27:33 +01:00
Vincent Prouillet d550c5f318 Add more tests and document SEC1 lack of support 2019-11-15 20:16:38 +01:00
Vincent Prouillet 6e8d4a4be6 Remove pem encoding for now 2019-11-14 19:48:38 +01:00
Vincent Prouillet 51dacd9bc4 Update docs 2019-11-14 19:43:43 +01:00
Vincent Prouillet 8e4757cb1d More refactoring in the crypto mod 2019-11-11 20:29:57 +01:00
Vincent Prouillet 1f6d0ffb2c Refactor decoding 2019-11-11 20:16:34 +01:00
Vincent Prouillet 8169ee3d9f Remove chrono from deps 2019-11-11 19:47:35 +01:00
Vincent Prouillet 614f3610a7 Fix stupid bug 2019-11-11 12:08:11 +01:00
Vincent Prouillet b27981549f Not working yet jwk decoding 2019-11-09 11:42:40 +00:00
Vincent Prouillet 34ea194179 Move crypto to a dir 2019-11-08 19:00:19 +00:00
Vincent Prouillet e3632b3a2c Remove Key approach in favour of &[u8] with pem 2019-11-06 22:32:13 +00:00
Vincent Prouillet a6ea8c2c1a clippy + fmt 2019-11-06 18:41:51 +00:00
Vincent Prouillet 382e4478cf Move pem encoding tests 2019-11-06 18:30:59 +00:00
Levi 53188e1f40 Add functions to create pems and ders of the public keys (#108) 2019-11-06 13:58:49 +00:00
Vincent Prouillet 73d96357c3 Simplify header decoding 2019-11-03 16:13:22 +00:00
Vincent Prouillet 417e00780d Use serde with derive feature 2019-11-03 15:46:08 +00:00
Vincent Prouillet 210e96063d Reorganise tests 2019-11-03 15:36:19 +00:00
Vincent Prouillet caef740ad4 Refactoring + more idiomatic enum names 2019-11-03 13:17:04 +00:00
Vincent Prouillet 06bebeaae3 cargo fmt 2019-11-03 12:55:36 +00:00
Vincent Prouillet b9a3e3086f Fix Option handling 2019-11-03 12:36:52 +00:00
Levi 571898252f Add PEM decoding support (#106)
* Add PEM support with pem and simple_asn1. Documentation TODO

* Make pkcs1 and pkcs8 versions of the RSA key, confirm they pass tests.

* Add documentation, simplify

* Update readme

* Bump pem version

* Remove extra print
2019-11-03 12:22:51 +00:00
dowwie 60a030874a updated imports in validation.rs 2019-10-31 14:12:08 -04:00
dowwie 68d6c84c8c revised set_audience, cleaned up validation, and cleared compiler warnings 2019-10-28 11:49:02 -04:00
dowwie 0d7184a787 added update to aud type and aud validation 2019-10-27 15:14:52 -04:00
Brian Smith f7423d075a Use *ring* 0.16.5. 2019-08-10 11:38:54 -10:00
Vincent Prouillet 10105af2fd Add support for modulus/exponent 2019-07-13 17:43:44 +02:00
Vincent Prouillet b8627260b2 Update to edition 2018 2019-07-06 20:36:32 +02:00
Vincent Prouillet 20013a4e4f Fixed conflicts 2019-06-16 18:00:00 +02:00
Vincent Prouillet 84ee604e88 trait -> enum 2019-06-16 17:51:43 +02:00
Kan-Ru Chen c26bdf7e06 Support for RSASSA-PSS signing algorithm
As specified in https://tools.ietf.org/html/rfc7518#section-3.5

- PS256 - RSASSA-PSS using SHA-256 hash algorithm
- PS384 - RSASSA-PSS using SHA-384 hash algorithm
- PS512 - RSASSA-PSS using SHA-512 hash algorithm
2019-06-08 03:08:54 +09:00
Jake Shadle 6cfb5c7c0e Add Key trait and the supported formats 2019-05-15 16:19:38 +02:00
Max Burke f68210c688
Fix algorithm mapping.
RS256/384/512 algorithm strings were mapped to HMAC-SHA256/384/512
enumerators.
2019-05-10 16:36:28 -07:00
Vincent Prouillet b4e0ae5f6d
Merge branch 'next' into master 2019-03-22 09:24:02 +01:00
Vincent Prouillet be27206088 Remove iat validation, it isnt supposed to be done 2019-02-04 18:44:08 +01:00
Vincent Prouillet 86dce0003e
Merge pull request #72 from endor/master
Fix documentation of default values in validation
2019-02-04 18:36:48 +01:00
Jasper Bryant-Greene e10b049d9a implemented verification of ECDSA signatures and added tests 2019-02-01 12:11:20 +08:00
Frank Prößdorf 2793bc2be4 Fix documentation of default values in validation 2019-01-18 09:31:56 +02:00
Alex Gaynor 716fe8b64d Upgraded ring to 0.14 2019-01-13 00:20:34 +00:00
Jasper Bryant-Greene 9883fab729 implemented ECDSA signing, updated ring to 0.14 alpha 2019-01-09 09:46:06 +08:00
Jasper Bryant-Greene 6768230077 Added ES256/ES384/ES512 Algorithm stubs 2019-01-09 09:18:49 +08:00
Vincent Prouillet 8f0809318d rustfmt 2018-10-28 19:58:35 +01:00
Vincent Prouillet d63af8d6e0 clippy 2018-10-28 19:58:06 +01:00
himanoa 4bd4c8b3de feat: Implement FromStr trait for Algorithm 2018-08-31 03:53:55 +09:00
Vincent Prouillet c78574aae4 Remove some commented out code 2018-07-26 09:43:21 +02:00
Vincent Prouillet 5528497f5a Fix validation not working properly
Close #51
2018-07-25 15:42:02 +02:00
Vincent Prouillet 109978ab6b Remove error-chain
Fix #52, #56, #57
2018-07-25 14:46:30 +02:00
Mike Engel d30a7599a8
Add a method to decode a token without signature validation
- Solves #48
- `dangerous_unsafe_decode`
- No docs (aside from cargo) since people probably shouldn't use it
2018-03-13 20:47:43 -06:00
Vincent Prouillet eae3743017 Make it mandatory to specify algorithm 2017-10-22 13:23:46 +02:00
Vincent Prouillet b30a2cc5e5 v3.0 2017-09-08 16:23:15 +09:00
Vincent Prouillet 3985915da6 Update error-chain and make typ public 2017-09-07 16:46:40 +09:00
Vincent Prouillet 7e36d3f7bb Update ring and fix leeway docs 2017-08-30 18:09:57 +09:00
Vincent Prouillet 5839cb4552 Don't serialize typ if None 2017-08-26 09:54:20 +09:00
Vincent Prouillet 43a20030ee Update docs 2017-08-25 17:54:19 +09:00
Vincent Prouillet 983380d1ab Make typ an Option in Header 2017-08-25 17:51:44 +09:00
Vincent Prouillet d213fb8a62 Remove validate_signature option and add decode_header 2017-08-25 17:48:53 +09:00
Mike Engel 5758c0008c
Make the `TokenData` struct public 2017-07-02 15:49:14 -06:00
Jacob Chang 8b4228cba1 Update dependencies (#33)
* Update ring to 0.11.0

* Update chrono to 0.4

* Bump to version 2.0.2
2017-06-24 15:15:45 +09:00
Vincent Prouillet 0faa2419d6 Merge pull request #32 from Kerollmops/doc
Correct markdown visual errors
2017-06-13 19:03:18 +09:00
Clement RENAULT e5f518a860 doc: Correct markdown visual errors 2017-06-13 10:51:10 +02:00
Clement RENAULT eda92188c9 default: Better usage of the default Trait 2017-06-13 10:25:21 +02:00
Brian Smith 58899486bc Update to *ring* 0.9.4. 2017-05-08 18:37:56 -10:00
Vincent Prouillet 8c492f1413 Update base64 crate 2017-04-23 14:16:38 +09:00
Vincent Prouillet fc9f83b837 No need to pass an algorithm to decode 2017-04-22 15:21:44 +09:00
Mike Engel cbd9b236da
Remove trait from `TokenData` struct 2017-04-21 23:41:25 -06:00
Mike Engel 0932f14bc2
Migrate `Deserialize` trait to `DeserializeOwned` for Serde 1.0 2017-04-21 23:21:04 -06:00
Vincent Prouillet 57c513c757 Actually take a ref to Validation
Seems like I updated the docs but not the code...
2017-04-14 20:32:40 +09:00
Vincent Prouillet 64ad3187eb Cleanup crypto nesting and remove error-chain default features 2017-04-14 20:23:28 +09:00
Vincent Prouillet d144227256 Reorganise a bit and add more docs 2017-04-13 16:36:32 +09:00
Vincent Prouillet 35fd9d63cc Add some docs 2017-04-13 10:08:07 +09:00
Vincent Prouillet 50d676865f Add test for decode without validating signature 2017-04-12 18:03:28 +09:00
Vincent Prouillet 410499e6b6 Add validation 2017-04-12 17:51:05 +09:00
Vincent Prouillet c244e835e0 Take ref to Header, not by value 2017-04-11 12:54:32 +09:00
Vincent Prouillet 67497950c6 RSA working 2017-04-11 12:41:21 +09:00
Vincent Prouillet f7d0a7a002 Work on RSA 2017-04-11 12:40:55 +09:00