Commit Graph

95 Commits

Author SHA1 Message Date
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
Vincent Prouillet e3a4294e85 Move to serde + base64
Remove Part trait
Move tests to tests directory
Reorganise code
2017-04-11 12:40:40 +09:00
Vincent Prouillet 634d75e8fa to_owned -> to_string 2016-12-26 13:24:18 +09:00
Vincent Prouillet 257218bc14 Remove silly match 2016-08-23 18:03:33 +01:00
Vincent Prouillet 3f986f54a8 rust-crypto -> ring 2016-08-23 17:39:18 +01:00
Félix Saparelli 1b7ec1057a Expose sign() and verify() 2016-04-24 19:18:26 +12:00
Warts Werdna 6d50f5bcd1 test if header.alg matches algorithm passed to decode() 2016-04-02 12:44:34 +02:00
Warts Werdna 58b617bbcb add a test for completely normal decoding 2016-04-02 12:44:34 +02:00
Vincent Prouillet 92bc6b8dd4 Release 1.1.1 2016-03-29 16:28:57 +01:00
Warts Werdna 412ed97389 custom json encoder omits None when serializing 2016-03-19 20:21:11 +01:00
Jonathan Fok kan 438d264fa9 Implemented std::error::Error for jwt::errors::Error 2016-02-28 12:30:39 -05:00
Vincent Prouillet 002f8a8c7f Change order of encode method args + make alg field public 2015-12-21 19:24:13 +00:00
Vincent Prouillet f7e87663e2 More examples + fix header struct access 2015-12-20 01:17:10 +00:00
Vincent Prouillet 3930338105 Move macro out of decode + some docstring changes 2015-12-20 01:03:20 +00:00
Vincent Prouillet 275c95281f Use bytes for secret on encode as well for symmetry 2015-12-20 00:41:22 +00:00
Vincent Prouillet 1179eb8b55 Add all params of header from RFC 2015-12-18 21:07:48 +00:00
Markus Unterwaditzer d6d0ce058b Allow non-UTF8 keys for decoding too 2015-12-16 18:40:28 +01:00
Kevin Butler 3dc9295a54 Allow custom encoded types for Part 2015-11-06 22:45:47 +00:00
Kevin Butler 0f41c31687 Precompute headers 2015-11-06 22:45:47 +00:00
Kevin Butler 4ebcfca049 Rewrite decode 2015-11-06 22:45:47 +00:00
Kevin Butler 486c4a87f9 Use constant time comparison for hmacs, see MacResult::code for warning 2015-11-06 17:23:29 +00:00
Kevin Butler 6138bf3dce Minor test cleanup 2015-11-06 17:23:29 +00:00
Kevin Butler 09c4d14609 Weaken parameter requirements for encode 2015-11-06 17:23:29 +00:00
Kevin Butler b1c10c7085 Weaken parameter requirements for Part::from_base64 2015-11-05 17:11:48 +00:00
Vincent Prouillet 6ae77c0b06 Make Algorithm encodable/decodable rather than using String 2015-11-02 23:12:01 +00:00
Vincent Prouillet 61bbe889f2 Add sha384 and sha512
Thanks to irc user durka42
2015-11-02 23:09:09 +00:00
Vincent Prouillet b3663e90c6 Uncomment alg comparison 2015-11-02 21:22:21 +00:00
Vincent Prouillet 96acf8f143 Move benches to a folder + add license 2015-11-02 21:15:45 +00:00
Vincent Prouillet d29f670989 Add mini docs 2015-11-01 22:59:42 +00:00
Vincent Prouillet 3452ba26d1 Add basic working code 2015-11-01 22:31:46 +00:00
Vincent Prouillet 2253cdec4f wip crypto 2015-11-01 19:32:43 +00:00
Vincent Prouillet 7585a7f0f9 Initial commit 2015-10-31 15:37:15 +00:00