Available on crate feature
signatures only.Expand description
Digital signatures, encryption, and security features.
This module provides cryptographic capabilities for Codex documents:
- Signatures: ECDSA (ES256, ES384), EdDSA (Ed25519), RSA-PSS (PS256), ML-DSA-65 (post-quantum), and WebAuthn/FIDO2 digital signatures
- Encryption: AES-256-GCM and ChaCha20-Poly1305 authenticated encryption
- Certificate Validation: X.509 certificate chain validation
- Revocation Checking: OCSP and CRL certificate revocation (feature:
ocsp) - Access Control: Permission management for document operations
§Signing Documents (ECDSA)
ⓘ
use cdx_core::security::{EcdsaSigner, SignerInfo, Signer};
let signer_info = SignerInfo::new("Alice");
let (signer, public_key_pem) = EcdsaSigner::generate(signer_info)?;
let signature = signer.sign(&document_id)?;§Signing Documents (EdDSA)
ⓘ
use cdx_core::security::{EddsaSigner, SignerInfo, Signer};
let signer_info = SignerInfo::new("Alice");
let (signer, public_key_pem) = EddsaSigner::generate(signer_info)?;
let signature = signer.sign(&document_id)?;§Encrypting Data
ⓘ
use cdx_core::security::Aes256GcmEncryptor;
let key = Aes256GcmEncryptor::generate_key();
let encryptor = Aes256GcmEncryptor::new(&key)?;
let encrypted = encryptor.encrypt(b"secret data")?;
let decrypted = encryptor.decrypt(&encrypted.ciphertext, &encrypted.nonce)?;Modules§
- eku
- Common extended key usage OIDs.
Structs§
- Access
Control - Access control settings for a document.
- Aes256
GcmEncryptor encryption - AES-256-GCM encryptor.
- Annotation
- A core annotation.
- Annotations
File - Core annotations file for
security/annotations.json. - Certificate
Chain - A certificate chain for validation.
- Certificate
Info - Information extracted from a certificate.
- Certificate
Validation - Result of certificate chain validation.
- ChaCha20
Poly1305 Encryptor encryption-chacha - ChaCha20-Poly1305 encryptor.
- Ecdh
EsKey Unwrapper key-wrapping - ECDH-ES+A256KW key unwrapper (recipient side).
- Ecdh
EsKey Wrapper key-wrapping - ECDH-ES+A256KW key wrapper (sender side).
- Ecdsa
Signer - ECDSA P-256 signer (ES256).
- Ecdsa
Verifier - ECDSA P-256 verifier (ES256).
- Eddsa
Signer eddsa - EdDSA (Ed25519) signer.
- Eddsa
Verifier eddsa - EdDSA (Ed25519) verifier.
- Encrypted
Data encryption - Result of encryption operation.
- Encryption
Metadata encryption - Encryption metadata stored in the document.
- Es384
Signer signatures-es384 - ECDSA P-384 signer (ES384).
- Es384
Verifier signatures-es384 - ECDSA P-384 verifier (ES384).
- KeyDerivation
encryption - Key derivation function parameters.
- MlDsa
Signer ml-dsa - ML-DSA-65 signer.
- MlDsa
Verifier ml-dsa - ML-DSA-65 verifier.
- Pbes2
KeyUnwrapper key-wrapping-pbes2 - PBES2-HS256+A256KW key unwrapper (password-based).
- Pbes2
KeyWrapper key-wrapping-pbes2 - PBES2-HS256+A256KW key wrapper (password-based).
- Pbes2
Wrapped KeyData key-wrapping-pbes2 - Result of wrapping a content encryption key with PBES2.
- Permission
Grant - A permission grant for a specific principal.
- Permissions
- Permission settings.
- Ps256
Signer signatures-rsa - RSA-PSS signer (PS256).
- Ps256
Verifier signatures-rsa - RSA-PSS verifier (PS256).
- Recipient
encryption - Recipient information for multi-recipient encryption.
- Revocation
Checker ocsp - Certificate revocation checker.
- Revocation
Config ocsp - Configuration for revocation checking.
- Revocation
Result ocsp - Result of a revocation check.
- RsaOaep
KeyUnwrapper key-wrapping-rsa - RSA-OAEP-256 key unwrapper (recipient side).
- RsaOaep
KeyWrapper key-wrapping-rsa - RSA-OAEP-256 key wrapper (sender side).
- RsaWrapped
KeyData key-wrapping-rsa - Result of wrapping a content encryption key with RSA-OAEP.
- Signature
- A digital signature.
- Signature
File - Signature file structure.
- Signature
Scope - Signature scope for scoped signatures.
- Signature
Verification - Result of signature verification.
- Signer
Info - Information about the signer.
- Trusted
Timestamp - RFC 3161 trusted timestamp token.
- WebAuthn
Signature - WebAuthn/FIDO2 signature data.
- WebAuthn
Verifier webauthn - WebAuthn signature verifier.
- Wrapped
KeyData key-wrapping - Result of wrapping a content encryption key.
Enums§
- Annotation
Type - Annotation type for core annotations.
- Encryption
Algorithm encryption - Encryption algorithm enumeration.
- KdfAlgorithm
encryption - Key derivation algorithm.
- KeyManagement
Algorithm encryption - Key management algorithm for key wrapping.
- KeyUsage
- Key usage flags for X.509 certificates.
- Operation
- Operations that can be controlled by permissions.
- Principal
- A security principal (user, group, or role).
- Revocation
Method ocsp - Method used for revocation checking.
- Revocation
Reason ocsp - Reason for certificate revocation (RFC 5280).
- Revocation
Status ocsp - Revocation status of a certificate.
- Signature
Algorithm - Signature algorithm.