method webcrypto.SubtleCrypto.generateKey
Jump to headingSubtleCrypto.generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams,extractable: boolean,keyUsages: readonly KeyUsage[],): Promise<CryptoKeyPair>
Using the method and parameters provided in algorithm
,
subtle.generateKey()
attempts to generate new keying material.
Depending the method used, the method may generate either a single <CryptoKey>
or a <CryptoKeyPair>
.
The <CryptoKeyPair>
(public and private key) generating algorithms supported include:
-
'RSASSA-PKCS1-v1_5'
-
'RSA-PSS'
-
'RSA-OAEP'
-
'ECDSA'
-
'Ed25519'
-
'Ed448'
-
'ECDH'
-
'X25519'
-
'X448'
The<CryptoKey>
(secret key) generating algorithms supported include: -
'HMAC'
-
'AES-CTR'
-
'AES-CBC'
-
'AES-GCM'
-
'AES-KW'
Parameters Jump to heading
Jump to headingalgorithm: RsaHashedKeyGenParams | EcKeyGenParams
Jump to headingextractable: boolean
Jump to headingkeyUsages: readonly KeyUsage[]
See Key usages.
Return Type Jump to heading
Promise<CryptoKeyPair>
Jump to headingSubtleCrypto.generateKey(): Promise<CryptoKey>
Parameters Jump to heading
Jump to headingalgorithm:
Jump to headingextractable: boolean
Jump to headingkeyUsages: readonly KeyUsage[]
Return Type Jump to heading
Promise<CryptoKey>
Jump to headingSubtleCrypto.generateKey(): Promise<CryptoKeyPair | CryptoKey>
Parameters Jump to heading
Jump to headingalgorithm: AlgorithmIdentifier
Jump to headingextractable: boolean
Jump to headingkeyUsages: KeyUsage[]
Return Type Jump to heading
Promise<CryptoKeyPair | CryptoKey>