forge
forge copied to clipboard
When trying to use certificateFromPem i got failure : "Cannot read public key. OID is not RSA.
After importing my PEM encoded X.509 certificate, and trying to do
const cert = forge.pki.certificateFromPem(myCertificate)
I got this error Cannot read public key. OID is not RSA
By trying to use another certificate it worked..
Would you please provide help to overcome this issue?
Hi, have same error 'Cannot read public key. OID is not RSA.' on add certificate
const p7 = forge.pkcs7.createSignedData();
p7.addCertificate(fs.readFileSync('cert.pem', {encoding: 'utf8'}));
cert.pem file is:
-----BEGIN CERTIFICATE-----
MIIBJTCBy6ADAgECAgRdtyAQMAoGCCqGSM49BAMCMBUxEzARBgNVBAMMCmNhLXNz
dmRlbW8wIBcNMTkxMDI4MTcwNjI0WhgPMjA2OTEwMjcxNzA2MjRaMA8xDTALBgNV
BAMMBHVzZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATk96n0BUDkEJK/iiWO
EjWFatMrlEYJmMh2kvFouQjIh5ozEfKZUcLEBEvODEA8ZFuxicOYrOSKvdl9G3Ut
d6v3ow0wCzAJBgNVHRMEAjAAMAoGCCqGSM49BAMCA0kAMEYCIQCCkDBL9+2juC7R
q56VlgiJ3qMqywkEj/Ppzll7uS2UbAIhALQ3BrHJOXVflo5KnOFVmr4P0OZEptTV
X0tUke1biXyg
-----END CERTIFICATE-----
what is wrong?
Any update for this issue? We had the sam problem when calling certificateFromPem
to decode the cert.
I ran into same problem. I suspect it's because the certificate is for elliptic curve key, not an RSA key. Can anyone confirm this?
Seems to be related to elliptical curve support https://github.com/digitalbazaar/forge/issues/116.
@olfa-arfani @eddso @binli0114 Any updates on this ticket? Have you folks resolved this using some other method?
I had to use jsrasign
and this workaround helped me validate the certificate chain. However now I am left with 2 dependencies in my project and node-forge
API is far more elegant than the jsrasign's