-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: get rid of multiple asn1 OID mappings
- Loading branch information
Showing
8 changed files
with
55 additions
and
106 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
const oids = require('./oids') | ||
|
||
module.exports = function () { | ||
this.seq().obj( | ||
this.key('algorithm').objid(), | ||
this.key('parameters').optional().any() | ||
this.key('algorithm').objid(oids), | ||
this.key('parameters').optional().choice({ namedCurve: this.objid(oids), null: this.null_() }) | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
const oids = require('./oids') | ||
|
||
module.exports = function () { | ||
this.seq().obj( | ||
this.key('version').int(), | ||
this.key('privateKey').octstr(), | ||
this.key('parameters').explicit(0).optional().choice({ namedCurve: this.objid() }), | ||
this.key('parameters').explicit(0).optional().choice({ namedCurve: this.objid(oids) }), | ||
this.key('publicKey').explicit(1).optional().bitstr() | ||
) | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { name: secp256k1 } = require('../../jwk/key/secp256k1_crv') | ||
|
||
const oids = { | ||
'1 2 840 10045 3 1 7': 'P-256', | ||
'1 3 132 0 10': secp256k1, | ||
'1 3 132 0 34': 'P-384', | ||
'1 3 132 0 35': 'P-521', | ||
'1 2 840 10045 2 1': 'ecPublicKey', | ||
'1 2 840 113549 1 1 1': 'rsaEncryption', | ||
'1 3 101 110': 'X25519', | ||
'1 3 101 111': 'X448', | ||
'1 3 101 112': 'Ed25519', | ||
'1 3 101 113': 'Ed448' | ||
} | ||
|
||
module.exports = oids |
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
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
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
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