Hi, I'm working on p12 generation for ECC keytype pem and certs.
I'm getting error when I'm passing EC private key to below logic, can you guide me if you have any idea?
const { PEM, ASN1, Class, Tag } = require('@fidm/asn1')
// ASN.1 Template https://tools.ietf.org/html/rfc5208
const privateKeyValidator = {
name: 'PrivateKeyInfo',
class: Class.UNIVERSAL,
tag: Tag.SEQUENCE,
capture: 'privateKeyInfo',
value: [{
name: 'PrivateKeyInfo.Version',
class: Class.UNIVERSAL,
tag: Tag.INTEGER,
capture: 'privateKeyVersion'
}, {
name: 'PrivateKeyInfo.AlgorithmIdentifier',
class: Class.UNIVERSAL,
tag: Tag.SEQUENCE,
value: [{
name: 'PrivateKeyAlgorithmIdentifier.algorithm',
class: Class.UNIVERSAL,
tag: Tag.OID,
capture: 'privateKeyOID'
}]
}, {
name: 'PrivateKeyInfo.PrivateKey',
class: Class.UNIVERSAL,
tag: Tag.OCTETSTRING,
capture: 'privateKey'
}]
}
const rootkey = PEM.parse(fs.readFileSync('ecctestPK.pem'))[0];
console.log(rootkey)
const captures = ASN1.parseDERWithTemplate(rootkey.body, privateKeyValidator);
console.log("******************")
console.log(captures)```
Hi, I'm working on p12 generation for ECC keytype pem and certs.
I'm getting error when I'm passing EC private key to below logic, can you guide me if you have any idea?