pub struct ECPrivateKey(/* private fields */);Expand description
An elliptic curve digital signature algorithm (ECDSA) private key.
Implementations§
Source§impl ECPrivateKey
impl ECPrivateKey
Sourcepub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
pub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
Creates a new random ECDSA private key using the given random number generator.
Sourcepub const fn from_data(data: [u8; 32]) -> Self
pub const fn from_data(data: [u8; 32]) -> Self
Restores an ECDSA private key from an array 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 an ECDSA private key from a reference to an array of bytes.
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 ECPrivateKey
impl ECPrivateKey
Sourcepub fn schnorr_public_key(&self) -> SchnorrPublicKey
pub fn schnorr_public_key(&self) -> SchnorrPublicKey
Derives the Schnorr public key from this ECDSA private key.
Sourcepub fn ecdsa_sign(&self, message: impl AsRef<[u8]>) -> [u8; 64]
pub fn ecdsa_sign(&self, message: impl AsRef<[u8]>) -> [u8; 64]
ECDSA signs the given message using this ECDSA private key.
Sourcepub fn schnorr_sign_using(
&self,
message: impl AsRef<[u8]>,
rng: &mut dyn RandomNumberGenerator,
) -> [u8; 64]
pub fn schnorr_sign_using( &self, message: impl AsRef<[u8]>, rng: &mut dyn RandomNumberGenerator, ) -> [u8; 64]
Schnorr signs the given message using this ECDSA private key, the given tag, and the given random number generator.
Trait Implementations§
Source§impl AsRef<[u8]> for ECPrivateKey
impl AsRef<[u8]> for ECPrivateKey
Source§impl CBORTagged for ECPrivateKey
impl CBORTagged for ECPrivateKey
The CBOR tags assocated with this type. If more than one tag is present,
they are considered equivalent for reading, but only the first one is
used for writing.
Source§impl CBORTaggedEncodable for ECPrivateKey
impl CBORTaggedEncodable for ECPrivateKey
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 ECPrivateKey
impl Clone for ECPrivateKey
Source§fn clone(&self) -> ECPrivateKey
fn clone(&self) -> ECPrivateKey
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 ECPrivateKey
impl Debug for ECPrivateKey
Source§impl Default for ECPrivateKey
impl Default for ECPrivateKey
Source§impl Display for ECPrivateKey
impl Display for ECPrivateKey
Source§impl ECKey for ECPrivateKey
impl ECKey for ECPrivateKey
fn public_key(&self) -> ECPublicKey
Source§impl ECKeyBase for ECPrivateKey
impl ECKeyBase for ECPrivateKey
Source§impl<'a> From<&'a ECPrivateKey> for &'a [u8]
impl<'a> From<&'a ECPrivateKey> for &'a [u8]
Source§fn from(value: &'a ECPrivateKey) -> Self
fn from(value: &'a ECPrivateKey) -> Self
Converts to this type from the input type.
Source§impl<'a> From<&'a ECPrivateKey> for &'a [u8; 32]
impl<'a> From<&'a ECPrivateKey> for &'a [u8; 32]
Source§fn from(value: &'a ECPrivateKey) -> Self
fn from(value: &'a ECPrivateKey) -> Self
Converts to this type from the input type.
Source§impl From<ECPrivateKey> for CBOR
impl From<ECPrivateKey> for CBOR
Source§fn from(value: ECPrivateKey) -> Self
fn from(value: ECPrivateKey) -> Self
Converts to this type from the input type.
Source§impl Hash for ECPrivateKey
impl Hash for ECPrivateKey
Source§impl PartialEq for ECPrivateKey
impl PartialEq for ECPrivateKey
impl Eq for ECPrivateKey
impl StructuralPartialEq for ECPrivateKey
Auto Trait Implementations§
impl Freeze for ECPrivateKey
impl RefUnwindSafe for ECPrivateKey
impl Send for ECPrivateKey
impl Sync for ECPrivateKey
impl Unpin for ECPrivateKey
impl UnwindSafe for ECPrivateKey
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
Source§impl<T> CBOREncodable for T
impl<T> CBOREncodable for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)