Modifier

Partager via


ModernBrowserCrypto class

Methods

digest(AlgorithmIdentifier, Uint8Array)
exportKey(CryptoKey)
generateKey(RsaHashedKeyGenParams, boolean, KeyUsage[])
getRandomValues(Uint8Array)
importKey(JsonWebKey, RsaHashedImportParams, boolean, KeyUsage[])
sign(AlgorithmIdentifier, CryptoKey, ArrayBuffer)

Method Details

digest(AlgorithmIdentifier, Uint8Array)

function digest(algorithm: AlgorithmIdentifier, data: Uint8Array): Promise<ArrayBuffer>

Parameters

algorithm

AlgorithmIdentifier

data

Uint8Array

Returns

Promise<ArrayBuffer>

exportKey(CryptoKey)

function exportKey(key: CryptoKey): Promise<JsonWebKey>

Parameters

key

CryptoKey

Returns

Promise<JsonWebKey>

generateKey(RsaHashedKeyGenParams, boolean, KeyUsage[])

function generateKey(algorithm: RsaHashedKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>

Parameters

algorithm

RsaHashedKeyGenParams

extractable

boolean

keyUsages

KeyUsage[]

Returns

Promise<CryptoKeyPair>

getRandomValues(Uint8Array)

function getRandomValues(dataBuffer: Uint8Array): Uint8Array

Parameters

dataBuffer

Uint8Array

Returns

Uint8Array

importKey(JsonWebKey, RsaHashedImportParams, boolean, KeyUsage[])

function importKey(keyData: JsonWebKey, algorithm: RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>

Parameters

keyData

JsonWebKey

algorithm

RsaHashedImportParams

extractable

boolean

keyUsages

KeyUsage[]

Returns

Promise<CryptoKey>

sign(AlgorithmIdentifier, CryptoKey, ArrayBuffer)

function sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>

Parameters

algorithm

AlgorithmIdentifier

key

CryptoKey

data

ArrayBuffer

Returns

Promise<ArrayBuffer>