Crate bc_components

Source
Expand description

§Introduction

A collection of useful primitives for cryptography, semantic graphs, and cryptocurrency, primarily for use in higher-level Blockchain Commons projects like Gordian Envelope. All the types are CBOR serializable, and a number of them can also be serialized to and from URs.

Also includes a library of CBOR tags and UR types for use with these types.

§Getting Started

[dependencies]
bc-components = "0.21.0"

Re-exports§

pub use tags_registry::register_tags;
pub use tags_registry::register_tags_in;
pub use bc_tags as tags;

Modules§

tags_registry

Structs§

ARID
An “Apparently Random Identifier” (ARID)
AuthenticationTag
The authentication tag produced by the encryption process to verify message integrity.
Compressed
A compressed binary object with integrity verification.
Digest
A cryptographically secure digest, implemented with SHA-256.
ECPrivateKey
A private key for elliptic curve digital signature algorithms.
ECPublicKey
A compressed elliptic curve digital signature algorithm (ECDSA) public key.
ECUncompressedPublicKey
An uncompressed elliptic curve digital signature algorithm (ECDSA) public key.
Ed25519PrivateKey
An Ed25519 private key for creating digital signatures.
Ed25519PublicKey
An Ed25519 public key for verifying digital signatures.
EncryptedKey
Overview
EncryptedMessage
A secure encrypted message using IETF ChaCha20-Poly1305 authenticated encryption.
HKDFRng
A deterministic random number generator based on HKDF-HMAC-SHA256.
Nonce
A random nonce (“number used once”).
PrivateKeyBase
A secure foundation for deriving multiple cryptographic keys.
PrivateKeys
A container for an entity’s private cryptographic keys.
PublicKeys
A container for an entity’s public cryptographic keys.
Reference
A globally unique reference to a globally unique object.
SSKRGroupSpec
Re-export of the Spec type from the sskr crate.
SSKRSecret
Re-export of the Spec type from the sskr crate.
SSKRShare
A share of a secret split using Sharded Secret Key Reconstruction (SSKR).
SSKRSpec
Re-export of the Spec type from the sskr crate.
Salt
Random salt used to decorrelate other information.
SchnorrPublicKey
A Schnorr (x-only) elliptic curve public key.
SealedMessage
A sealed message that can only be decrypted by the intended recipient.
Seed
A cryptographic seed for deterministic key generation.
SymmetricKey
A symmetric encryption key used for both encryption and decryption.
URI
A Uniform Resource Identifier (URI).
UUID
A Universally Unique Identifier (UUID).
X25519PrivateKey
A private key for X25519 key agreement operations.
X25519PublicKey
A public key for X25519 key agreement operations.
XID
A XID (eXtensible IDentifier).

Enums§

DerivationParams
Enum representing the derivation parameters.
EncapsulationCiphertext
A ciphertext produced by a key encapsulation mechanism (KEM).
EncapsulationPrivateKey
A private key used for key encapsulation mechanisms (KEM).
EncapsulationPublicKey
A public key used for key encapsulation mechanisms (KEM).
EncapsulationScheme
Supported key encapsulation mechanisms.
HashType
Enum representing the supported hash types.
KeyDerivationMethod
Enum representing the supported key derivation methods.
MLDSA
Security levels for the ML-DSA post-quantum digital signature algorithm.
MLDSAPrivateKey
A private key for the ML-DSA post-quantum digital signature algorithm.
MLDSAPublicKey
A public key for the ML-DSA post-quantum digital signature algorithm.
MLDSASignature
A digital signature created with the ML-DSA post-quantum signature algorithm.
MLKEM
Security levels for the ML-KEM post-quantum key encapsulation mechanism.
MLKEMCiphertext
A ciphertext containing an encapsulated shared secret for ML-KEM.
MLKEMPrivateKey
A private key for the ML-KEM post-quantum key encapsulation mechanism.
MLKEMPublicKey
A public key for the ML-KEM post-quantum key encapsulation mechanism.
SSKRError
Errors that can occur when using the SSKR library.
Signature
A digital signature created with various signature algorithms.
SignatureScheme
Supported digital signature schemes.
SigningOptions
Options for configuring signature creation.
SigningPrivateKey
A private key used for creating digital signatures.
SigningPublicKey
A public key used for verifying digital signatures.

Constants§

ECDSA_PRIVATE_KEY_SIZE
The size of an ECDSA private key in bytes (32 bytes).
ECDSA_PUBLIC_KEY_SIZE
The size of an ECDSA compressed public key in bytes (33 bytes).
ECDSA_UNCOMPRESSED_PUBLIC_KEY_SIZE
The size of an ECDSA uncompressed public key in bytes (65 bytes).
SCHNORR_PUBLIC_KEY_SIZE
The size of a Schnorr public key in bytes (32 bytes).

Traits§

Decrypter
A trait for types that can decapsulate shared secrets for public key decryption.
DigestProvider
A type that can provide a single unique digest that characterizes its contents.
ECKey
A trait for elliptic curve keys that can derive a public key.
ECKeyBase
A base trait for all elliptic curve keys.
ECPublicKeyBase
A trait for elliptic curve public keys that can provide their uncompressed form.
Encrypter
A trait for types that can encapsulate shared secrets for public key encryption.
PrivateKeyDataProvider
A trait for types that can provide unique data for cryptographic key derivation.
PrivateKeysProvider
A trait for types that can provide a complete set of private cryptographic keys.
PublicKeysProvider
A trait for types that can provide a complete set of public cryptographic keys.
ReferenceProvider
Implementers of this trait provide a globally unique reference to themselves.
Signer
A trait for types capable of creating digital signatures.
Verifier
A trait for types capable of verifying digital signatures.
XIDProvider
A provider trait for obtaining XIDs from various objects.

Functions§

keypair
Generates a key pair using the default signature and encapsulation schemes.
keypair_opt
Generates a key pair with specified signature and encapsulation schemes.
keypair_opt_using
Generates a key pair with specified schemes using a custom random number generator.
keypair_using
Generates a key pair using the default schemes and a custom random number generator.
sskr_combine
Combines SSKR shares to reconstruct the original secret.
sskr_generate
Generates SSKR shares for the given Spec and Secret.
sskr_generate_using
Generates SSKR shares using a custom random number generator.