Algorithm parameters
History
The algorithm parameter objects define the methods and parameters used by
the various SubtleCrypto methods. While described here as "classes", they
are simple JavaScript dictionary objects.
stringArrayBuffer | TypedArray | DataView | Buffer | undefinedExtra input that is not encrypted but is included in the authentication
of the data. The use of additionalData is optional.
ArrayBuffer | TypedArray | DataView | BufferThe initialization vector must be unique for every encryption operation using a given key.
string'AES-GCM', 'AES-OCB', or 'ChaCha20-Poly1305'.numberstring'AES-CBC', 'AES-CTR', 'AES-GCM', 'AES-OCB', or 'AES-KW'numberThe length of the AES key to be derived. This must be either 128, 192,
or 256.
ArrayBuffer | TypedArray | DataView | BufferProvides the initialization vector. It must be exactly 16-bytes in length and should be unpredictable and cryptographically random.
string'AES-CBC'.ArrayBuffer | TypedArray | DataView | BufferThe initial value of the counter block. This must be exactly 16 bytes long.
The AES-CTR method uses the rightmost length bits of the block as the
counter and the remaining bits as the nonce.
numberaesCtrParams.counter that are
to be used as the counter.string'AES-CTR'.numberThe length of the AES key in bits.
stringnumberThe length of the AES key to be generated. This must be either 128, 192,
or 256.
string'AES-CBC', 'AES-CTR', 'AES-GCM', or
'AES-KW'ArrayBuffer | TypedArray | DataView | BufferRepresents the optional associated data.
numberRepresents the memory size in kibibytes. It must be at least 8 times the degree of parallelism.
string'Argon2d', 'Argon2i', or 'Argon2id'.ArrayBuffer | TypedArray | DataView | BufferRepresents the nonce, which is a salt for password hashing applications.
numberRepresents the degree of parallelism.
numberRepresents the number of passes.
ArrayBuffer | TypedArray | DataView | BufferRepresents the optional secret value.
numberRepresents the Argon2 version number. The default and currently only defined version is 19 (0x13).
ArrayBuffer | TypedArray | DataView | Buffer | undefinedThe context member represents the optional context data to associate with
the message.
CShakeParams
History
cShakeParams.length to cShakeParams.outputLength.numbercShakeParams.functionName
History
ArrayBuffer | TypedArray | DataView | Buffer | undefinedThe functionName member represents the NIST function-name byte string used to
domain-separate functions built on top of cSHAKE. Accepted values are:
- empty or
undefined, in which case cSHAKE is equivalent to plain SHAKE - the ASCII byte sequence
'KMAC' - the ASCII byte sequence
'TupleHash' - the ASCII byte sequence
'ParallelHash'
cShakeParams.customization
History
ArrayBuffer | TypedArray | DataView | Buffer | undefinedThe customization member represents the customization data. Accepted
values are:
- empty or
undefined, in which case cSHAKE is equivalent to plain SHAKE - up to 512 bytes of arbitrary data
CryptoKeyECDH key derivation operates by taking as input one party's private key and
another party's public key -- using both to generate a common shared secret.
The ecdhKeyDeriveParams.public property is set to the other party's public
key.
If represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
string'ECDSA'.stringstringstring'ECDSA' or 'ECDH'.string'P-256', 'P-384', 'P-521'.string'ECDSA' or 'ECDH'.string'P-256', 'P-384', 'P-521'.A temporary symmetric secret key (represented as ArrayBuffer) for message encryption
and the ciphertext (that can be transmitted to the message recipient along with the
message) encrypted by this shared key. The recipient uses their private key to determine
what the shared key is which then allows them to decrypt the message.
ArrayBufferArrayBufferA temporary symmetric secret key (represented as CryptoKey) for message encryption
and the ciphertext (that can be transmitted to the message recipient along with the
message) encrypted by this shared key. The recipient uses their private key to determine
what the shared key is which then allows them to decrypt the message.
ArrayBufferCryptoKeyIf represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
ArrayBuffer | TypedArray | DataView | BufferProvides application-specific contextual input to the HKDF algorithm. This can be zero-length but must be provided.
string'HKDF'.ArrayBuffer | TypedArray | DataView | BufferThe salt value significantly improves the strength of the HKDF algorithm.
It should be random or pseudorandom and should be the same length as the
output of the digest function (for instance, if using 'SHA-256' as the
digest, the salt should be 256-bits of random data).
If represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
numberThe optional number of bits in the HMAC key. This is optional and should be omitted for most cases.
string'HMAC'.AlgorithmnumberThe length of the HMAC key in bits.
stringIf represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
numberThe number of bits to generate for the HMAC key. If omitted, the length will be determined by the hash algorithm used. This is optional and should be omitted for most cases.
string'HMAC'.stringkangarooTwelveParams.customization
History
ArrayBuffer | TypedArray | DataView | Buffer | undefinedThe optional customization string for KangarooTwelve. It must not exceed 512 bytes.
numbernumberThe optional number of bits in the KMAC key. This is optional and should be omitted for most cases.
string'KMAC128' or 'KMAC256'.numberThe length of the KMAC key in bits.
stringnumberThe number of bits to generate for the KMAC key. If omitted, the length will be determined by the KMAC algorithm used. This is optional and should be omitted for most cases.
string'KMAC128' or 'KMAC256'.KmacParams
History
kmacParams.length to kmacParams.outputLength.string'KMAC128' or 'KMAC256'.numberArrayBuffer | TypedArray | DataView | Buffer | undefinedThe customization member represents the optional customization string.
If represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
numberThe number of iterations the PBKDF2 algorithm should make when deriving bits.
string'PBKDF2'.ArrayBuffer | TypedArray | DataView | BufferShould be at least 16 random or pseudorandom bytes.
rsaHashedImportParams.hash
History
If represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
string'RSASSA-PKCS1-v1_5', 'RSA-PSS', or
'RSA-OAEP'.AlgorithmnumberThe length in bits of the RSA modulus.
stringUint8ArrayThe RSA public exponent.
rsaHashedKeyGenParams.hash
History
If represented as a string, the value must be one of:
If represented as an Algorithm, the object's name property
must be one of the above listed values.
numberThe length in bits of the RSA modulus. As a best practice, this should be
at least 2048.
string'RSASSA-PKCS1-v1_5', 'RSA-PSS', or
'RSA-OAEP'.Uint8ArrayThe RSA public exponent. This must be a Uint8Array containing a big-endian,
unsigned integer that must fit within 32-bits. The Uint8Array may contain an
arbitrary number of leading zero-bits. The value must be a prime number. Unless
there is reason to use a different value, use new Uint8Array([1, 0, 1])
(65537) as the public exponent.
ArrayBuffer | TypedArray | DataView | BufferAn additional collection of bytes that will not be encrypted, but will be bound to the generated ciphertext.
The rsaOaepParams.label parameter is optional.
string'RSA-OAEP'.string'RSA-PSS'.numberThe length (in bytes) of the random salt to use.
The optional domain separation byte (0x01-0x7f). Defaults to 0x1f.
number