mirror of
https://github.com/RustCrypto/signatures
synced 2026-06-21 13:45:42 +00:00
ecdsa: provide a SigningKey::try_from_rng (#915)
This commit is contained in:
Generated
+3
-3
@@ -369,7 +369,7 @@ checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
|
||||
[[package]]
|
||||
name = "elliptic-curve"
|
||||
version = "0.14.0-rc.1"
|
||||
source = "git+https://github.com/RustCrypto/traits.git#28b6e0d3231fa0fb31dc7f6bfdb62d6558bcfdf6"
|
||||
source = "git+https://github.com/RustCrypto/traits.git#27835aa66710bded06caef143284892dda83dda5"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"crypto-bigint",
|
||||
@@ -416,7 +416,7 @@ checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/pinkforest/ff.git?branch=bump-rand-core#c734f7f21d6639bc6494dde538209d0770207c49"
|
||||
source = "git+https://github.com/zkcrypto/ff.git?branch=release-0.14.0#1bb634588722b1b7ce986d239c263e332bedda7f"
|
||||
dependencies = [
|
||||
"rand_core 0.9.2",
|
||||
"subtle",
|
||||
@@ -1087,7 +1087,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.3.0-pre.6"
|
||||
source = "git+https://github.com/RustCrypto/traits.git#28b6e0d3231fa0fb31dc7f6bfdb62d6558bcfdf6"
|
||||
source = "git+https://github.com/RustCrypto/traits.git#27835aa66710bded06caef143284892dda83dda5"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"rand_core 0.9.2",
|
||||
|
||||
+6
-1
@@ -31,6 +31,7 @@ slh-dsa = { path = "./slh-dsa" }
|
||||
|
||||
# https://github.com/RustCrypto/traits/pull/1751
|
||||
# https://github.com/RustCrypto/traits/pull/1767
|
||||
# https://github.com/RustCrypto/traits/pull/1774
|
||||
elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" }
|
||||
signature = { git = "https://github.com/RustCrypto/traits.git" }
|
||||
|
||||
@@ -39,6 +40,10 @@ signature = { git = "https://github.com/RustCrypto/traits.git" }
|
||||
crypto-bigint = { git = "https://github.com/RustCrypto/crypto-bigint.git" }
|
||||
|
||||
# https://github.com/zkcrypto/ff/pull/122
|
||||
ff = { git = "https://github.com/pinkforest/ff.git", branch = "bump-rand-core" }
|
||||
# https://github.com/zkcrypto/ff/pull/126
|
||||
# https://github.com/zkcrypto/ff/pull/127
|
||||
# https://github.com/zkcrypto/ff/pull/130
|
||||
ff = { git = "https://github.com/zkcrypto/ff.git", branch = "release-0.14.0" }
|
||||
|
||||
# https://github.com/zkcrypto/group/pull/56
|
||||
group = { git = "https://github.com/pinkforest/group.git", branch = "bump-rand-0.9" }
|
||||
|
||||
@@ -85,6 +85,13 @@ where
|
||||
NonZeroScalar::<C>::random(rng).into()
|
||||
}
|
||||
|
||||
/// Generate a cryptographically random [`SigningKey`].
|
||||
pub fn try_from_rng<R: TryCryptoRng + ?Sized>(
|
||||
rng: &mut R,
|
||||
) -> core::result::Result<Self, R::Error> {
|
||||
Ok(NonZeroScalar::<C>::try_from_rng(rng)?.into())
|
||||
}
|
||||
|
||||
/// Initialize signing key from a raw scalar serialized as a byte array.
|
||||
pub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self> {
|
||||
SecretKey::<C>::from_bytes(bytes)
|
||||
|
||||
Reference in New Issue
Block a user