Struct bc_components::SigningPrivateKey
source · pub struct SigningPrivateKey(/* private fields */);Expand description
A private ECDSA key for signing.
Implementations§
source§impl SigningPrivateKey
impl SigningPrivateKey
pub const KEY_SIZE: usize = 32usize
sourcepub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
pub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
Generate a new random SigningPrivateKey using the given random number generator.
For testing purposes only.
sourcepub const fn from_data(data: [u8; 32]) -> Self
pub const fn from_data(data: [u8; 32]) -> Self
Restores a SigningPrivateKey from a vector of bytes.
sourcepub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
pub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
Restores a SigningPrivateKey from a reference to a vector of bytes.
sourcepub fn from_hex(hex: impl AsRef<str>) -> Self
pub fn from_hex(hex: impl AsRef<str>) -> Self
Restores a SigningPrivateKey from a hex string.
§Panics
Panics if the hex string is invalid or the length is not SigningPrivateKey::KEY_SIZE * 2.
sourcepub fn ecdsa_public_key(&self) -> SigningPublicKey
pub fn ecdsa_public_key(&self) -> SigningPublicKey
Derives the ECDSA signing public key from this private key.
sourcepub fn schnorr_public_key(&self) -> SigningPublicKey
pub fn schnorr_public_key(&self) -> SigningPublicKey
Derives the Schnorr signing public key from this private key.
sourcepub fn derive_from_key_material(key_material: impl AsRef<[u8]>) -> Self
pub fn derive_from_key_material(key_material: impl AsRef<[u8]>) -> Self
Derives a new SigningPrivateKey from the given key material.
source§impl SigningPrivateKey
impl SigningPrivateKey
pub fn ecdsa_sign(&self, message: impl AsRef<[u8]>) -> Signature
pub fn schnorr_sign_using( &self, message: impl AsRef<[u8]>, tag: impl AsRef<[u8]>, rng: &mut impl RandomNumberGenerator ) -> Signature
pub fn schnorr_sign( &self, message: impl AsRef<[u8]>, tag: impl AsRef<[u8]> ) -> Signature
Trait Implementations§
source§impl AsRef<SigningPrivateKey> for SigningPrivateKey
impl AsRef<SigningPrivateKey> for SigningPrivateKey
source§fn as_ref(&self) -> &SigningPrivateKey
fn as_ref(&self) -> &SigningPrivateKey
Converts this type into a shared reference of the (usually inferred) input type.
source§impl CBORDecodable for SigningPrivateKey
impl CBORDecodable for SigningPrivateKey
source§impl CBOREncodable for SigningPrivateKey
impl CBOREncodable for SigningPrivateKey
source§impl CBORTagged for SigningPrivateKey
impl CBORTagged for SigningPrivateKey
source§impl CBORTaggedDecodable for SigningPrivateKey
impl CBORTaggedDecodable for SigningPrivateKey
source§fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self>
fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self>
Creates an instance of this type by decoding it from untagged CBOR.
source§fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where
Self: Sized,
fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where
Self: Sized,
Creates an instance of this type by decoding it from tagged CBOR.
source§impl CBORTaggedEncodable for SigningPrivateKey
impl CBORTaggedEncodable for SigningPrivateKey
source§fn untagged_cbor(&self) -> CBOR
fn untagged_cbor(&self) -> CBOR
Returns the untagged CBOR encoding of this instance.
source§fn tagged_cbor(&self) -> CBOR
fn tagged_cbor(&self) -> CBOR
Returns the tagged CBOR encoding of this instance.
source§impl Clone for SigningPrivateKey
impl Clone for SigningPrivateKey
source§fn clone(&self) -> SigningPrivateKey
fn clone(&self) -> SigningPrivateKey
Returns a copy 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 Debug for SigningPrivateKey
impl Debug for SigningPrivateKey
source§impl Default for SigningPrivateKey
impl Default for SigningPrivateKey
source§impl<'a> From<&'a SigningPrivateKey> for &'a [u8; 32]
impl<'a> From<&'a SigningPrivateKey> for &'a [u8; 32]
source§fn from(value: &'a SigningPrivateKey) -> Self
fn from(value: &'a SigningPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<&SigningPrivateKey> for SigningPrivateKey
impl From<&SigningPrivateKey> for SigningPrivateKey
source§fn from(key: &SigningPrivateKey) -> Self
fn from(key: &SigningPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<&SigningPrivateKey> for Vec<u8>
impl From<&SigningPrivateKey> for Vec<u8>
source§fn from(key: &SigningPrivateKey) -> Self
fn from(key: &SigningPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<Rc<SigningPrivateKey>> for SigningPrivateKey
impl From<Rc<SigningPrivateKey>> for SigningPrivateKey
source§fn from(value: Rc<SigningPrivateKey>) -> Self
fn from(value: Rc<SigningPrivateKey>) -> Self
Converts to this type from the input type.
source§impl From<SigningPrivateKey> for CBOR
impl From<SigningPrivateKey> for CBOR
source§fn from(value: SigningPrivateKey) -> Self
fn from(value: SigningPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<SigningPrivateKey> for Vec<u8>
impl From<SigningPrivateKey> for Vec<u8>
source§fn from(key: SigningPrivateKey) -> Self
fn from(key: SigningPrivateKey) -> Self
Converts to this type from the input type.
source§impl Hash for SigningPrivateKey
impl Hash for SigningPrivateKey
source§impl PartialEq for SigningPrivateKey
impl PartialEq for SigningPrivateKey
source§fn eq(&self, other: &SigningPrivateKey) -> bool
fn eq(&self, other: &SigningPrivateKey) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl TryFrom<&CBOR> for SigningPrivateKey
impl TryFrom<&CBOR> for SigningPrivateKey
source§impl TryFrom<CBOR> for SigningPrivateKey
impl TryFrom<CBOR> for SigningPrivateKey
source§impl URDecodable for SigningPrivateKey
impl URDecodable for SigningPrivateKey
source§impl UREncodable for SigningPrivateKey
impl UREncodable for SigningPrivateKey
impl Eq for SigningPrivateKey
impl StructuralPartialEq for SigningPrivateKey
impl URCodable for SigningPrivateKey
Auto Trait Implementations§
impl Freeze for SigningPrivateKey
impl RefUnwindSafe for SigningPrivateKey
impl Send for SigningPrivateKey
impl Sync for SigningPrivateKey
impl Unpin for SigningPrivateKey
impl UnwindSafe for SigningPrivateKey
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