new AesAlgorithm()
The AesAlgorithm class provides static methods to manipulate keys, encrypt
and decrypt using the AES symmetric key cipher.
- Source:
Methods
(static) decrypt(keyBits, encryptedData, params) → {Blob}
Decrypt the encryptedData using the keyBits according the encrypt params.
Parameters:
Name | Type | Description |
---|---|---|
keyBits |
Blob | The key value. |
encryptedData |
Blob | The data to decrypt. |
params |
EncryptParams | This decrypts according to params.getAlgorithmType() and other params as needed such as params.getInitialVector(). |
- Source:
Throws:
Error If decryptPromise doesn't return a SyncPromise which is
already fulfilled.
Returns:
The decrypted data.
- Type
- Blob
(static) decryptPromise(keyBits, encryptedData, params, useSync) → {Promise|SyncPromise}
Decrypt the encryptedData using the keyBits according the encrypt params.
Parameters:
Name | Type | Description |
---|---|---|
keyBits |
Blob | The key value. |
encryptedData |
Blob | The data to decrypt. |
params |
EncryptParams | This decrypts according to params.getAlgorithmType() and other params as needed such as params.getInitialVector(). |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns the decrypted Blob.
- Type
- Promise | SyncPromise
(static) deriveEncryptKey(keyBits) → {EncryptKey}
Derive a new encrypt key from the given decrypt key value.
Parameters:
Name | Type | Description |
---|---|---|
keyBits |
Blob | The key value of the decrypt key. |
- Source:
Returns:
The new encrypt key.
- Type
- EncryptKey
(static) encrypt(keyBits, plainData, params) → {Blob}
Encrypt the plainData using the keyBits according the encrypt params.
Parameters:
Name | Type | Description |
---|---|---|
keyBits |
Blob | The key value. |
plainData |
Blob | The data to encrypt. |
params |
EncryptParams | This encrypts according to params.getAlgorithmType() and other params as needed such as params.getInitialVector(). |
- Source:
Throws:
Error If encryptPromise doesn't return a SyncPromise which is
already fulfilled.
Returns:
The encrypted data.
- Type
- Blob
(static) encryptPromise(keyBits, plainData, params, useSync) → {Promise|SyncPromise}
Encrypt the plainData using the keyBits according the encrypt params.
Parameters:
Name | Type | Description |
---|---|---|
keyBits |
Blob | The key value. |
plainData |
Blob | The data to encrypt. |
params |
EncryptParams | This encrypts according to params.getAlgorithmType() and other params as needed such as params.getInitialVector(). |
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- Source:
Returns:
A promise which returns the encrypted Blob.
- Type
- Promise | SyncPromise
(static) generateKey(params) → {DecryptKey}
Generate a new random decrypt key for AES based on the given params.
Parameters:
Name | Type | Description |
---|---|---|
params |
AesKeyParams | The key params with the key size (in bits). |
- Source:
Returns:
The new decrypt key.
- Type
- DecryptKey