GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — CryptoKeyPair - Web APIs | MDN

CryptoKeyPair

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

CryptoKeyPair.privateKey

A CryptoKey object representing the private key. For encryption and decryption algorithms, this key is used to decrypt. For signing and verification algorithms it is used to sign.

CryptoKeyPair.publicKey

A CryptoKey object representing the public key. For encryption and decryption algorithms, this key is used to encrypt. For signing and verification algorithms it is used to verify signatures.

Examples

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

  • SubtleCrypto.generateKey()
  • SubtleCrypto.deriveKey()
  • SubtleCrypto.importKey()
  • SubtleCrypto.exportKey()
  • SubtleCrypto.wrapKey()
  • SubtleCrypto.unwrapKey()
  • SubtleCrypto.encrypt()
  • SubtleCrypto.decrypt()
  • SubtleCrypto.sign()
  • SubtleCrypto.verify()

Specifications

Specification
Web Cryptography Level 2
# keypair

See also

  • SubtleCrypto.generateKey.
  • SubtleCrypto.sign and SubtleCrypto.verify.
  • SubtleCrypto.encrypt and SubtleCrypto.decrypt.

Help improve MDN

Learn how to contribute

This page was last modified on Feb 19, 2023 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.