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§
Modules§
Structs§
- ARID
- An “Apparently Random Identifier” (ARID)
- Authentication
Tag - 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.
- ECPrivate
Key - A private key for elliptic curve digital signature algorithms.
- ECPublic
Key - A compressed elliptic curve digital signature algorithm (ECDSA) public key.
- ECUncompressed
Public Key - An uncompressed elliptic curve digital signature algorithm (ECDSA) public key.
- Ed25519
Private Key - An Ed25519 private key for creating digital signatures.
- Ed25519
Public Key - An Ed25519 public key for verifying digital signatures.
- Encrypted
Key - Overview
- Encrypted
Message - 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”).
- Private
KeyBase - A secure foundation for deriving multiple cryptographic keys.
- Private
Keys - A container for an entity’s private cryptographic keys.
- Public
Keys - A container for an entity’s public cryptographic keys.
- Reference
- A globally unique reference to a globally unique object.
- SSKR
Group Spec - Re-export of the
Spec
type from thesskr
crate. - SSKR
Secret - Re-export of the
Spec
type from thesskr
crate. - SSKR
Share - A share of a secret split using Sharded Secret Key Reconstruction (SSKR).
- SSKR
Spec - Re-export of the
Spec
type from thesskr
crate. - Salt
- Random salt used to decorrelate other information.
- Schnorr
Public Key - A Schnorr (x-only) elliptic curve public key.
- Sealed
Message - A sealed message that can only be decrypted by the intended recipient.
- Seed
- A cryptographic seed for deterministic key generation.
- Symmetric
Key - A symmetric encryption key used for both encryption and decryption.
- URI
- A Uniform Resource Identifier (URI).
- UUID
- A Universally Unique Identifier (UUID).
- X25519
Private Key - A private key for X25519 key agreement operations.
- X25519
Public Key - A public key for X25519 key agreement operations.
- XID
- A XID (eXtensible IDentifier).
Enums§
- Derivation
Params - Enum representing the derivation parameters.
- Encapsulation
Ciphertext - A ciphertext produced by a key encapsulation mechanism (KEM).
- Encapsulation
Private Key - A private key used for key encapsulation mechanisms (KEM).
- Encapsulation
Public Key - A public key used for key encapsulation mechanisms (KEM).
- Encapsulation
Scheme - Supported key encapsulation mechanisms.
- Hash
Type - Enum representing the supported hash types.
- KeyDerivation
Method - Enum representing the supported key derivation methods.
- MLDSA
- Security levels for the ML-DSA post-quantum digital signature algorithm.
- MLDSA
Private Key - A private key for the ML-DSA post-quantum digital signature algorithm.
- MLDSA
Public Key - A public key for the ML-DSA post-quantum digital signature algorithm.
- MLDSA
Signature - A digital signature created with the ML-DSA post-quantum signature algorithm.
- MLKEM
- Security levels for the ML-KEM post-quantum key encapsulation mechanism.
- MLKEM
Ciphertext - A ciphertext containing an encapsulated shared secret for ML-KEM.
- MLKEM
Private Key - A private key for the ML-KEM post-quantum key encapsulation mechanism.
- MLKEM
Public Key - A public key for the ML-KEM post-quantum key encapsulation mechanism.
- SSKR
Error - Errors that can occur when using the SSKR library.
- Signature
- A digital signature created with various signature algorithms.
- Signature
Scheme - Supported digital signature schemes.
- Signing
Options - Options for configuring signature creation.
- Signing
Private Key - A private key used for creating digital signatures.
- Signing
Public Key - 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.
- Digest
Provider - 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.
- ECKey
Base - A base trait for all elliptic curve keys.
- ECPublic
KeyBase - 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.
- Private
KeyData Provider - A trait for types that can provide unique data for cryptographic key derivation.
- Private
Keys Provider - A trait for types that can provide a complete set of private cryptographic keys.
- Public
Keys Provider - A trait for types that can provide a complete set of public cryptographic keys.
- Reference
Provider - 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
andSecret
. - sskr_
generate_ using - Generates SSKR shares using a custom random number generator.