mirror of
https://github.com/BitskiCo/jwk-rs
synced 2024-11-22 03:49:22 +00:00
Bump dependencies
This commit is contained in:
parent
952a80199e
commit
07ff6341af
14
Cargo.toml
14
Cargo.toml
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "jsonwebkey"
|
name = "jsonwebkey"
|
||||||
version = "0.3.2"
|
version = "0.3.4"
|
||||||
authors = ["Nick Hynes <nhynes@nhynes.com>"]
|
authors = ["Nick Hynes <nhynes@nhynes.com>"]
|
||||||
description = "JSON Web Key (JWK) (de)serialization, generation, and conversion."
|
description = "JSON Web Key (JWK) (de)serialization, generation, and conversion."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -10,18 +10,18 @@ license = "MIT"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.12"
|
base64 = "0.13"
|
||||||
bitflags = "1.2"
|
bitflags = "1.2"
|
||||||
generic-array = "0.14"
|
generic-array = "0.14"
|
||||||
jsonwebtoken = { version = "7.2", optional = true }
|
jsonwebtoken = { version = "7.2", optional = true }
|
||||||
num-bigint = { version = "0.2", optional = true }
|
num-bigint = { version = "0.4", optional = true }
|
||||||
p256 = { version = "0.3", optional = true }
|
p256 = { version = "0.9", optional = true, features = ["arithmetic"] }
|
||||||
rand = { version = "0.7", optional = true }
|
rand = { version = "0.8", optional = true }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
yasna = { version = "0.3", optional = true, features = ["num-bigint"] }
|
yasna = { version = "0.4", optional = true, features = ["num-bigint"] }
|
||||||
zeroize = { version = "1.1", features = ["zeroize_derive"] }
|
zeroize = { version = "1.4", features = ["zeroize_derive"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
pkcs-convert = ["num-bigint", "yasna"]
|
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.
|
/// Used with the ES256 algorithm.
|
||||||
#[cfg(feature = "generate")]
|
#[cfg(feature = "generate")]
|
||||||
pub fn generate_p256() -> Self {
|
pub fn generate_p256() -> Self {
|
||||||
use p256::elliptic_curve::generic_array::GenericArray;
|
use p256::elliptic_curve::{self as elliptic_curve, sec1::ToEncodedPoint};
|
||||||
use rand::RngCore;
|
|
||||||
|
|
||||||
let mut sk_bytes = GenericArray::default();
|
let sk = elliptic_curve::SecretKey::random(&mut rand::thread_rng());
|
||||||
rand::thread_rng().fill_bytes(&mut sk_bytes);
|
let sk_scalar = p256::Scalar::from(&sk);
|
||||||
let sk = p256::SecretKey::new(sk_bytes);
|
|
||||||
let sk_scalar = p256::arithmetic::Scalar::from_secret(sk).unwrap();
|
|
||||||
|
|
||||||
let pk = p256::arithmetic::ProjectivePoint::generator() * &sk_scalar;
|
let pk = p256::ProjectivePoint::generator() * sk_scalar;
|
||||||
let pk_bytes = &pk
|
let pk_bytes = &pk
|
||||||
.to_affine()
|
.to_affine()
|
||||||
.unwrap()
|
.to_encoded_point(false /* compress */)
|
||||||
.to_uncompressed_pubkey()
|
.to_bytes()[1..];
|
||||||
.into_bytes()[1..];
|
|
||||||
let (x_bytes, y_bytes) = pk_bytes.split_at(32);
|
let (x_bytes, y_bytes) = pk_bytes.split_at(32);
|
||||||
|
|
||||||
Self::EC {
|
Self::EC {
|
||||||
|
Loading…
Reference in New Issue
Block a user