Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 16 additions & 33 deletions lib/asn1-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ exports.privateKeyValidator = {
name: 'PrivateKeyInfo.version',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.INTEGER,
constructed: false,
capture: 'privateKeyVersion'
}, {
// privateKeyAlgorithm
Expand All @@ -29,20 +28,18 @@ exports.privateKeyValidator = {
name: 'AlgorithmIdentifier.algorithm',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.OID,
constructed: false,
capture: 'privateKeyOid'
}]
}, {
// PrivateKey
name: 'PrivateKeyInfo',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.OCTETSTRING,
constructed: false,
capture: 'privateKey'
}]
};

exports.publicKeyValidator = {
exports.publicKeyInfoValidator = {
name: 'SubjectPublicKeyInfo',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.SEQUENCE,
Expand All @@ -54,38 +51,24 @@ exports.publicKeyValidator = {
type: asn1.Type.SEQUENCE,
constructed: true,
value: [{
name: 'AlgorithmIdentifier.algorithm',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.OID,
constructed: false,
capture: 'publicKeyOid'
}]
},
// capture group for ed25519PublicKey
{
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.BITSTRING,
constructed: false,
composed: true,
captureBitStringValue: 'ed25519PublicKey'
}
// FIXME: this is capture group for rsaPublicKey, use it in this API or
// discard?
/* {
name: 'AlgorithmIdentifier.algorithm',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.OID,
capture: 'publicKeyOid'
},
{
name: 'AlgorithmIdentifier.parameters',
tagClass: asn1.Class.UNIVERSAL,
optional: true,
captureAsn1: 'parameters',
}]
}, {
// subjectPublicKey
name: 'SubjectPublicKeyInfo.subjectPublicKey',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.BITSTRING,
constructed: false,
value: [{
// RSAPublicKey
name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey',
tagClass: asn1.Class.UNIVERSAL,
type: asn1.Type.SEQUENCE,
constructed: true,
optional: true,
captureAsn1: 'rsaPublicKey'
}]
} */
]
captureAsn1: 'subjectPublicKey', // used by RSA
captureBitStringValue: 'subjectPublicKeyRaw', // used by ECDSA and ED25519
}]
};
Loading