SubtleCrypto

Overview

The SubtleCrypto interface of the Web Crypto API provides a number of low-level cryptographic functions. Access to the features of SubtleCrypto is obtained through the subtle property of the Crypto object you get from Window.crypto.

Location

Required Methods


decrypt

Returns a Promise that fulfills with the clear data corresponding to the encrypted text, algorithm, and key given as parameters.

 

method decrypt: dynamic

 

dynamic decrypt()

 

func decrypt() -> dynamic

 

dynamic decrypt()

 

Function decrypt() As dynamic

deriveBits

Returns a Promise that fulfills with a newly generated buffer of pseudo-random bits derived from the master key and specific algorithm given as parameters.

 

method deriveBits: dynamic

 

dynamic deriveBits()

 

func deriveBits() -> dynamic

 

dynamic deriveBits()

 

Function deriveBits() As dynamic

deriveKey

Returns a Promise that fulfills with a newly generated CryptoKey derived from the master key and specific algorithm given as parameters.

 

method deriveKey: dynamic

 

dynamic deriveKey()

 

func deriveKey() -> dynamic

 

dynamic deriveKey()

 

Function deriveKey() As dynamic

digest

Returns a Promise that fulfills with a digest generated from the algorithm and text given as parameters.

 

method digest: dynamic

 

dynamic digest()

 

func digest() -> dynamic

 

dynamic digest()

 

Function digest() As dynamic

encrypt

Returns a Promise that fufills with the encrypted data corresponding to the clear text, algorithm, and key given as parameters.

 

method encrypt: dynamic

 

dynamic encrypt()

 

func encrypt() -> dynamic

 

dynamic encrypt()

 

Function encrypt() As dynamic

exportKey

Returns a Promise that fulfills with a buffer containing the key in the requested format.

 

method exportKey: dynamic

 

dynamic exportKey()

 

func exportKey() -> dynamic

 

dynamic exportKey()

 

Function exportKey() As dynamic

generateKey

Returns a Promise that fulfills with a newly-generated CryptoKey, for symmetrical algorithms, or a CryptoKeyPair, containing two newly generated keys, for asymmetrical algorithms. These will match the algorithm, usages, and extractability given as parameters.

 

method generateKey: dynamic

 

dynamic generateKey()

 

func generateKey() -> dynamic

 

dynamic generateKey()

 

Function generateKey() As dynamic

importKey

Returns a Promise that fulfills with a CryptoKey corresponding to the format, the algorithm, raw key data, usages, and extractability given as parameters.

 

method importKey: dynamic

 

dynamic importKey()

 

func importKey() -> dynamic

 

dynamic importKey()

 

Function importKey() As dynamic

sign

Returns a Promise that fulfills with the signature corresponding to the text, algorithm, and key given as parameters.

 

method sign: dynamic

 

dynamic sign()

 

func sign() -> dynamic

 

dynamic sign()

 

Function sign() As dynamic

unwrapKey

Returns a Promise that fulfills with a CryptoKey corresponding to the wrapped key given in the parameter.

 

method unwrapKey: dynamic

 

dynamic unwrapKey()

 

func unwrapKey() -> dynamic

 

dynamic unwrapKey()

 

Function unwrapKey() As dynamic

verify

Returns a Promise that fulfills with a Boolean value indicating if the signature given as a parameter matches the text, algorithm, and key that are also given as parameters.

 

method verify: Boolean

 

Boolean verify()

 

func verify() -> Boolean

 

Boolean verify()

 

Function verify() As Boolean

wrapKey

Returns a Promise that fulfills with a wrapped symmetric key for usage (transfer and storage) in insecure environments. The wrapped key matches the format specified in the given parameters, and wrapping is done by the given wrapping key, using the specified algorithm.

 

method wrapKey: dynamic

 

dynamic wrapKey()

 

func wrapKey() -> dynamic

 

dynamic wrapKey()

 

Function wrapKey() As dynamic