@peculiar/asn1-ecc
Advanced tools
| { | ||
| "type": "module" | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.ecdsaWithSHA512 = exports.ecdsaWithSHA384 = exports.ecdsaWithSHA256 = exports.ecdsaWithSHA224 = exports.ecdsaWithSHA1 = void 0; | ||
| const tslib_1 = require("tslib"); | ||
| const asn1_x509_1 = require("@peculiar/asn1-x509"); | ||
| const oid = require("./object_identifiers"); | ||
| const oid = tslib_1.__importStar(require("./object_identifiers")); | ||
| function create(algorithm) { | ||
@@ -7,0 +8,0 @@ return new asn1_x509_1.AlgorithmIdentifier({ algorithm }); |
@@ -8,2 +8,5 @@ "use strict"; | ||
| let ECParameters = class ECParameters { | ||
| namedCurve; | ||
| implicitCurve; | ||
| specifiedCurve; | ||
| constructor(params = {}) { | ||
@@ -10,0 +13,0 @@ Object.assign(this, params); |
@@ -8,5 +8,7 @@ "use strict"; | ||
| class ECPrivateKey { | ||
| version = 1; | ||
| privateKey = new asn1_schema_1.OctetString(); | ||
| parameters; | ||
| publicKey; | ||
| constructor(params = {}) { | ||
| this.version = 1; | ||
| this.privateKey = new asn1_schema_1.OctetString(); | ||
| Object.assign(this, params); | ||
@@ -23,6 +25,10 @@ } | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: ec_parameters_1.ECParameters, context: 0, optional: true }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: ec_parameters_1.ECParameters, context: 0, optional: true, | ||
| }) | ||
| ], ECPrivateKey.prototype, "parameters", void 0); | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString, context: 1, optional: true }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.BitString, context: 1, optional: true, | ||
| }) | ||
| ], ECPrivateKey.prototype, "publicKey", void 0); |
@@ -7,5 +7,5 @@ "use strict"; | ||
| class ECDSASigValue { | ||
| r = new ArrayBuffer(0); | ||
| s = new ArrayBuffer(0); | ||
| constructor(params = {}) { | ||
| this.r = new ArrayBuffer(0); | ||
| this.s = new ArrayBuffer(0); | ||
| Object.assign(this, params); | ||
@@ -16,6 +16,10 @@ } | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], ECDSASigValue.prototype, "r", void 0); | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], ECDSASigValue.prototype, "s", void 0); |
+20
-4
@@ -7,2 +7,4 @@ "use strict"; | ||
| let FieldID = class FieldID { | ||
| fieldType; | ||
| parameters; | ||
| constructor(params = {}) { | ||
@@ -29,2 +31,5 @@ Object.assign(this, params); | ||
| let Curve = class Curve { | ||
| a; | ||
| b; | ||
| seed; | ||
| constructor(params = {}) { | ||
@@ -42,3 +47,5 @@ Object.assign(this, params); | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString, optional: true }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.BitString, optional: true, | ||
| }) | ||
| ], Curve.prototype, "seed", void 0); | ||
@@ -53,4 +60,9 @@ exports.Curve = Curve = tslib_1.__decorate([ | ||
| let SpecifiedECDomain = class SpecifiedECDomain { | ||
| version = ECPVer.ecpVer1; | ||
| fieldID; | ||
| curve; | ||
| base; | ||
| order; | ||
| cofactor; | ||
| constructor(params = {}) { | ||
| this.version = ECPVer.ecpVer1; | ||
| Object.assign(this, params); | ||
@@ -73,6 +85,10 @@ } | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], SpecifiedECDomain.prototype, "order", void 0); | ||
| tslib_1.__decorate([ | ||
| (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, optional: true }) | ||
| (0, asn1_schema_1.AsnProp)({ | ||
| type: asn1_schema_1.AsnPropTypes.Integer, optional: true, | ||
| }) | ||
| ], SpecifiedECDomain.prototype, "cofactor", void 0); | ||
@@ -79,0 +95,0 @@ exports.SpecifiedECDomain = SpecifiedECDomain = tslib_1.__decorate([ |
| import { AlgorithmIdentifier } from "@peculiar/asn1-x509"; | ||
| import * as oid from "./object_identifiers"; | ||
| import * as oid from "./object_identifiers.js"; | ||
| function create(algorithm) { | ||
@@ -4,0 +4,0 @@ return new AlgorithmIdentifier({ algorithm }); |
| import { __decorate } from "tslib"; | ||
| import { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes } from "@peculiar/asn1-schema"; | ||
| import { SpecifiedECDomain } from "./rfc3279"; | ||
| import { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes, } from "@peculiar/asn1-schema"; | ||
| import { SpecifiedECDomain } from "./rfc3279.js"; | ||
| let ECParameters = class ECParameters { | ||
| namedCurve; | ||
| implicitCurve; | ||
| specifiedCurve; | ||
| constructor(params = {}) { | ||
@@ -6,0 +9,0 @@ Object.assign(this, params); |
| import { __decorate } from "tslib"; | ||
| import { AsnProp, AsnPropTypes, OctetString } from "@peculiar/asn1-schema"; | ||
| import { ECParameters } from "./ec_parameters"; | ||
| import { AsnProp, AsnPropTypes, OctetString, } from "@peculiar/asn1-schema"; | ||
| import { ECParameters } from "./ec_parameters.js"; | ||
| export class ECPrivateKey { | ||
| version = 1; | ||
| privateKey = new OctetString(); | ||
| parameters; | ||
| publicKey; | ||
| constructor(params = {}) { | ||
| this.version = 1; | ||
| this.privateKey = new OctetString(); | ||
| Object.assign(this, params); | ||
@@ -18,6 +20,10 @@ } | ||
| __decorate([ | ||
| AsnProp({ type: ECParameters, context: 0, optional: true }) | ||
| AsnProp({ | ||
| type: ECParameters, context: 0, optional: true, | ||
| }) | ||
| ], ECPrivateKey.prototype, "parameters", void 0); | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.BitString, context: 1, optional: true }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.BitString, context: 1, optional: true, | ||
| }) | ||
| ], ECPrivateKey.prototype, "publicKey", void 0); |
| import { __decorate } from "tslib"; | ||
| import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema"; | ||
| import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, } from "@peculiar/asn1-schema"; | ||
| export class ECDSASigValue { | ||
| r = new ArrayBuffer(0); | ||
| s = new ArrayBuffer(0); | ||
| constructor(params = {}) { | ||
| this.r = new ArrayBuffer(0); | ||
| this.s = new ArrayBuffer(0); | ||
| Object.assign(this, params); | ||
@@ -11,6 +11,10 @@ } | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], ECDSASigValue.prototype, "r", void 0); | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], ECDSASigValue.prototype, "s", void 0); |
@@ -1,6 +0,6 @@ | ||
| export * from "./algorithms"; | ||
| export * from "./ec_parameters"; | ||
| export * from "./ec_private_key"; | ||
| export * from "./ec_signature_value"; | ||
| export * from "./object_identifiers"; | ||
| export * from "./rfc3279"; | ||
| export * from "./algorithms.js"; | ||
| export * from "./ec_parameters.js"; | ||
| export * from "./ec_private_key.js"; | ||
| export * from "./ec_signature_value.js"; | ||
| export * from "./object_identifiers.js"; | ||
| export * from "./rfc3279.js"; |
| import { __decorate } from "tslib"; | ||
| import { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes, OctetString, AsnIntegerArrayBufferConverter, } from "@peculiar/asn1-schema"; | ||
| let FieldID = class FieldID { | ||
| fieldType; | ||
| parameters; | ||
| constructor(params = {}) { | ||
@@ -23,2 +25,5 @@ Object.assign(this, params); | ||
| let Curve = class Curve { | ||
| a; | ||
| b; | ||
| seed; | ||
| constructor(params = {}) { | ||
@@ -35,3 +40,5 @@ Object.assign(this, params); | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.BitString, optional: true }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.BitString, optional: true, | ||
| }) | ||
| ], Curve.prototype, "seed", void 0); | ||
@@ -47,4 +54,9 @@ Curve = __decorate([ | ||
| let SpecifiedECDomain = class SpecifiedECDomain { | ||
| version = ECPVer.ecpVer1; | ||
| fieldID; | ||
| curve; | ||
| base; | ||
| order; | ||
| cofactor; | ||
| constructor(params = {}) { | ||
| this.version = ECPVer.ecpVer1; | ||
| Object.assign(this, params); | ||
@@ -66,6 +78,10 @@ } | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter, | ||
| }) | ||
| ], SpecifiedECDomain.prototype, "order", void 0); | ||
| __decorate([ | ||
| AsnProp({ type: AsnPropTypes.Integer, optional: true }) | ||
| AsnProp({ | ||
| type: AsnPropTypes.Integer, optional: true, | ||
| }) | ||
| ], SpecifiedECDomain.prototype, "cofactor", void 0); | ||
@@ -72,0 +88,0 @@ SpecifiedECDomain = __decorate([ |
+32
-15
| { | ||
| "name": "@peculiar/asn1-ecc", | ||
| "version": "2.6.1", | ||
| "description": "ASN.1 schema of `Elliptic Curve Private Key Structure` (RFC5915)", | ||
| "files": [ | ||
| "build/**/*.{js,d.ts}", | ||
| "LICENSE", | ||
| "README.md" | ||
| ], | ||
| "bugs": { | ||
| "url": "https://github.com/PeculiarVentures/asn1-schema/issues" | ||
| }, | ||
| "homepage": "https://github.com/PeculiarVentures/asn1-schema/tree/master/packages/ecc#readme", | ||
| "version": "2.7.0", | ||
| "description": "ASN.1 schema for elliptic-curve private keys and related identifiers defined in RFC 5915, RFC 5480, and RFC 3279.", | ||
| "keywords": [ | ||
| "asn", | ||
| "asn1", | ||
| "ecc", | ||
| "ec", | ||
| "elliptic-curve", | ||
| "rfc5915", | ||
@@ -23,8 +17,31 @@ "rfc5480", | ||
| "license": "MIT", | ||
| "files": [ | ||
| "build/**/*.{js,d.ts}", | ||
| "build/es2015/package.json", | ||
| "LICENSE", | ||
| "README.md" | ||
| ], | ||
| "main": "build/cjs/index.js", | ||
| "module": "build/es2015/index.js", | ||
| "types": "build/types/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./build/types/index.d.ts", | ||
| "import": "./build/es2015/index.js", | ||
| "require": "./build/cjs/index.js" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/PeculiarVentures/asn1-schema", | ||
| "directory": "packages/ecc" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/PeculiarVentures/asn1-schema/issues" | ||
| }, | ||
| "homepage": "https://github.com/PeculiarVentures/asn1-schema/tree/master/packages/ecc#readme", | ||
| "scripts": { | ||
@@ -36,2 +53,3 @@ "clear": "rimraf build", | ||
| "build:es2015": "tsc -p tsconfig.compile.json --removeComments --module ES2015 --outDir build/es2015", | ||
| "postbuild:es2015": "node ../../scripts/prepare_esm_package.mjs build/es2015", | ||
| "prebuild:types": "rimraf build/types", | ||
@@ -42,8 +60,7 @@ "build:types": "tsc -p tsconfig.compile.json --outDir build/types --declaration --emitDeclarationOnly", | ||
| "dependencies": { | ||
| "@peculiar/asn1-schema": "^2.6.0", | ||
| "@peculiar/asn1-x509": "^2.6.1", | ||
| "@peculiar/asn1-schema": "^2.7.0", | ||
| "@peculiar/asn1-x509": "^2.7.0", | ||
| "asn1js": "^3.0.6", | ||
| "tslib": "^2.8.1" | ||
| }, | ||
| "gitHead": "e533eba96fe14ca21b9a1b3f47cb58aaaa78c0ad" | ||
| } | ||
| } |
+15
-7
| # `@peculiar/asn1-ecc` | ||
| [](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/ecc/LICENSE.md) | ||
| [](https://github.com/PeculiarVentures/asn1-schema/blob/master/packages/ecc/LICENSE) | ||
| [](https://badge.fury.io/js/%40peculiar%2Fasn1-ecc) | ||
@@ -8,8 +8,16 @@ | ||
| This module provides ASN.1 schema definitions and parsers for Elliptic Curve Cryptography (ECC) structures. It includes support for various ECC-related standards and specifications, making it easier to work with ECC keys and certificates in JavaScript and TypeScript applications. | ||
| ASN.1 schema for elliptic-curve private keys and related identifiers defined in RFC 5915, RFC 5480, and RFC 3279. | ||
| | Document | Description | | ||
| | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| | [RFC 5915](https://tools.ietf.org/html/rfc5915) | Elliptic Curve Private Key Structure | | ||
| | [RFC 5480](https://tools.ietf.org/html/rfc5480) | Elliptic Curve Cryptography Subject Public Key Information | | ||
| | [RFC 3279](https://datatracker.ietf.org/doc/html/rfc3279#section-2.3.5) | Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate: ECDSA and ECDH Keys | | ||
| Use the exported classes with `@peculiar/asn1-schema` helpers such as `AsnConvert`, `AsnParser`, and `AsnSerializer` to parse or serialize DER-encoded data defined by the referenced specification. | ||
| ## Installation | ||
| ```bash | ||
| npm install @peculiar/asn1-ecc | ||
| ``` | ||
| ## Specifications | ||
| - [RFC 5915: Elliptic Curve Private Key Structure](https://datatracker.ietf.org/doc/html/rfc5915) | ||
| - [RFC 5480: Elliptic Curve Cryptography Subject Public Key Information](https://datatracker.ietf.org/doc/html/rfc5480) | ||
| - [RFC 3279: Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and CRL Profile](https://datatracker.ietf.org/doc/html/rfc3279#section-2.3.5) |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
28223
2.36%25
4.17%743
8.63%23
53.33%0
-100%Updated
Updated