AbstractCryptoService
On this page
- AbstractCryptoService ⇐
Abstract- AbstractCryptoService()
- importKey(keyId, key) ⇒
Promise - exportKey(keyId, format) ⇒
Promise - encrypt(data, keyId, algorithm) ⇒
Promise - sign(data, keyId, algorithm) ⇒
Promise - digest(data, algorithm) ⇒
Promise - __isCompleteKey(key) ⇒
Boolean - _importKey(format, data, algorithm, exportable, usages) ⇒
Promise - _exportKey(key, format) ⇒
Promise - _encrypt(data, key, algorithm) ⇒
Promise - _sign(data, key, algorithm) ⇒
Promise - _digest(data, algorithm) ⇒
Promise - CryptoAlgorithm :
HmacAlgorithm|RsaOaepAlgorithm|AesCbcAlgorithm
AbstractCryptoService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Service:
Properties
| Name | Type | Description |
|---|---|---|
| _savedKeys | Object | Cache for all imported keys |
- AbstractCryptoService ⇐
Abstract- new AbstractCryptoService()
- instance
- .importKey(keyId, key) ⇒
Promise - .exportKey(keyId, format) ⇒
Promise - .encrypt(data, keyId, algorithm) ⇒
Promise - .sign(data, keyId, algorithm) ⇒
Promise - .digest(data, algorithm) ⇒
Promise - .__isCompleteKey(key) ⇒
Boolean - ._importKey(format, data, algorithm, exportable, usages) ⇒
Promise - ._exportKey(key, format) ⇒
Promise - ._encrypt(data, key, algorithm) ⇒
Promise - ._sign(data, key, algorithm) ⇒
Promise - ._digest(data, algorithm) ⇒
Promise
- .importKey(keyId, key) ⇒
- inner
- ~CryptoAlgorithm :
HmacAlgorithm|RsaOaepAlgorithm|AesCbcAlgorithm
- ~CryptoAlgorithm :
AbstractCryptoService()
Service to provide low-level cryptographic functions
importKey(keyId, key) ⇒ Promise
Imports a key
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| keyId | String | Unique identifier for the key |
| key | Object | Object that describe a key |
| key.format | String | Describe the data format of the key, value coming from CryptoKeyFormat |
| key.data | ArrayBuffer | TypedArray | DataView | Objet containing the key in the given format |
| key.algorithm | CryptoAlgorithm | Defining the type of key, should be one of defined algorithm |
| key.exportable | Boolean | Indicate if it will be possible to export the key |
| key.usages | Array.<String> | Array that indicate what can be done with the key, strings should come from CryptoUsage |
exportKey(keyId, format) ⇒ Promise
Exports an existing key in the requested format
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| keyId | String | Unique key identifier |
| format | String | Describe the data format of the key, value coming from CryptoKeyFormat |
encrypt(data, keyId, algorithm) ⇒ Promise
Encrypts data
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to be encrypted |
| keyId | String | Unique key identifier to be used for encryption |
| algorithm | CryptoAlgorithm | Algorithm to be used to be used, should be one of defined algorithm |
sign(data, keyId, algorithm) ⇒ Promise
Sign data
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to be signed |
| keyId | String | Unique key identifier to be used for signature |
| algorithm | CryptoAlgorithm | Algorithm to be used to be used, should be one of defined algorithm |
digest(data, algorithm) ⇒ Promise
Digest data
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to be digest |
| algorithm | String | Hash name function coming from CryptoDigestAlgorithm |
__isCompleteKey(key) ⇒ Boolean
Check that parameters key has all the required properties
Kind: instance method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| key | Object | Object to be checked |
_importKey(format, data, algorithm, exportable, usages) ⇒ Promise
Implementation of import key
Kind: instance abstract method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| format | String | Describe the data format of the key, value coming from CryptoKeyFormat |
| data | ArrayBuffer | TypedArray | DataView | Objet containing the key in the given format |
| algorithm | CryptoAlgorithm | Defining the algorithm of key |
| exportable | boolean | Indicate if it will be possible to exporte the key |
| usages | Array.<String> | Array that indicate what can be done with the key, strings should come from CryptoUsage |
_exportKey(key, format) ⇒ Promise
Implementation of export key
Kind: instance abstract method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| key | * | Native key |
| format | String | Describe the data format of the key, value coming from CryptoKeyFormat |
_encrypt(data, key, algorithm) ⇒ Promise
Implementation of encrypt
Kind: instance abstract method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to encrypt |
| key | * | Native key used for encryption |
| algorithm | CryptoAlgorithm | Algorithm to be used |
_sign(data, key, algorithm) ⇒ Promise
Implementation of sign
Kind: instance abstract method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to encrypt |
| key | * | Native key used for encryption |
| algorithm | CryptoAlgorithm | Algorithm to be used |
_digest(data, algorithm) ⇒ Promise
Implementation of digest
Kind: instance abstract method of AbstractCryptoService
| Param | Type | Description |
|---|---|---|
| data | ArrayBuffer | TypedArray | DataView | Data to digest |
| algorithm | String | Hash name function coming from CryptoDigestAlgorithm |
CryptoAlgorithm : HmacAlgorithm | RsaOaepAlgorithm | AesCbcAlgorithm
A type of Algorithm
Kind: inner typedef of AbstractCryptoService