On this page

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.

C

Algorithm

History
P

Algorithm.name

History
Type:string
C

AeadParams

History
P

aeadParams.additionalData

History

Extra input that is not encrypted but is included in the authentication of the data. The use of additionalData is optional.

P

aeadParams.iv

History

The initialization vector must be unique for every encryption operation using a given key.

P

aeadParams.name

History
Type:string
Must be 'AES-GCM', 'AES-OCB', or 'ChaCha20-Poly1305'.
P

aeadParams.tagLength

History
Type:number
The size in bits of the generated authentication tag.
C

AesDerivedKeyParams

History
P

aesDerivedKeyParams.name

History
Type:string
Must be one of 'AES-CBC', 'AES-CTR', 'AES-GCM', 'AES-OCB', or 'AES-KW'
P

aesDerivedKeyParams.length

History
Type:number

The length of the AES key to be derived. This must be either 128, 192, or 256.

C

AesCbcParams

History
P

aesCbcParams.iv

History

Provides the initialization vector. It must be exactly 16-bytes in length and should be unpredictable and cryptographically random.

P

aesCbcParams.name

History
Type:string
Must be 'AES-CBC'.
C

AesCtrParams

History
P

aesCtrParams.counter

History

The 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.

P

aesCtrParams.length

History
Type:number
The number of bits in the aesCtrParams.counter that are to be used as the counter.
P

aesCtrParams.name

History
Type:string
Must be 'AES-CTR'.
C

AesKeyAlgorithm

History
P

aesKeyAlgorithm.length

History
Type:number

The length of the AES key in bits.

P

aesKeyAlgorithm.name

History
Type:string
C

AesKeyGenParams

History
P

aesKeyGenParams.length

History
Type:number

The length of the AES key to be generated. This must be either 128, 192, or 256.

P

aesKeyGenParams.name

History
Type:string
Must be one of 'AES-CBC', 'AES-CTR', 'AES-GCM', or 'AES-KW'
C

Argon2Params

History
P

argon2Params.associatedData

History

Represents the optional associated data.

P

argon2Params.memory

History
Type:number

Represents the memory size in kibibytes. It must be at least 8 times the degree of parallelism.

P

argon2Params.name

History
Type:string
Must be one of 'Argon2d', 'Argon2i', or 'Argon2id'.
P

argon2Params.nonce

History

Represents the nonce, which is a salt for password hashing applications.

P

argon2Params.parallelism

History
Type:number

Represents the degree of parallelism.

P

argon2Params.passes

History
Type:number

Represents the number of passes.

P

argon2Params.secretValue

History

Represents the optional secret value.

P

argon2Params.version

History
Type:number

Represents the Argon2 version number. The default and currently only defined version is 19 (0x13).

C

ContextParams

History
P

contextParams.name

History
Type:string
Must be 'Ed448'1, 'ML-DSA-44'2, 'ML-DSA-65'2, or 'ML-DSA-87'2.

The context member represents the optional context data to associate with the message.

P

cShakeParams.name

History
Type:string
Must be 'cSHAKE128'1 or 'cSHAKE256'1.
P

cShakeParams.outputLength

History
Type:number
represents the requested output length in bits.

The 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'

The 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
C

EcdhKeyDeriveParams

History
P

ecdhKeyDeriveParams.name

History
Type:string
Must be 'ECDH', 'X25519', or 'X448'1.
P

ecdhKeyDeriveParams.public

History

ECDH 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.

C

EcdsaParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

ecdsaParams.name

History
Type:string
Must be 'ECDSA'.
C

EcKeyAlgorithm

History
P

ecKeyAlgorithm.name

History
Type:string
P

ecKeyAlgorithm.namedCurve

History
Type:string
C

EcKeyGenParams

History
P

ecKeyGenParams.name

History
Type:string
Must be one of 'ECDSA' or 'ECDH'.
P

ecKeyGenParams.namedCurve

History
Type:string
Must be one of 'P-256', 'P-384', 'P-521'.
C

EcKeyImportParams

History
P

ecKeyImportParams.name

History
Type:string
Must be one of 'ECDSA' or 'ECDH'.
P

ecKeyImportParams.namedCurve

History
Type:string
Must be one of 'P-256', 'P-384', 'P-521'.
C

EncapsulatedBits

History

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.

P

encapsulatedBits.ciphertext

History
P

encapsulatedBits.sharedKey

History
C

EncapsulatedKey

History

A 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.

P

encapsulatedKey.ciphertext

History
P

encapsulatedKey.sharedKey

History
C

HkdfParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

hkdfParams.info

History

Provides application-specific contextual input to the HKDF algorithm. This can be zero-length but must be provided.

P

hkdfParams.name

