CryptoKeyPair
dictionary of the
Web 加密 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.
CryptoKey.privateKey
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.
CryptoKey.publicKey
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.
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()
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Cryptography API
The definition of 'CryptoKeyPair' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
CryptoKeyPair
|
Chrome 37 | Edge ≤18 | Firefox 34 | IE No | Opera ? | Safari No | WebView Android 37 | Chrome Android 37 | Firefox Android 34 | Opera Android ? | Safari iOS No | Samsung Internet Android 3.0 |
完整支持
不支持
兼容性未知
SubtleCrypto.generateKey
.
SubtleCrypto.sign
and
SubtleCrypto.verify
.
SubtleCrypto.encrypt
and
SubtleCrypto.decrypt
.
CryptoKeyPair