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 key
Implementations§
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 · Source§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.