History
Type:string
Must be 'HKDF'.
P

hkdfParams.salt

History

The 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).

C

HmacImportParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

hmacImportParams.length

History
Type:number

The optional number of bits in the HMAC key. This is optional and should be omitted for most cases.

P

hmacImportParams.name

History
Type:string
Must be 'HMAC'.
C

HmacKeyAlgorithm

History
P

hmacKeyAlgorithm.hash

History
P

hmacKeyAlgorithm.length

History
Type:number

The length of the HMAC key in bits.

P

hmacKeyAlgorithm.name

History
Type:string
C

HmacKeyGenParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

hmacKeyGenParams.length

History
Type:number

The 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.

P

hmacKeyGenParams.name

History
Type:string
Must be 'HMAC'.
C

KeyAlgorithm

History
P

keyAlgorithm.name

History
Type:string
C

KangarooTwelveParams

History

The optional customization string for KangarooTwelve. It must not exceed 512 bytes.

P

kangarooTwelveParams.name

History
Type:string
Must be 'KT128'1 or 'KT256'1.
P

kangarooTwelveParams.outputLength

History
Type:number
represents the requested output length in bits.
C

KmacImportParams

History
P

kmacImportParams.length

History
Type:number

The optional number of bits in the KMAC key. This is optional and should be omitted for most cases.

P

kmacImportParams.name

History
Type:string
Must be 'KMAC128' or 'KMAC256'.
C

KmacKeyAlgorithm

History
P

kmacKeyAlgorithm.length

History
Type:number

The length of the KMAC key in bits.

P

kmacKeyAlgorithm.name

History
Type:string
C

KmacKeyGenParams

History
P

kmacKeyGenParams.length

History
Type:number

The 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.

P

kmacKeyGenParams.name

History
Type:string
Must be 'KMAC128' or 'KMAC256'.
P

kmacParams.algorithm

History
Type:string
Must be 'KMAC128' or 'KMAC256'.
P

kmacParams.outputLength

History
Type:number
represents the requested output length in bits.
P

kmacParams.customization

History

The customization member represents the optional customization string.

C

Pbkdf2Params

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

pbkdf2Params.iterations

History
Type:number

The number of iterations the PBKDF2 algorithm should make when deriving bits.

P

pbkdf2Params.name

History
Type:string
Must be 'PBKDF2'.
P

pbkdf2Params.salt

History

Should be at least 16 random or pseudorandom bytes.

C

RsaHashedImportParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

rsaHashedImportParams.name

History
Type:string
Must be one of 'RSASSA-PKCS1-v1_5', 'RSA-PSS', or 'RSA-OAEP'.
C

RsaHashedKeyAlgorithm

History
P

rsaHashedKeyAlgorithm.hash

History
P

rsaHashedKeyAlgorithm.modulusLength

History
Type:number

The length in bits of the RSA modulus.

P

rsaHashedKeyAlgorithm.name

History
Type:string
P

rsaHashedKeyAlgorithm.publicExponent

History

The RSA public exponent.

C

RsaHashedKeyGenParams

History

If represented as a string, the value must be one of:

  • 'SHA-1'
  • 'SHA-256'
  • 'SHA-384'
  • 'SHA-512'
  • 'SHA3-256'1
  • 'SHA3-384'1
  • 'SHA3-512'1

If represented as an Algorithm, the object's name property must be one of the above listed values.

P

rsaHashedKeyGenParams.modulusLength

History
Type:number

The length in bits of the RSA modulus. As a best practice, this should be at least 2048.

P

rsaHashedKeyGenParams.name

History
Type:string
Must be one of 'RSASSA-PKCS1-v1_5', 'RSA-PSS', or 'RSA-OAEP'.
P

rsaHashedKeyGenParams.publicExponent

History

The 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.

C

RsaOaepParams

History
P

rsaOaepParams.label

History

An additional collection of bytes that will not be encrypted, but will be bound to the generated ciphertext.

The rsaOaepParams.label parameter is optional.

P

rsaOaepParams.name

History
Type:string
must be 'RSA-OAEP'.
C

RsaPssParams

History
P

rsaPssParams.name

History
Type:string
Must be 'RSA-PSS'.
P

rsaPssParams.saltLength

History
Type:number

The length (in bytes) of the random salt to use.

C

TurboShakeParams

History
P

turboShakeParams.domainSeparation

History

The optional domain separation byte (0x01-0x7f). Defaults to 0x1f.

P

turboShakeParams.name

History
Type:string
Must be 'TurboSHAKE128'1 or 'TurboSHAKE256'1.
P

turboShakeParams.outputLength

History
Type:number
represents the requested output length in bits.

Footnotes

  1. See Modern Algorithms in the Web Cryptography API 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21