Encrypt AES Key with RSA
Encrypt an AES Key with an RSA Public Key
The encryptAESKeyWithRSA performs asymmetric encryption using an RSA Public Key and the RSA-OAEP algorithm. The permissions are requested with the help of the Arweave Wallet (Window Object) in a browser environment if no wallet or use_wallet is passed. The node environment expects Arweave JWK to be passed.
Asymmetric encryption is optimal for the encryption of strings (such as the AES key received in the previous function).
Basic Syntax
The function is called as follows:
import { encryptAESKeyWithRSA } from 'arweavekit/encryption';
const encryptedAESKey = await encryptAESKeyWithRSA({params});Input Parameters
The following params are available for this function and they must be passed in as an object:
key: string: TheAESkey used to encrypt data using theencryptDataWithAESfunction.wallet: ArWallet(optional): A value of typeJWKInterfaceoruse_walletcan be passed. Ifuse_walletor nothing is passed to this param, it expectsArConnectto be installed to run the encryption successfully.
Returned Data
The function call returns the following data:
{
encryptedKey: Uint8Array,
}encryptedKey: Uint8Array: TheAESkey encrypted using anRSA Public Key.
Last updated
Was this helpful?