pub struct PublicKeys { /* private fields */ }Expand description
A container for an entity’s public cryptographic keys.
PublicKeys combines a verification key for checking digital signatures
with an encapsulation key for encrypting messages, providing a complete
public key package for secure communication with an entity.
This type is designed to be freely shared across networks and systems,
allowing others to securely communicate with the key owner, who holds the
corresponding PrivateKeys instance.
§Components
-
signing_public_key- A public key used for verifying digital signatures. Can verify signatures created by the corresponding private key, which may be Schnorr, ECDSA, Ed25519, or SSH-based. -
encapsulation_public_key- A public key used for encrypting messages that can only be decrypted by the holder of the corresponding private key. Can be X25519 or ML-KEM based.
§Use Cases
- Verifying the authenticity of signed messages or content
- Encrypting data for secure transmission to the key owner
- Identity verification in distributed systems
- Establishing secure communication channels
§Examples
use bc_components::{EncapsulationPublicKey, keypair};
// Generate a key pair
let (private_keys, public_keys) = keypair();
// Get the encapsulation public key
let enc_pub_key = public_keys.enapsulation_public_key();
// The public key can be used for key encapsulation
// The resulting shared secret is only accessible to the
// holder of the corresponding private keyImplementations§
Source§impl PublicKeys
impl PublicKeys
Sourcepub fn new(
signing_public_key: SigningPublicKey,
encapsulation_public_key: EncapsulationPublicKey,
) -> Self
pub fn new( signing_public_key: SigningPublicKey, encapsulation_public_key: EncapsulationPublicKey, ) -> Self
Restores a PublicKeys from a SigningPublicKey and an
EncapsulationPublicKey.
Sourcepub fn signing_public_key(&self) -> &SigningPublicKey
pub fn signing_public_key(&self) -> &SigningPublicKey
Returns the SigningPublicKey of this PublicKeys.
Sourcepub fn enapsulation_public_key(&self) -> &EncapsulationPublicKey
pub fn enapsulation_public_key(&self) -> &EncapsulationPublicKey
Returns the EncapsulationPublicKey of this PublicKeys.
Trait Implementations§
Source§impl AsRef<EncapsulationPublicKey> for PublicKeys
impl AsRef<EncapsulationPublicKey> for PublicKeys
Source§fn as_ref(&self) -> &EncapsulationPublicKey
fn as_ref(&self) -> &EncapsulationPublicKey
Source§impl AsRef<PublicKeys> for PublicKeys
impl AsRef<PublicKeys> for PublicKeys
Source§fn as_ref(&self) -> &PublicKeys
fn as_ref(&self) -> &PublicKeys
Source§impl AsRef<SigningPublicKey> for PublicKeys
impl AsRef<SigningPublicKey> for PublicKeys
Source§fn as_ref(&self) -> &SigningPublicKey
fn as_ref(&self) -> &SigningPublicKey
Source§impl CBORTagged for PublicKeys
impl CBORTagged for PublicKeys
Source§impl CBORTaggedDecodable for PublicKeys
impl CBORTaggedDecodable for PublicKeys
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 PublicKeys
impl CBORTaggedEncodable for PublicKeys
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 PublicKeys
impl Clone for PublicKeys
Source§fn clone(&self) -> PublicKeys
fn clone(&self) -> PublicKeys
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublicKeys
impl Debug for PublicKeys
Source§impl Display for PublicKeys
impl Display for PublicKeys
Source§impl Encrypter for PublicKeys
impl Encrypter for PublicKeys
Source§fn encapsulation_public_key(&self) -> EncapsulationPublicKey
fn encapsulation_public_key(&self) -> EncapsulationPublicKey
Source§impl From<&PublicKeys> for XID
Implements conversion from PublicKeys reference to XID via the signing
public key.
impl From<&PublicKeys> for XID
Implements conversion from PublicKeys reference to XID via the signing public key.
Source§fn from(key: &PublicKeys) -> Self
fn from(key: &PublicKeys) -> Self
Source§impl From<PublicKeys> for CBOR
impl From<PublicKeys> for CBOR
Source§fn from(value: PublicKeys) -> Self
fn from(value: PublicKeys) -> Self
Source§impl Hash for PublicKeys
impl Hash for PublicKeys
Source§impl PartialEq for PublicKeys
impl PartialEq for PublicKeys
Source§impl PublicKeysProvider for PublicKeys
impl PublicKeysProvider for PublicKeys
Source§fn public_keys(&self) -> PublicKeys
fn public_keys(&self) -> PublicKeys
Source§impl ReferenceProvider for PublicKeys
impl ReferenceProvider for PublicKeys
Source§fn reference(&self) -> Reference
fn reference(&self) -> Reference
Source§fn ref_hex_short(&self) -> String
fn ref_hex_short(&self) -> String
Source§impl TryFrom<CBOR> for PublicKeys
impl TryFrom<CBOR> for PublicKeys
Source§impl Verifier for PublicKeys
impl Verifier for PublicKeys
impl Eq for PublicKeys
impl StructuralPartialEq for PublicKeys
Auto Trait Implementations§
impl Freeze for PublicKeys
impl RefUnwindSafe for PublicKeys
impl Send for PublicKeys
impl Sync for PublicKeys
impl Unpin for PublicKeys
impl UnwindSafe for PublicKeys
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CBORDecodable for T
impl<T> CBORDecodable for T
Source§impl<T> CBOREncodable for T
impl<T> CBOREncodable for T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)