pub struct Bls12381SecretKey { /* private fields */ }Expand description
Protected canonical nonzero BLS12-381 secret scalar.
This type deliberately implements neither Copy nor Clone and exposes no
shared or mutable byte-slice trait. Use Self::to_bytes_zeroizing only
when an explicit protected export is required.
Implementations§
Source§impl Bls12381SecretKey
impl Bls12381SecretKey
Sourcepub fn from_bytes(bytes: &[u8]) -> ApiResult<Self>
pub fn from_bytes(bytes: &[u8]) -> ApiResult<Self>
Import a canonical 32-byte big-endian scalar in the range 1..r.
Sourcepub fn key_gen(ikm: &[u8], salt: &[u8]) -> ApiResult<Self>
pub fn key_gen(ikm: &[u8], salt: &[u8]) -> ApiResult<Self>
Draft-07 KeyGen with the optional key_info value defaulting to empty.
ikm must contain at least 32 unpredictable bytes. Draft-07 requires
callers to choose and supply salt; an empty salt is permitted by HKDF,
but it is still an explicit caller choice.
Sourcepub fn key_gen_with_info(
ikm: &[u8],
salt: &[u8],
key_info: &[u8],
) -> ApiResult<Self>
pub fn key_gen_with_info( ikm: &[u8], salt: &[u8], key_info: &[u8], ) -> ApiResult<Self>
Draft-07 KeyGen with explicit caller-required salt and key_info.
Sourcepub fn generate<R: CryptoRng + RngCore>(
rng: &mut R,
salt: &[u8],
) -> ApiResult<Self>
pub fn generate<R: CryptoRng + RngCore>( rng: &mut R, salt: &[u8], ) -> ApiResult<Self>
Generate 32 bytes of IKM from a caller-supplied cryptographic RNG, then
apply draft-07 KeyGen with an empty key_info value.
Sourcepub fn generate_with_info<R: CryptoRng + RngCore>(
rng: &mut R,
salt: &[u8],
key_info: &[u8],
) -> ApiResult<Self>
pub fn generate_with_info<R: CryptoRng + RngCore>( rng: &mut R, salt: &[u8], key_info: &[u8], ) -> ApiResult<Self>
Generate IKM from a caller-supplied RNG and apply draft-07 KeyGen.
Sourcepub fn public_key(&self) -> ApiResult<Bls12381PublicKey>
pub fn public_key(&self) -> ApiResult<Bls12381PublicKey>
Derive the canonical minimum-size public key in G1.
Sourcepub fn to_bytes_zeroizing(&self) -> Zeroizing<[u8; 32]>
pub fn to_bytes_zeroizing(&self) -> Zeroizing<[u8; 32]>
Export the canonical big-endian scalar in a clearing fixed-width owner.