summaryrefslogtreecommitdiff
path: root/node_modules/node-forge/lib/asn1-validator.js
diff options
context:
space:
mode:
authorakiyamn2023-09-24 23:22:21 +1000
committerakiyamn2023-09-24 23:22:21 +1000
commit4e87195739f2a5d9a05451b48773c8afdc680765 (patch)
tree9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/node-forge/lib/asn1-validator.js
downloadprice-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz
price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/node-forge/lib/asn1-validator.js')
-rw-r--r--node_modules/node-forge/lib/asn1-validator.js91
1 files changed, 91 insertions, 0 deletions
diff --git a/node_modules/node-forge/lib/asn1-validator.js b/node_modules/node-forge/lib/asn1-validator.js
new file mode 100644
index 0000000..2be3285
--- /dev/null
+++ b/node_modules/node-forge/lib/asn1-validator.js
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2019 Digital Bazaar, Inc.
+ */
+
+var forge = require('./forge');
+require('./asn1');
+var asn1 = forge.asn1;
+
+exports.privateKeyValidator = {
+ // PrivateKeyInfo
+ name: 'PrivateKeyInfo',
+ tagClass: asn1.Class.UNIVERSAL,
+ type: asn1.Type.SEQUENCE,
+ constructed: true,
+ value: [{
+ // Version (INTEGER)
+ name: 'PrivateKeyInfo.version',
+ tagClass: asn1.Class.UNIVERSAL,
+ type: asn1.Type.INTEGER,
+ constructed: false,
+ capture: 'privateKeyVersion'
+ }, {
+ // privateKeyAlgorithm
+ name: 'PrivateKeyInfo.privateKeyAlgorithm',
+ tagClass: asn1.Class.UNIVERSAL,
+ type: asn1.Type.SEQUENCE,
+ constructed: true,
+ value: [{
+ 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 = {
+ name: 'SubjectPublicKeyInfo',
+ tagClass: asn1.Class.UNIVERSAL,
+ type: asn1.Type.SEQUENCE,
+ constructed: true,
+ captureAsn1: 'subjectPublicKeyInfo',
+ value: [{
+ name: 'SubjectPublicKeyInfo.AlgorithmIdentifier',
+ tagClass: asn1.Class.UNIVERSAL,
+ 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?
+ /* {
+ // 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'
+ }]
+ } */
+ ]
+};