function decryptMessage(privateKey, ciphertext) {
return window.crypto.subtle.decrypt(
{ name: "RSA-OAEP" },
privateKey,
ciphertext,
);
}SubtleCrypto: decrypt() method / notebook
SubtleCrypto: decrypt() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function decryptMessage(key, ciphertext) {
return window.crypto.subtle.decrypt(
{ name: "AES-CTR", counter, length: 64 },
key,
ciphertext,
);
}function decryptMessage(key, ciphertext) {
// The iv value is the same as that used for encryption
return window.crypto.subtle.decrypt({ name: "AES-CBC", iv }, key, ciphertext);
}function decryptMessage(key, ciphertext) {
// The iv value is the same as that used for encryption
return window.crypto.subtle.decrypt({ name: "AES-GCM", iv }, key, ciphertext);
}