Hyper
Hyper
CDCloudflare Developers
Created by Hyper on 7/5/2023 in #workers-help
Importing private key using jose/web crypto api in cloudflare workers returns an undefined CryptoKey
Hi, im trying to import a PKCS8 private key in my worker. I have attempted to do this using both the jose library (panva/jose) and my own implementation using crypto.subtle.importKey(). In both cases, I get an undefined crypto key:
const pk = await importPKCS8(key, "RS256");
console.log(pk);
const pk = await importPKCS8(key, "RS256");
console.log(pk);
CryptoKey {
usages: undefined,
algorithm: undefined,
extractable: undefined,
type: undefined
}
CryptoKey {
usages: undefined,
algorithm: undefined,
extractable: undefined,
type: undefined
}
I have read through the docs on cloudflare referencing Web Crypto (https://developers.cloudflare.com/workers/runtime-apis/web-crypto) and I believe this type of operation should be supported. Any help is appreciated.
2 replies