pub struct SigningKeyPair<PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> {
pub public_key: PublicKey,
pub secret_key: SecretKey,
}Expand description
An Ed25519 keypair for public-key signatures
Fields§
§public_key: PublicKeyPublic key
secret_key: SecretKeySecret key
Implementations§
Source§impl SigningKeyPair<Locked<HeapByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>, Locked<HeapByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>>
impl SigningKeyPair<Locked<HeapByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>, Locked<HeapByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>>
Sourcepub fn new_locked_keypair() -> Result<Self, Error>
Available on crate feature protected only.
pub fn new_locked_keypair() -> Result<Self, Error>
protected only.Sourcepub fn generate_locked_keypair() -> Result<Self, Error>
Available on crate feature protected only.
pub fn generate_locked_keypair() -> Result<Self, Error>
protected only.Sourcepub fn gen_locked_keypair() -> Result<Self, Error>
👎Deprecated: use generate_locked_keypair() instead
Available on crate feature protected only.
pub fn gen_locked_keypair() -> Result<Self, Error>
use generate_locked_keypair() instead
protected only.Returns a new randomly generated locked signing keypair.
Prefer generate_locked_keypair.
This method is retained for compatibility.
§Errors
Returns the same errors as
generate_locked_keypair.
§Panics
Panics under the same conditions as
generate_locked_keypair.
Source§impl SigningKeyPair<LockedRO<HeapByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>, LockedRO<HeapByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>>
impl SigningKeyPair<LockedRO<HeapByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>, LockedRO<HeapByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>>
Sourcepub fn generate_readonly_locked_keypair() -> Result<Self, Error>
Available on crate feature protected only.
pub fn generate_readonly_locked_keypair() -> Result<Self, Error>
protected only.Returns a new randomly generated locked, read-only signing keypair.
§Errors
Returns Error::Io if either allocation cannot be locked or its
page permissions cannot be changed to read-only.
§Panics
Panics if either page-aligned allocation cannot be created, its size cannot be represented with guard pages, or the operating system’s random number generator fails.
Sourcepub fn gen_readonly_locked_keypair() -> Result<Self, Error>
👎Deprecated: use generate_readonly_locked_keypair() instead
Available on crate feature protected only.
pub fn gen_readonly_locked_keypair() -> Result<Self, Error>
use generate_readonly_locked_keypair() instead
protected only.Returns a new randomly generated locked, read-only signing keypair.
Prefer
generate_readonly_locked_keypair.
This method is retained for compatibility.
§Errors
Returns the same errors as
generate_readonly_locked_keypair.
§Panics
Panics under the same conditions as
generate_readonly_locked_keypair.
Source§impl<PublicKey: NewByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: NewByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
impl<PublicKey: NewByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: NewByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
Sourcepub fn gen() -> Self
👎Deprecated: use generate() instead
pub fn gen() -> Self
use generate() instead
Generates a random signing keypair.
Prefer generate. gen is retained for compatibility
with older Rust editions.
Sourcepub fn from_secret_key(secret_key: SecretKey) -> Self
pub fn from_secret_key(secret_key: SecretKey) -> Self
Derives a signing keypair from secret_key, and consumes it, returning
a new keypair.
Source§impl<PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
impl<PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
Sourcepub fn to_seed<SeedOut: NewByteArray<CRYPTO_SIGN_SEEDBYTES>>(&self) -> SeedOut
pub fn to_seed<SeedOut: NewByteArray<CRYPTO_SIGN_SEEDBYTES>>(&self) -> SeedOut
Extracts the Ed25519 seed from this keypair’s secret key.
Sourcepub fn to_public_key<PublicKeyOut: NewByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>(
&self,
) -> PublicKeyOut
pub fn to_public_key<PublicKeyOut: NewByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>( &self, ) -> PublicKeyOut
Extracts the Ed25519 public key embedded in this keypair’s secret key.
Source§impl SigningKeyPair<StackByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>, StackByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>
impl SigningKeyPair<StackByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>, StackByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>
Sourcepub fn generate_with_defaults() -> Self
pub fn generate_with_defaults() -> Self
Randomly generates a new signing keypair, using default types (stack-allocated byte arrays). Provided for convenience.
Sourcepub fn gen_with_defaults() -> Self
👎Deprecated: use generate_with_defaults() instead
pub fn gen_with_defaults() -> Self
use generate_with_defaults() instead
Randomly generates a new signing keypair, using default types (stack-allocated byte arrays). Provided for convenience.
Prefer generate_with_defaults. This
method is retained for compatibility.
Source§impl<'a, PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + TryFrom<&'a [u8]> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + TryFrom<&'a [u8]> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
impl<'a, PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + TryFrom<&'a [u8]> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + TryFrom<&'a [u8]> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
Sourcepub fn from_slices(
public_key: &'a [u8],
secret_key: &'a [u8],
) -> Result<Self, Error>
pub fn from_slices( public_key: &'a [u8], secret_key: &'a [u8], ) -> Result<Self, Error>
Constructs a new signing keypair from key slices, consuming them. Does not check validity or authenticity of keypair.
§Errors
Returns an error if either slice has the wrong length for its key type, or if the target key type rejects the key bytes.
Source§impl<PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
impl<PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> SigningKeyPair<PublicKey, SecretKey>
Sourcepub fn sign<Signature: NewByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize>(
&self,
message: Message,
) -> Result<SignedMessage<Signature, Message>, Error>
pub fn sign<Signature: NewByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize>( &self, message: Message, ) -> Result<SignedMessage<Signature, Message>, Error>
Signs message using this keypair, consuming the message, and returning
a new SignedMessage. The type of message should match that of the
target signed message.
§Errors
The fixed-size signature and secret-key types satisfy the current
implementation’s requirements, so this function does not return an
error for valid type implementations. The Result is retained for
compatibility with the underlying signing API.
Sourcepub fn sign_with_defaults<Message: Bytes>(
&self,
message: Message,
) -> Result<SignedMessage<StackByteArray<CRYPTO_SIGN_BYTES>, Vec<u8>>, Error>
pub fn sign_with_defaults<Message: Bytes>( &self, message: Message, ) -> Result<SignedMessage<StackByteArray<CRYPTO_SIGN_BYTES>, Vec<u8>>, Error>
Signs message, putting the result into a Vec. Convenience wrapper
for SigningKeyPair::sign.
§Errors
The default fixed-size types satisfy the current implementation’s
requirements, so this function does not return an error in normal use.
The Result is retained for API compatibility.
Trait Implementations§
Source§impl<PublicKey: Clone + ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: Clone + ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> Clone for SigningKeyPair<PublicKey, SecretKey>
impl<PublicKey: Clone + ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES> + Zeroize, SecretKey: Clone + ByteArray<CRYPTO_SIGN_SECRETKEYBYTES> + Zeroize> Clone for SigningKeyPair<PublicKey, SecretKey>
Source§fn clone(&self) -> SigningKeyPair<PublicKey, SecretKey>
fn clone(&self) -> SigningKeyPair<PublicKey, SecretKey>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more