Skip to main content

Crate rtci_crypto

Crate rtci_crypto 

Source
Expand description

Provider-neutral cryptography for the webrtc-rs RTC stack.

The open traits in this crate allow applications to supply cryptography and randomness without registering global state. Built-in providers are selected with additive Cargo features.

Key material: every struct holding secret key material derives Zeroize and ZeroizeOnDrop, or holds each secret in SecretVec; secret keys are drawn with RTCRandom::fill_secret; scrub_stack overwrites what building a key schedule left in dead stack frames. The RustCrypto primitives the built-in providers use (aes, ctr, the HMAC-SHA1 of the ring provider) erase their key schedules when dropped. ring’s own key objects (AEAD, header-protection and HMAC keys) do not erase themselves, so the ring provider keeps each in an allocation of its own and overwrites it after the drop (docs/key-erasure.md).

Modules§

conformance
Reusable conformance assertions for built-in and application-provided crypto providers.
providers

Structs§

PublicKey
Borrowed public-key bytes with an explicit encoding.
SecretVec
An owned byte vector that zeroizes its allocation when dropped.

Enums§

AeadAlgorithm
Authenticated-encryption algorithms.
BlockCipherAlgorithm
Single-block encryption algorithms.
CbcAlgorithm
CBC algorithms.
CryptoAlgorithm
A provider capability identifier.
CryptoError
A provider-neutral cryptographic failure.
HashAlgorithm
Algorithms accepted by crate::RTCCrypto::hash.
HeaderMaskAlgorithm
The ciphers a record-number (header-protection) mask is made with: the block cipher or stream cipher underneath an AEAD, keyed separately (RFC 9147 section 4.2.3; the same construction as QUIC header protection, RFC 9001 section 5.4).
HmacAlgorithm
Algorithms accepted by the HMAC operations.
KeyExchangeAlgorithm
Ephemeral key-agreement algorithms.
PublicKeyEncoding
The encoding of public-key bytes.
SignatureScheme
Signature schemes currently used by DTLS.
StreamCipherAlgorithm
Stream-cipher algorithms.

Constants§

HEADER_MASK_LEN
The length of the mask a HeaderMask returns.
HEADER_MASK_SAMPLE_LEN
The length of the ciphertext sample a HeaderMask is computed from.

Traits§

ActiveKeyExchange
Provider-owned one-shot ephemeral key exchange.
AeadCipher
A keyed authenticated cipher with detached tags.
CbcCipher
A keyed CBC block cipher with a reusable expanded key.
HeaderMask
A keyed generator of record-number masks.
Mac
A keyed message authentication code with a reusable key schedule.
RTCCrypto
Provider-neutral cryptographic operations.
RTCCryptoProvider
A bundle of cryptographic operations and cryptographically secure randomness.
RTCRandom
A cryptographically secure random byte generator.
SigningKey
A provider-owned signing key, including external or non-exportable keys.
StreamCipher
A keyed stream cipher with a reusable expanded key.

Functions§

constant_time_eq
Compares equal-length byte strings without data-dependent early exit.
default_provider
Constructs the built-in default provider.
hkdf_expand
HKDF-Expand(PRK, info, L) (RFC 5869 section 2.3), info given in pieces.
hkdf_expand_label
HKDF-Expand-Label(Secret, Label, Context, Length) (RFC 8446 section 7.1): HKDF-Expand with the HkdfLabel structure as info. prefix is what the label is prefixed with on the wire: "tls13 " for TLS 1.3 and "dtls13" for DTLS 1.3 (RFC 9147 section 5.9).
hkdf_extract
HKDF-Extract(salt, IKM) (RFC 5869 section 2.2): the pseudorandom key, one digest long.
rsa_pkcs1_hash
The hash an RSASSA-PKCS1-v1_5 scheme signs with; None for any other scheme.
scrub_stack
Overwrites the stack below the caller’s frame (32 KiB of it).
verify_rsa_pkcs1_without_digest_parameters
Verifies an RSASSA-PKCS1-v1_5 signature over the message whose digest (made with rsa_pkcs1_hash of scheme) is given, for the DigestInfo encoding WITHOUT the NULL parameters (RFC 5246 section 4.7). public_key is the DER RSAPublicKey. The form with NULL parameters is the provider’s (crate::RTCCrypto::verify_signature); this one accepts only the other.