1
0
mirror of https://github.com/BitskiCo/jwk-rs synced 2024-11-22 03:49:22 +00:00

Bump dependencies

This commit is contained in:
Nick Hynes 2021-07-28 15:01:39 +08:00
parent 952a80199e
commit 07ff6341af
No known key found for this signature in database
GPG Key ID: 5B3463E9F1D73C83
3 changed files with 14 additions and 17 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "jsonwebkey"
version = "0.3.2"
version = "0.3.4"
authors = ["Nick Hynes <nhynes@nhynes.com>"]
description = "JSON Web Key (JWK) (de)serialization, generation, and conversion."
readme = "README.md"
@ -10,18 +10,18 @@ license = "MIT"
edition = "2018"
[dependencies]
base64 = "0.12"
base64 = "0.13"
bitflags = "1.2"
generic-array = "0.14"
jsonwebtoken = { version = "7.2", optional = true }
num-bigint = { version = "0.2", optional = true }
p256 = { version = "0.3", optional = true }
rand = { version = "0.7", optional = true }
num-bigint = { version = "0.4", optional = true }
p256 = { version = "0.9", optional = true, features = ["arithmetic"] }
rand = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
yasna = { version = "0.3", optional = true, features = ["num-bigint"] }
zeroize = { version = "1.1", features = ["zeroize_derive"] }
yasna = { version = "0.4", optional = true, features = ["num-bigint"] }
zeroize = { version = "1.4", features = ["zeroize_derive"] }
[features]
pkcs-convert = ["num-bigint", "yasna"]

1
rust-toolchain Normal file
View File

@ -0,0 +1 @@
stable

View File

@ -410,20 +410,16 @@ impl Key {
/// Used with the ES256 algorithm.
#[cfg(feature = "generate")]
pub fn generate_p256() -> Self {
use p256::elliptic_curve::generic_array::GenericArray;
use rand::RngCore;
use p256::elliptic_curve::{self as elliptic_curve, sec1::ToEncodedPoint};
let mut sk_bytes = GenericArray::default();
rand::thread_rng().fill_bytes(&mut sk_bytes);
let sk = p256::SecretKey::new(sk_bytes);
let sk_scalar = p256::arithmetic::Scalar::from_secret(sk).unwrap();
let sk = elliptic_curve::SecretKey::random(&mut rand::thread_rng());
let sk_scalar = p256::Scalar::from(&sk);
let pk = p256::arithmetic::ProjectivePoint::generator() * &sk_scalar;
let pk = p256::ProjectivePoint::generator() * sk_scalar;
let pk_bytes = &pk
.to_affine()
.unwrap()
.to_uncompressed_pubkey()
.into_bytes()[1..];
.to_encoded_point(false /* compress */)
.to_bytes()[1..];
let (x_bytes, y_bytes) = pk_bytes.split_at(32);
Self::EC {