The SubtleCrypto interface provides a set of low-level cryptographic primitives such as encryption, decryption, digital signature generation and verification, and key generation and management. It is useful for using secure and efficient cryptographic operations within k6 scripts.
Methods
Method | Description |
---|---|
encrypt | Encrypts the given plaintext data using the specified algorithm and key. |
decrypt | Decrypts the given ciphertext data using the specified algorithm and key. |
sign | Signs the given data using the specified algorithm and key. |
verify | Verifies the signature of the given data using the specified algorithm and key. |
digest | Computes the digest (hash) of the given data using the specified algorithm. |
generateKey | Generates a new cryptographic key for use with the specified algorithm. |
importKey | Imports a raw key material into the Web Crypto API, generating a new key object to use with the specified algorithm. |
exportKey | Exports the raw key material of the given key object. |
Example
example-webcrypto-subtlecrypto.js