RSA public key interface for encryption operations.
const publicKey: RSAPublicKey = importPublicKey(pemString);const encrypted = publicKey.encrypt('Hello', sha256.create()); Copy
const publicKey: RSAPublicKey = importPublicKey(pemString);const encrypted = publicKey.encrypt('Hello', sha256.create());
Encrypt data using RSA-OAEP algorithm.
The string data to be encrypted.
The hash algorithm instance to use (e.g., sha256.create()).
sha256.create()
The encrypted data as an ArrayBuffer.
const encrypted = publicKey.encrypt('sensitive data', sha256.create()); Copy
const encrypted = publicKey.encrypt('sensitive data', sha256.create());
RSA public key interface for encryption operations.
Example