Created
November 3, 2020 12:26
-
-
Save lucashenning/005d247a5956533b770537fdc701121c to your computer and use it in GitHub Desktop.
Parse a DER encoded public key with ASN1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EcdsaPubKey = asn1.define('EcdsaPubKey', function(this: any) { | |
// https://tools.ietf.org/html/rfc5480#section-2 | |
this.seq().obj( | |
this.key('algo').seq().obj( | |
this.key('algorithm').objid(), | |
this.key('parameters').objid(), | |
), | |
this.key('pubKey').bitstr() // <-- this is what we want | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment