JSFiddle - React, Tailwind, and code Playground
by Narayan Prusty
JavaScript
var public_key = null;
var private_key = null;
var data = new Uint8Array([1,2,3,4,5,6,7,8,9,0]);
var encrypted_data = null;
var decrypted_data = null;
var crypto = window.crypto || window.msCrypto;
if(crypto.subtle)
{
alert("Cryptography API Supported");
//Generate Keys
//Algorithm Name,
var generate_keys = crypto.subtle.generateKey({name: "RSASSA-PKCS1-v1_5"}, false, ["encrypt", "decrypt"]);
console.log(generate_keys);
generate_keys.oncomplete = function(e){
alert("dsadasd");
}
generate_keys.onerror = function(e){
alert("asdasd");
}
}
else
{
alert("Cryptography API not Supported");
}