PEM PKCS#8 private key, public key string or PEM certificate
signature algorithm (SHA{1,224,256,384,512}with{RSA,RSAandMGF1,ECDSA})
Optional sigopt: string | numbersaltLength for RSA-PSS
CryptoKey object of W3C Web Crypto API
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
This function import a CryptoKey object from PEM public key,
private key or certificate string.
NOTE1: For EC key, namedCurve value will be automatically
detected by PEM file. So no need to specify.
NOTE2: Importing a PEM certificate is supported since 0.5.0.
prvkey = await importPEM("-----BEGIN PRIVATE...", "SHA256withRSA");
prvkey = await importPEM("-----BEGIN PRIVATE...", "SHA256withRSAandMGF1");
pubkey = await importPEM("-----BEGIN PUBLIC...", "SHA256withECDSA");
pubkey = await importPEM("-----BEGIN CERTIFICATE...", "SHA256withECDSA");
import key from PEM private/public key or certificate string