mirror of
https://github.com/BitskiCo/jwk-rs
synced 2024-11-21 19:49:20 +00:00
Bump dependencies
This commit is contained in:
parent
952a80199e
commit
07ff6341af
14
Cargo.toml
14
Cargo.toml
@ -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
1
rust-toolchain
Normal file
@ -0,0 +1 @@
|
||||
stable
|
16
src/lib.rs
16
src/lib.rs
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user