Skip to content

Instantly share code, notes, and snippets.

@dignifiedquire
Last active September 26, 2016 08:29
Show Gist options
  • Save dignifiedquire/b2e211605e0e5c58dfb221f7a9307aac to your computer and use it in GitHub Desktop.
Save dignifiedquire/b2e211605e0e5c58dfb221f7a9307aac to your computer and use it in GitHub Desktop.
// This should be valid
// according to https://tools.ietf.org/html/rfc3447#appendix-A.1.2
const RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
this.seq().obj(
this.key('version').int(),
this.key('modulus').int(),
this.key('publicExponent').int(),
this.key('privateExponent').int(),
this.key('prime1').int(),
this.key('prime2').int(),
this.key('exponent1').int(),
this.key('exponent2').int(),
this.key('coefficient').int(),
this.key('otherPrimeInfos').use(OtherPrimeInfos)
)
})
const OtherPrimeInfos = asn1.define('OtherPrimeInfos', function () {
this.seq().obj(
this.key('prime').int(),
this.key('exponent').int(),
this.key('coefficient').int()
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment