pub struct MlDsa65PrivateKey { /* private fields */ }Available on crate feature
mldsa65 only.Expand description
The 32-byte FIPS 204 seed plus the key expanded from it.
Only the seed is serialized (keystore, suiprivkey); the expanded key is
kept so signing does not re-expand. Both zeroize on drop.
Implementations§
Source§impl MlDsa65PrivateKey
impl MlDsa65PrivateKey
pub fn new(seed: [u8; 32]) -> Self
pub fn scheme(&self) -> SignatureScheme
pub fn verifying_key(&self) -> MlDsa65VerifyingKey
pub fn public_key(&self) -> MlDsa65PublicKey
pub fn seed(&self) -> &[u8; 32]
pub fn generate<R>(rng: R) -> Self
Sourcepub fn from_suiprivkey(s: &str) -> Result<Self, SignatureError>
Available on crate feature bech32 only.
pub fn from_suiprivkey(s: &str) -> Result<Self, SignatureError>
bech32 only.Decode a Bech32 suiprivkey string produced by the Sui CLI; the
payload is 0x07 || seed.
Sourcepub fn to_suiprivkey(&self) -> Result<String, SignatureError>
Available on crate feature bech32 only.
pub fn to_suiprivkey(&self) -> Result<String, SignatureError>
bech32 only.Encode this private key as a Bech32 suiprivkey string.
Sourcepub fn from_base64(s: &str) -> Result<Self, SignatureError>
pub fn from_base64(s: &str) -> Result<Self, SignatureError>
Decode a Base64 flag || seed string, the legacy keystore format used
for entries of the Sui CLI’s sui.keystore file.
Trait Implementations§
Source§impl Clone for MlDsa65PrivateKey
impl Clone for MlDsa65PrivateKey
Source§impl Debug for MlDsa65PrivateKey
impl Debug for MlDsa65PrivateKey
Source§impl From<MlDsa65PrivateKey> for SimpleKeypair
Available on (crate features ed25519 or mldsa65 or secp256k1 or secp256r1) and (crate features ed25519 or mldsa65 or secp256k1 or secp256r1 or zklogin) only.
impl From<MlDsa65PrivateKey> for SimpleKeypair
Available on (crate features
ed25519 or mldsa65 or secp256k1 or secp256r1) and (crate features ed25519 or mldsa65 or secp256k1 or secp256r1 or zklogin) only.Source§fn from(private_key: MlDsa65PrivateKey) -> Self
fn from(private_key: MlDsa65PrivateKey) -> Self
Converts to this type from the input type.
Source§impl RandomizedSigner<MlDsa65Signature> for MlDsa65PrivateKey
impl RandomizedSigner<MlDsa65Signature> for MlDsa65PrivateKey
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<MlDsa65Signature, SignatureError>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<MlDsa65Signature, SignatureError>
Hedged per FIPS 204: 32 bytes from rng enter the commitment, so
repeated signatures differ. A weak rng only degrades to the
deterministic variant’s security.
§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
Source§impl RandomizedSigner<SimpleSignature> for MlDsa65PrivateKey
impl RandomizedSigner<SimpleSignature> for MlDsa65PrivateKey
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<SimpleSignature, SignatureError>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<SimpleSignature, SignatureError>
Attempt to sign the given message, returning a digital signature on
success, or an error if something went wrong. Read more
§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
Source§impl RandomizedSigner<UserSignature> for MlDsa65PrivateKey
impl RandomizedSigner<UserSignature> for MlDsa65PrivateKey
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<UserSignature, SignatureError>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<UserSignature, SignatureError>
Attempt to sign the given message, returning a digital signature on
success, or an error if something went wrong. Read more
§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
Sign the given message and return a digital signature
Auto Trait Implementations§
impl Freeze for MlDsa65PrivateKey
impl RefUnwindSafe for MlDsa65PrivateKey
impl Send for MlDsa65PrivateKey
impl Sync for MlDsa65PrivateKey
impl Unpin for MlDsa65PrivateKey
impl UnsafeUnpin for MlDsa65PrivateKey
impl UnwindSafe for MlDsa65PrivateKey
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SuiRandomizedSigner for Twhere
T: RandomizedSigner<UserSignature>,
impl<T> SuiRandomizedSigner for Twhere
T: RandomizedSigner<UserSignature>,
Source§fn sign_transaction_with_rng(
&self,
rng: &mut dyn CryptoRngCore,
transaction: &Transaction,
) -> Result<UserSignature, Error>
fn sign_transaction_with_rng( &self, rng: &mut dyn CryptoRngCore, transaction: &Transaction, ) -> Result<UserSignature, Error>
Available on crate feature
mldsa65 only.Source§fn sign_personal_message_with_rng(
&self,
rng: &mut dyn CryptoRngCore,
message: &PersonalMessage<'_>,
) -> Result<UserSignature, Error>
fn sign_personal_message_with_rng( &self, rng: &mut dyn CryptoRngCore, message: &PersonalMessage<'_>, ) -> Result<UserSignature, Error>
Available on crate feature
mldsa65 only.