ICryptoEngine
Extends
SubtleCrypto
Properties
crypto
crypto:
Crypto
name
name:
string
subtle
subtle:
SubtleCrypto
Methods
decrypt()
decrypt(
algorithm
,key
,data
):Promise
<ArrayBuffer
>
Parameters
algorithm
AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams
key
CryptoKey
data
BufferSource
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.decrypt
decryptEncryptedContentInfo()
decryptEncryptedContentInfo(
parameters
):Promise
<ArrayBuffer
>
Decrypt data stored in "EncryptedContentInfo" object using parameters
Parameters
parameters
Returns
Promise
<ArrayBuffer
>
deriveBits()
deriveBits(
algorithm
,baseKey
,length
):Promise
<ArrayBuffer
>
Parameters
algorithm
AlgorithmIdentifier
| Pbkdf2Params
| EcdhKeyDeriveParams
| HkdfParams
baseKey
CryptoKey
length
number
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.deriveBits
deriveKey()
Call Signature
deriveKey(
algorithm
,baseKey
,derivedKeyType
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
algorithm
AlgorithmIdentifier
| Pbkdf2Params
| EcdhKeyDeriveParams
| HkdfParams
baseKey
CryptoKey
derivedKeyType
AlgorithmIdentifier
| Pbkdf2Params
| HkdfParams
| AesDerivedKeyParams
| HmacImportParams
extractable
boolean
keyUsages
KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.deriveKey
Call Signature
deriveKey(
algorithm
,baseKey
,derivedKeyType
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
algorithm
AlgorithmIdentifier
| Pbkdf2Params
| EcdhKeyDeriveParams
| HkdfParams
baseKey
CryptoKey
derivedKeyType
AlgorithmIdentifier
| Pbkdf2Params
| HkdfParams
| AesDerivedKeyParams
| HmacImportParams
extractable
boolean
keyUsages
Iterable
<KeyUsage
>
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.deriveKey
digest()
digest(
algorithm
,data
):Promise
<ArrayBuffer
>
Parameters
algorithm
AlgorithmIdentifier
data
BufferSource
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.digest
encrypt()
encrypt(
algorithm
,key
,data
):Promise
<ArrayBuffer
>
Parameters
algorithm
AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams
key
CryptoKey
data
BufferSource
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.encrypt
encryptEncryptedContentInfo()
encryptEncryptedContentInfo(
parameters
):Promise
<EncryptedContentInfo
>
Specialized function encrypting "EncryptedContentInfo" object using parameters
Parameters
parameters
Returns
Promise
<EncryptedContentInfo
>
exportKey()
Call Signature
exportKey(
format
,key
):Promise
<JsonWebKey
>
Parameters
format
"jwk"
key
CryptoKey
Returns
Promise
<JsonWebKey
>
Inherited from
SubtleCrypto.exportKey
Call Signature
exportKey(
format
,key
):Promise
<ArrayBuffer
>
Parameters
format
"pkcs8"
| "raw"
| "spki"
key
CryptoKey
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.exportKey
Call Signature
exportKey(
format
,key
):Promise
<ArrayBuffer
|JsonWebKey
>
Parameters
format
KeyFormat
key
CryptoKey
Returns
Promise
<ArrayBuffer
| JsonWebKey
>
Inherited from
SubtleCrypto.exportKey
generateKey()
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKeyPair
>
Parameters
algorithm
"Ed25519"
extractable
boolean
keyUsages
readonly ("sign"
| "verify"
)[]
Returns
Promise
<CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKeyPair
>
Parameters
algorithm
RsaHashedKeyGenParams
| EcKeyGenParams
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
algorithm
AesKeyGenParams
| HmacKeyGenParams
| Pbkdf2Params
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
|CryptoKeyPair
>
Parameters
algorithm
AlgorithmIdentifier
extractable
boolean
keyUsages
KeyUsage
[]
Returns
Promise
<CryptoKey
| CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKeyPair
>
Parameters
algorithm
"Ed25519"
extractable
boolean
keyUsages
readonly ("sign"
| "verify"
)[]
Returns
Promise
<CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKeyPair
>
Parameters
algorithm
RsaHashedKeyGenParams
| EcKeyGenParams
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
algorithm
AesKeyGenParams
| HmacKeyGenParams
| Pbkdf2Params
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.generateKey
Call Signature
generateKey(
algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
|CryptoKeyPair
>
Parameters
algorithm
AlgorithmIdentifier
extractable
boolean
keyUsages
Iterable
<KeyUsage
>
Returns
Promise
<CryptoKey
| CryptoKeyPair
>
Inherited from
SubtleCrypto.generateKey
getAlgorithmByOID()
Call Signature
getAlgorithmByOID<
T
>(oid
,safety?
,target?
):object
|T
Gets WebCrypto algorithm by wel-known OID
Type Parameters
T
T
extends Algorithm
= Algorithm
Parameters
oid
string
algorithm identifier
safety?
boolean
if true
throws exception on unknown algorithm identifier
target?
string
name of the target
Returns
object
| T
Returns WebCrypto algorithm or an empty object
Call Signature
getAlgorithmByOID<
T
>(oid
,safety
,target?
):T
Gets WebCrypto algorithm by wel-known OID
Type Parameters
T
T
extends Algorithm
= Algorithm
Parameters
oid
string
algorithm identifier
safety
true
if true
throws exception on unknown algorithm identifier
target?
string
name of the target
Returns
T
Returns WebCrypto algorithm
Throws
Throws Error exception if unknown algorithm identifier
getAlgorithmParameters()
getAlgorithmParameters(
algorithmName
,operation
):CryptoEngineAlgorithmParams
Get default algorithm parameters for each kind of operation
Parameters
algorithmName
string
Algorithm name to get common parameters for
operation
CryptoEngineAlgorithmOperation
Kind of operation: "sign", "encrypt", "generateKey", "importKey", "exportKey", "verify"
Returns
getHashAlgorithm()
getHashAlgorithm(
signatureAlgorithm
):string
Getting hash algorithm by signature algorithm
Parameters
signatureAlgorithm
Signature algorithm
Returns
string
getOIDByAlgorithm()
getOIDByAlgorithm(
algorithm
,safety?
,target?
):string
Get OID for each specific algorithm
Parameters
algorithm
Algorithm
WebCrypto Algorithm
safety?
boolean
If true
throws exception on unknown algorithm. Default is false
target?
string
Name of the target
Returns
string
Throws
Throws Error exception if unknown WebCrypto algorithm
getPublicKey()
getPublicKey(
publicKeyInfo
,signatureAlgorithm
,parameters?
):Promise
<CryptoKey
>
Parameters
publicKeyInfo
signatureAlgorithm
parameters?
Returns
Promise
<CryptoKey
>
getRandomValues()
getRandomValues<
T
>(array
):T
Type Parameters
T
T
extends ArrayBufferView
| null
Parameters
array
T
Returns
T
getSignatureParameters()
getSignatureParameters(
privateKey
,hashAlgorithm?
):Promise
<CryptoEngineSignatureParams
>
Get signature parameters by analyzing private key algorithm
Parameters
privateKey
CryptoKey
The private key user would like to use
hashAlgorithm?
string
Hash algorithm user would like to use. Default is SHA-1
Returns
Promise
<CryptoEngineSignatureParams
>
importKey()
Call Signature
importKey(
format
,keyData
,algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
"jwk"
keyData
JsonWebKey
algorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.importKey
Call Signature
importKey(
format
,keyData
,algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
"pkcs8"
| "raw"
| "spki"
keyData
BufferSource
algorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.importKey
Call Signature
importKey(
format
,keyData
,algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
"jwk"
keyData
JsonWebKey
algorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
readonly KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.importKey
Call Signature
importKey(
format
,keyData
,algorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
"pkcs8"
| "raw"
| "spki"
keyData
BufferSource
algorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
Iterable
<KeyUsage
>
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.importKey
sign()
sign(
algorithm
,key
,data
):Promise
<ArrayBuffer
>
Parameters
algorithm
AlgorithmIdentifier
| RsaPssParams
| EcdsaParams
key
CryptoKey
data
BufferSource
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.sign
signWithPrivateKey()
signWithPrivateKey(
data
,privateKey
,parameters
):Promise
<ArrayBuffer
>
Sign data with pre-defined private key
Parameters
data
BufferSource
Data to be signed
privateKey
CryptoKey
Private key to use
parameters
CryptoEngineSignWithPrivateKeyParams
Parameters for used algorithm
Returns
Promise
<ArrayBuffer
>
stampDataWithPassword()
stampDataWithPassword(
parameters
):Promise
<ArrayBuffer
>
Stamping (signing) data using algorithm similar to HMAC
Parameters
parameters
CryptoEngineStampDataWithPasswordParams
Returns
Promise
<ArrayBuffer
>
unwrapKey()
Call Signature
unwrapKey(
format
,wrappedKey
,unwrappingKey
,unwrapAlgorithm
,unwrappedKeyAlgorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
KeyFormat
wrappedKey
BufferSource
unwrappingKey
CryptoKey
unwrapAlgorithm
AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams
unwrappedKeyAlgorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
KeyUsage
[]
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.unwrapKey
Call Signature
unwrapKey(
format
,wrappedKey
,unwrappingKey
,unwrapAlgorithm
,unwrappedKeyAlgorithm
,extractable
,keyUsages
):Promise
<CryptoKey
>
Parameters
format
KeyFormat
wrappedKey
BufferSource
unwrappingKey
CryptoKey
unwrapAlgorithm
AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams
unwrappedKeyAlgorithm
AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm
extractable
boolean
keyUsages
Iterable
<KeyUsage
>
Returns
Promise
<CryptoKey
>
Inherited from
SubtleCrypto.unwrapKey
verify()
verify(
algorithm
,key
,signature
,data
):Promise
<boolean
>
Parameters
algorithm
AlgorithmIdentifier
| RsaPssParams
| EcdsaParams
key
CryptoKey
signature
BufferSource
data
BufferSource
Returns
Promise
<boolean
>
Inherited from
SubtleCrypto.verify
verifyDataStampedWithPassword()
verifyDataStampedWithPassword(
parameters
):Promise
<boolean
>
Parameters
parameters
CryptoEngineVerifyDataStampedWithPasswordParams
Returns
Promise
<boolean
>
verifyWithPublicKey()
verifyWithPublicKey(
data
,signature
,publicKeyInfo
,signatureAlgorithm
,shaAlgorithm?
):Promise
<boolean
>
Verify data with the public key
Parameters
data
BufferSource
Data to be verified
signature
any
Signature value
publicKeyInfo
Public key information
signatureAlgorithm
Signature algorithm
shaAlgorithm?
string
Hash algorithm
Returns
Promise
<boolean
>
wrapKey()
wrapKey(
format
,key
,wrappingKey
,wrapAlgorithm
):Promise
<ArrayBuffer
>
Parameters
format
KeyFormat
key
CryptoKey
wrappingKey
CryptoKey
wrapAlgorithm
AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams
Returns
Promise
<ArrayBuffer
>
Inherited from
SubtleCrypto.wrapKey