importPrivateKeyPemOrThrow
importPrivateKeyPemOrThrow
Imports exactly one unencrypted private-key PEM block by its label: PKCS#8 PRIVATE KEY, PKCS#1 RSA PRIVATE KEY, or SEC1 EC PRIVATE KEY. Bundles (including a certificate plus key) are refused rather than selecting an arbitrary block. Non-PEM surrounding text follows the shared PEM scanner's behavior. Encrypted PKCS#8 and traditional encrypted PEM require the explicit password-taking import functions. No format guessing or decryption is attempted.
Without algorithm, existing inference applies (RSA defaults to PKCS#1v1.5/SHA-256). An explicit descriptor additionally asserts key family/curve and selects RSA padding/hash.
ts
function importPrivateKeyPemOrThrow(
pem: string,
algorithm?: PrivateKeyImportInput,
): Promise<CryptoKey>Parameters
pem:stringalgorithm?:PrivateKeyImportInput