You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing x509 certificate with ECC public key fails with error Cannot read public key. Unknown OID. In our case we only need subject and validity data from certificate which is the same for both RSA and ECC cases. If Forge parses x509 with unsupported keys, it could just leave the key information blank instead of throwing and exception.
I'm not too familiar with Forge source code but I tested the following simple change which worked for our case:
Remove following lines from certificateFromAsn1 function (rows 1288:1290 in x509.js):
if(oid !== pki.oids.rsaEncryption) {
throw new Error('Cannot read public key. OID is not RSA.');
}
Wrap last lines of the same function inside if-block:
if(oid === pki.oids.rsaEncryption) {
// convert RSA public key from ASN.1
cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo);
}
Would this change be acceptable or is there any specific reason why certificateFromAsn1 function should throw exception instead of leaving publicKey field blank?
The text was updated successfully, but these errors were encountered:
Parsing x509 certificate with ECC public key fails with error
Cannot read public key. Unknown OID.
In our case we only need subject and validity data from certificate which is the same for both RSA and ECC cases. If Forge parses x509 with unsupported keys, it could just leave the key information blank instead of throwing and exception.I'm not too familiar with Forge source code but I tested the following simple change which worked for our case:
Remove following lines from certificateFromAsn1 function (rows 1288:1290 in x509.js):
Wrap last lines of the same function inside if-block:
Would this change be acceptable or is there any specific reason why certificateFromAsn1 function should throw exception instead of leaving publicKey field blank?
The text was updated successfully, but these errors were encountered: