Skip to content

Algorithm

The Algorithm enum represents Web Crypto algorithm parameters. Each variant maps to a specific algorithm and carries the fields needed for the operation.

Variants

Signature

VariantFields
RsassaPkcs1v15hash: Hash
RsaPsshash: Hash, salt_length: Option<u32>
Ecdsahash: Hash, named_curve: NamedCurve
Ed25519(none)

Encryption

VariantFields
RsaOaephash: Hash, label: Option<Vec<u8>>
AesCtrcounter: Option<Vec<u8>>, length: Option<u8>, key_length: Option<u16>
AesCbciv: Option<Vec<u8>>, key_length: Option<u16>
AesGcmiv: Option<Vec<u8>>, additional_data: Option<Vec<u8>>, tag_length: Option<u8>, key_length: Option<u16>

Key Wrapping

VariantFields
AesKwkey_length: Option<u16>

Key Derivation

VariantFields
Ecdhnamed_curve: NamedCurve, public_key: Option<CryptoKey>
X25519public_key: Option<CryptoKey>
Hkdfhash: Hash, salt: Option<Vec<u8>>, info: Option<Vec<u8>>
Pbkdf2hash: Hash, salt: Option<Vec<u8>>, iterations: Option<u32>

MAC

VariantFields
Hmachash: Hash, length: Option<u32>

Hash

VariantWeb Crypto name
Sha1SHA-1
Sha256SHA-256
Sha384SHA-384
Sha512SHA-512

NamedCurve

VariantWeb Crypto name
P256P-256
P384P-384
P521P-521

GenerateKeyParams

Used with generate_key to specify key generation parameters that go beyond the Algorithm enum.

VariantFields
Rsaalgorithm: Algorithm, modulus_length: u32, public_exponent: Vec<u8>
Ecalgorithm: Algorithm
Aesalgorithm: Algorithm, length: u16
Hmacalgorithm: Algorithm
Ed25519(none)
X25519(none)