docs.rodeo

MDN Web Docs mirror

CryptoKeyPair

{{APIRef("Web Crypto API")}} 

The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm.

A CryptoKeyPair object can be obtained using {{domxref("SubtleCrypto.generateKey()")}} , when the selected algorithm is one of the asymmetric algorithms: RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP, ECDSA, or ECDH.

It contains two properties, which are both CryptoKey objects: a privateKey property containing the private key and a publicKey property containing the public key.

Instance properties

Examples

The examples for SubtleCrypto methods often use CryptoKeyPair objects. For example:

Specifications

{{Specifications}} 

See also

In this article

View on MDN