pub struct PrivateKeyBase(/* private fields */);Expand description
Holds unique data from which keys for signing and encryption can be derived.
Implementations§
Source§impl PrivateKeyBase
impl PrivateKeyBase
Sourcepub fn from_optional_data(data: Option<impl Into<Vec<u8>>>) -> Self
pub fn from_optional_data(data: Option<impl Into<Vec<u8>>>) -> Self
Restores a PrivateKeyBase from an optional reference to an array of bytes.
If the data is None, a new random PrivateKeyBase is generated.
Sourcepub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
pub fn new_using(rng: &mut impl RandomNumberGenerator) -> Self
Generate a new random PrivateKeyBase using the given random number generator.
Sourcepub fn new_with_provider(provider: impl PrivateKeyDataProvider) -> Self
pub fn new_with_provider(provider: impl PrivateKeyDataProvider) -> Self
Create a new PrivateKeyBase from the given private keys data provider.
Sourcepub fn ecdsa_signing_private_key(&self) -> SigningPrivateKey
pub fn ecdsa_signing_private_key(&self) -> SigningPrivateKey
Derive a new ECDSA SigningPrivateKey from this PrivateKeyBase.
Sourcepub fn schnorr_signing_private_key(&self) -> SigningPrivateKey
pub fn schnorr_signing_private_key(&self) -> SigningPrivateKey
Derive a new Schnorr SigningPrivateKey from this PrivateKeyBase.
Sourcepub fn ed25519_signing_private_key(&self) -> SigningPrivateKey
pub fn ed25519_signing_private_key(&self) -> SigningPrivateKey
Derive a new Ed25519 SigningPrivateKey from this PrivateKeyBase.
Sourcepub fn ssh_signing_private_key(
&self,
algorithm: SSHAlgorithm,
comment: impl Into<String>,
) -> Result<SigningPrivateKey>
pub fn ssh_signing_private_key( &self, algorithm: SSHAlgorithm, comment: impl Into<String>, ) -> Result<SigningPrivateKey>
Derive a new SSH SigningPrivateKey from this PrivateKeyBase.
Sourcepub fn x25519_private_key(&self) -> X25519PrivateKey
pub fn x25519_private_key(&self) -> X25519PrivateKey
Derive a new X25519PrivateKey from this PrivateKeyBase.
An X25519 key for public key encryption.
Sourcepub fn schnorr_private_keys(&self) -> PrivateKeys
pub fn schnorr_private_keys(&self) -> PrivateKeys
Derive a new PrivateKeys from this PrivateKeyBase.
- Includes a Schnorr private key for signing.
- Includes an X25519 private key for encryption.
Sourcepub fn schnorr_public_keys(&self) -> PublicKeys
pub fn schnorr_public_keys(&self) -> PublicKeys
Derive a new PublicKeys from this PrivateKeyBase.
- Includes a Schnorr public key for signing.
- Includes an X25519 public key encryption.
Sourcepub fn ecdsa_private_keys(&self) -> PrivateKeys
pub fn ecdsa_private_keys(&self) -> PrivateKeys
Derive a new PrivateKeys from this PrivateKeyBase.
- Includes an ECDSA private key for signing.
- Includes an X25519 private key for encryption.
Sourcepub fn ecdsa_public_keys(&self) -> PublicKeys
pub fn ecdsa_public_keys(&self) -> PublicKeys
Derive a new PublicKeys from this PrivateKeyBase.
- Includes an ECDSA public key for signing.
- Includes an X25519 public key for encryption.
Sourcepub fn ssh_private_keys(
&self,
algorithm: SSHAlgorithm,
comment: impl Into<String>,
) -> Result<PrivateKeys>
pub fn ssh_private_keys( &self, algorithm: SSHAlgorithm, comment: impl Into<String>, ) -> Result<PrivateKeys>
Derive a new PrivateKeys from this PrivateKeyBase.
- Includes an SSH private key for signing.
- Includes an X25519 private key for encryption.
Sourcepub fn ssh_public_keys(
&self,
algorithm: SSHAlgorithm,
comment: impl Into<String>,
) -> Result<PublicKeys>
pub fn ssh_public_keys( &self, algorithm: SSHAlgorithm, comment: impl Into<String>, ) -> Result<PublicKeys>
Derive a new PublicKeys from this PrivateKeyBase.
- Includes an SSH public key for signing.
- Includes an X25519 public key for encryption.
Trait Implementations§
Source§impl AsRef<[u8]> for PrivateKeyBase
impl AsRef<[u8]> for PrivateKeyBase
Source§impl AsRef<PrivateKeyBase> for PrivateKeyBase
impl AsRef<PrivateKeyBase> for PrivateKeyBase
Source§fn as_ref(&self) -> &PrivateKeyBase
fn as_ref(&self) -> &PrivateKeyBase
Source§impl CBORTagged for PrivateKeyBase
impl CBORTagged for PrivateKeyBase
Source§impl CBORTaggedDecodable for PrivateKeyBase
impl CBORTaggedDecodable for PrivateKeyBase
Source§fn from_untagged_cbor(untagged_cbor: CBOR) -> Result<Self>
fn from_untagged_cbor(untagged_cbor: CBOR) -> Result<Self>
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,
Source§impl CBORTaggedEncodable for PrivateKeyBase
impl CBORTaggedEncodable for PrivateKeyBase
Source§fn untagged_cbor(&self) -> CBOR
fn untagged_cbor(&self) -> CBOR
Source§fn tagged_cbor(&self) -> CBOR
fn tagged_cbor(&self) -> CBOR
Source§impl Clone for PrivateKeyBase
impl Clone for PrivateKeyBase
Source§fn clone(&self) -> PrivateKeyBase
fn clone(&self) -> PrivateKeyBase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrivateKeyBase
impl Debug for PrivateKeyBase
Source§impl Decrypter for PrivateKeyBase
impl Decrypter for PrivateKeyBase
fn encapsulation_private_key(&self) -> EncapsulationPrivateKey
Source§impl Default for PrivateKeyBase
impl Default for PrivateKeyBase
Source§impl Drop for PrivateKeyBase
impl Drop for PrivateKeyBase
Source§impl<'a> From<&'a PrivateKeyBase> for &'a [u8]
impl<'a> From<&'a PrivateKeyBase> for &'a [u8]
Source§fn from(value: &'a PrivateKeyBase) -> Self
fn from(value: &'a PrivateKeyBase) -> Self
Source§impl From<&PrivateKeyBase> for XID
impl From<&PrivateKeyBase> for XID
Source§fn from(key: &PrivateKeyBase) -> Self
fn from(key: &PrivateKeyBase) -> Self
Source§impl From<PrivateKeyBase> for CBOR
impl From<PrivateKeyBase> for CBOR
Source§fn from(value: PrivateKeyBase) -> Self
fn from(value: PrivateKeyBase) -> Self
Source§impl PartialEq for PrivateKeyBase
impl PartialEq for PrivateKeyBase
Source§impl PrivateKeysProvider for PrivateKeyBase
impl PrivateKeysProvider for PrivateKeyBase
fn private_keys(&self) -> PrivateKeys
Source§impl PublicKeysProvider for PrivateKeyBase
impl PublicKeysProvider for PrivateKeyBase
fn public_keys(&self) -> PublicKeys
Source§impl Signer for PrivateKeyBase
impl Signer for PrivateKeyBase
Source§impl TryFrom<CBOR> for PrivateKeyBase
impl TryFrom<CBOR> for PrivateKeyBase
Source§impl Verifier for PrivateKeyBase
impl Verifier for PrivateKeyBase
impl Eq for PrivateKeyBase
impl StructuralPartialEq for PrivateKeyBase
Auto Trait Implementations§
impl Freeze for PrivateKeyBase
impl RefUnwindSafe for PrivateKeyBase
impl Send for PrivateKeyBase
impl Sync for PrivateKeyBase
impl Unpin for PrivateKeyBase
impl UnwindSafe for PrivateKeyBase
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
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>,
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>,
self into the result. Upper case
letters are used (e.g. F9B4CA)