new RsaAlgorithm()
The RsaAlgorithm class provides static methods to manipulate keys, encrypt
and decrypt using RSA.
- 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 (PKCS8-encoded private key). |
encryptedData |
Blob | The data to decrypt. |
params |
EncryptParams | This decrypts according to params.getAlgorithmType(). |
- 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 (PKCS8-encoded private key). |
encryptedData |
Blob | The data to decrypt. |
params |
EncryptParams | This decrypts according to params.getAlgorithmType(). |
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 (PKCS8-encoded private key). |
- Source:
Returns:
The new encrypt key (DER-encoded public 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 (DER-encoded public key). |
plainData |
Blob | The data to encrypt. |
params |
EncryptParams | This encrypts according to params.getAlgorithmType(). |
- 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 (DER-encoded public key). |
plainData |
Blob | The data to encrypt. |
params |
EncryptParams | This encrypts according to params.getAlgorithmType(). |
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 RSA based on the given params.
Parameters:
Name | Type | Description |
---|---|---|
params |
RsaKeyParams | The key params with the key size (in bits). |
- Source:
Throws:
Error If generateKeyPromise doesn't return a SyncPromise which is
already fulfilled.
Returns:
The new decrypt key (containing a PKCS8-encoded private
key).
- Type
- DecryptKey
(static) generateKeyPromise(params, useSync) → {Promise|SyncPromise}
Generate a new random decrypt key for RSA based on the given params.
Parameters:
Name | Type | Description |
---|---|---|
params |
RsaKeyParams | The key params with the key size (in bits). |
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 new DecryptKey
(containing a PKCS8-encoded private key).
- Type
- Promise | SyncPromise
(static) getRsaPrivateKeyDer(The, The)
Decode the PKCS #8 private key, check that the algorithm is RSA, and return
the inner RSAPrivateKey DER.
Parameters:
Name | Type | Description |
---|---|---|
The |
Blob | DER-encoded PKCS #8 private key. |
The |
Blob | DER-encoded RSAPrivateKey. |
- Source: