Skip to main content

WebCrypto

# pkcs1 -> pkcs8
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in pkcs1.key -out pkcs8.key

Member RsaHashedImportParams.hash is required and must be an instance of (object or DOMString)

await crypto.subtle.importKey('raw', PEM.decode(key).block.bytes, 'RSA-OAEP', false, ['decrypt']);
await crypto.subtle.importKey(
'raw',
PEM.decode(key).block.bytes,
{
name: 'RSA-OAEP',
hash: 'SHA-265',
},
false,
['decrypt'],
);