Open sfuser16 opened 3 years ago
That example supports RSA mechanisms only.
We need to update our example script and support ECC mechanisms
That example supports RSA mechanisms only.
We need to update our example script and support ECC mechanisms
Thanks @microshine for your response. I was just trying to add code for that but it doesn't seem to work. Is there somewhere I can refer this and fix? Would appreciate any help.
else if (pkcs10.subjectPublicKeyInfo.algorithm.algorithmId.indexOf("1.2.840.10045.2.1") !== -1) {
var asn1PublicKey = fromBER(pkcs10.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex);
var ecPublicKeySimple = new ECPublicKey({
schema: asn1PublicKey.result
});
var modulusView = new Uint8Array(ecPublicKeySimple.modulus.valueBlock.valueHex);
var modulusBitLength = 0;
if (modulusView[0] === 0x00) modulusBitLength = (ecPublicKeySimple.modulus.valueBlock.valueHex.byteLength - 1) * 8;else modulusBitLength = ecPublicKeySimple.modulus.valueBlock.valueHex.byteLength * 8;
publicKeySize = modulusBitLength.toString();
}
EC key doesn't have modulus. Use algorithm parameters to get information about named curve. Try to use ECPublicKey.namedCurve
For that public key KeyChain shows key size 256bits
@microshine I tried the following code to get that value but it doesn't seem to work and fails at creating ecPublicKeySimple
. Not sure what wrong am I doing. Appreciate if you could help suggest the fix here.
var ecPublicKey = fromBER(pkcs10.subjectPublicKeyInfo.algorithm.algorithmParams.valueBeforeDecode);
var ecPublicKeySimple = new ECPublicKey({
schema: ecPublicKey.result
});
publicKeySize = ecPublicKeySimple.namedCurve;
}
Thank you!!
Hi, Anyone, please suggest how to get the named curve of the ECDSA public key?
Thanks in advance.
Attaching screenshot to demonstrate this. CSR parsing for ECC is not working. The Public Key Size (Bits) shows
< unknown >
Please advice.