Struct bc_components::AgreementPrivateKey
source · pub struct AgreementPrivateKey(_);
Expand description
A Curve25519 private key used for X25519 key agreement.
Implementations§
source§impl AgreementPrivateKey
impl AgreementPrivateKey
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 AgreementPrivateKey
using the given random number generator.
sourcepub const fn from_data(data: [u8; 32]) -> Self
pub const fn from_data(data: [u8; 32]) -> Self
Restore an AgreementPrivateKey
from a fixed-size array of bytes.
sourcepub fn from_data_ref<T>(data: &T) -> Option<Self>where
T: AsRef<[u8]>,
pub fn from_data_ref<T>(data: &T) -> Option<Self>where T: AsRef<[u8]>,
Restore an AgreementPrivateKey
from a reference to an array of bytes.
sourcepub fn from_hex<T>(hex: T) -> Selfwhere
T: AsRef<str>,
pub fn from_hex<T>(hex: T) -> Selfwhere T: AsRef<str>,
Restore an AgreementPrivateKey
from a hex string.
Panics
Panics if the hex string is invalid or the length is not AgreementPrivateKey::KEY_SIZE * 2
.
sourcepub fn public_key(&self) -> AgreementPublicKey
pub fn public_key(&self) -> AgreementPublicKey
Get the AgreementPublicKey
corresponding to this AgreementPrivateKey
.
sourcepub fn derive_from_key_material<D>(key_material: D) -> Selfwhere
D: AsRef<[u8]>,
pub fn derive_from_key_material<D>(key_material: D) -> Selfwhere D: AsRef<[u8]>,
Derive an AgreementPrivateKey
from the given key material.
Derive a shared symmetric key from this AgreementPrivateKey
and the given AgreementPublicKey
.
Trait Implementations§
source§impl CBORDecodable for AgreementPrivateKey
impl CBORDecodable for AgreementPrivateKey
source§impl CBOREncodable for AgreementPrivateKey
impl CBOREncodable for AgreementPrivateKey
source§impl CBORTagged for AgreementPrivateKey
impl CBORTagged for AgreementPrivateKey
source§impl CBORTaggedDecodable for AgreementPrivateKey
impl CBORTaggedDecodable for AgreementPrivateKey
source§fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self, Error>
fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self, Error>
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 AgreementPrivateKey
impl CBORTaggedEncodable for AgreementPrivateKey
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 AgreementPrivateKey
impl Clone for AgreementPrivateKey
source§fn clone(&self) -> AgreementPrivateKey
fn clone(&self) -> AgreementPrivateKey
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 AgreementPrivateKey
impl Debug for AgreementPrivateKey
source§impl Default for AgreementPrivateKey
impl Default for AgreementPrivateKey
source§impl<'a> From<&'a AgreementPrivateKey> for &'a [u8; 32]
impl<'a> From<&'a AgreementPrivateKey> for &'a [u8; 32]
source§fn from(value: &'a AgreementPrivateKey) -> Self
fn from(value: &'a AgreementPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<&AgreementPrivateKey> for AgreementPrivateKey
impl From<&AgreementPrivateKey> for AgreementPrivateKey
source§fn from(key: &AgreementPrivateKey) -> Self
fn from(key: &AgreementPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<&AgreementPrivateKey> for Vec<u8>
impl From<&AgreementPrivateKey> for Vec<u8>
source§fn from(key: &AgreementPrivateKey) -> Self
fn from(key: &AgreementPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<AgreementPrivateKey> for Vec<u8>
impl From<AgreementPrivateKey> for Vec<u8>
source§fn from(key: AgreementPrivateKey) -> Self
fn from(key: AgreementPrivateKey) -> Self
Converts to this type from the input type.
source§impl From<Rc<AgreementPrivateKey>> for AgreementPrivateKey
impl From<Rc<AgreementPrivateKey>> for AgreementPrivateKey
source§fn from(value: Rc<AgreementPrivateKey>) -> Self
fn from(value: Rc<AgreementPrivateKey>) -> Self
Converts to this type from the input type.
source§impl Hash for AgreementPrivateKey
impl Hash for AgreementPrivateKey
source§impl PartialEq<AgreementPrivateKey> for AgreementPrivateKey
impl PartialEq<AgreementPrivateKey> for AgreementPrivateKey
source§fn eq(&self, other: &AgreementPrivateKey) -> bool
fn eq(&self, other: &AgreementPrivateKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl URDecodable for AgreementPrivateKey
impl URDecodable for AgreementPrivateKey
source§impl UREncodable for AgreementPrivateKey
impl UREncodable for AgreementPrivateKey
impl Eq for AgreementPrivateKey
impl StructuralEq for AgreementPrivateKey
impl StructuralPartialEq for AgreementPrivateKey
impl URCodable for AgreementPrivateKey
Auto Trait Implementations§
impl RefUnwindSafe for AgreementPrivateKey
impl Send for AgreementPrivateKey
impl Sync for AgreementPrivateKey
impl Unpin for AgreementPrivateKey
impl UnwindSafe for AgreementPrivateKey
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