Skip to main content

Crate rong_crypto

Crate rong_crypto 

Source
Expand description

§Web Cryptography module

Installs globalThis.crypto (Crypto) together with the SubtleCrypto and CryptoKey interfaces, following the Web Cryptography API and the globalThis.crypto semantics shared by browsers, Deno and workerd.

§Implemented

  • crypto.getRandomValues(typedArray) and crypto.randomUUID()
  • crypto.subtle.digest - SHA-1, SHA-256, SHA-384, SHA-512
  • crypto.subtle.importKey / exportKey - raw and jwk (kty: "oct")
  • crypto.subtle.generateKey - HMAC, AES-GCM, AES-CBC
  • crypto.subtle.sign / verify - HMAC with any of the four hashes
  • crypto.subtle.encrypt / decrypt - AES-GCM (96-bit IV, 128-bit tag) and AES-CBC (PKCS#7)
  • crypto.subtle.deriveBits / deriveKey - PBKDF2 and HKDF

§Not implemented

Asymmetric algorithms (RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP, ECDSA, ECDH, Ed25519, X25519) and AES-CTR/AES-KW are recognized by name and rejected with a NotSupportedError that names the algorithm. Key wrapping (wrapKey/unwrapKey) is likewise absent.

Structs§

Crypto
The Web Cryptography Crypto interface.
CryptoKey
The Web Cryptography CryptoKey interface.
SubtleCrypto
The Web Cryptography SubtleCrypto interface.

Functions§

init
Register Crypto, SubtleCrypto and CryptoKey, then install the globalThis.crypto instance with its subtle member.