I hope someone can help. I have been using cryptico.js and have been generating keys via:
var RSAkey = cryptico.generateRSAKey(passphrase, 512);
var publicKeyString = cryptico.publicKeyString(RSAkey);
Giving me clean good access to a public key, like: vnY5f+HVUQa2oBZKsb2LUgTlso/wtVsA5Ytqlr1RL13xVN81mnIHoL/5/8CKG4rQ/vQfnBAUBYfJzBQGeAXYnw==
I am switching to use WebCrypto API as I want to use a different key type:
promise_key = crypto.subtle.generateKey({name: "ECDSA", namedCurve: "P-256", hash: {name: "SHA-256"} }, true, ["sign", "verify"]);
promise_key.then(function(key) {
private_key_object = key.privateKey;
public_key_object = key.publicKey;
console.log(key.publicKey);
});
I am wanting to get the Public Key String as I do with cryptico, and I am sure I am doing something very silly but I can't seem to get it.
I have used crypto.subtle.exportKey
with 'spki', 'raw' and 'jwk' options but no joy.
Even if I use RSA to generate keys instead of ECDSA, I still get the same.
What am I doing wrong, please?
Thanks a lot