pub struct SigningKey { /* private fields */ }Expand description
Ed25519 signing key which can be used to produce signatures.
Invariant: verifying_key is always the public key of
secret_key.
This prevents the signing function oracle attack.
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key(&self) -> VerifyingKey
Get the VerifyingKey for this SigningKey.
Sourcepub fn from_bytes(secret_key: &SecretKey) -> Self
pub fn from_bytes(secret_key: &SecretKey) -> Self
Construct a SigningKey from a SecretKey.
Sourcepub fn is_valid_signature(&self, message: &[u8], signature: &Signature) -> bool
pub fn is_valid_signature(&self, message: &[u8], signature: &Signature) -> bool
Verify a signature on a message with this signing key’s public key.
Sourcepub fn sign(&self, message: &[u8]) -> Signature
pub fn sign(&self, message: &[u8]) -> Signature
Sign a message with this signing key’s secret key.
use openzeppelin_crypto::eddsa::{SecretKey, SigningKey, SECRET_KEY_LENGTH};
let secret_key: SecretKey = [1u8; SECRET_KEY_LENGTH];
let signing_key = SigningKey::from_bytes(&secret_key);
let message = b"Sign me!";
let signature = signing_key.sign(message);
assert!(signing_key.is_valid_signature(message, &signature));Trait Implementations§
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PartialEq for SigningKey
impl PartialEq for SigningKey
impl StructuralPartialEq for SigningKey
Auto Trait Implementations§
impl Freeze for SigningKey
impl RefUnwindSafe for SigningKey
impl Send for SigningKey
impl Sync for SigningKey
impl Unpin for SigningKey
impl UnwindSafe for SigningKey
Blanket Implementations§
Source§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