first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+8
View File
@@ -0,0 +1,8 @@
# `@peculiar/asn1-csr`
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/csr/LICENSE.md)
[![npm version](https://badge.fury.io/js/%40peculiar%2Fasn1-csr.svg)](https://badge.fury.io/js/%40peculiar%2Fasn1-csr)
[![NPM](https://nodei.co/npm/@peculiar/asn1-csr.png)](https://nodei.co/npm/@peculiar/asn1-csr/)
[RFC 2986](https://tools.ietf.org/html/rfc2986) PKCS #10: Certification Request Syntax Specification Version 1.7
+17
View File
@@ -0,0 +1,17 @@
"use strict";
var Attributes_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Attributes = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
let Attributes = Attributes_1 = class Attributes extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, Attributes_1.prototype);
}
};
exports.Attributes = Attributes;
exports.Attributes = Attributes = Attributes_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence, itemType: asn1_x509_1.Attribute })
], Attributes);
+25
View File
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CertificationRequest = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const certification_request_info_1 = require("./certification_request_info");
const asn1_x509_1 = require("@peculiar/asn1-x509");
class CertificationRequest {
constructor(params = {}) {
this.certificationRequestInfo = new certification_request_info_1.CertificationRequestInfo();
this.signatureAlgorithm = new asn1_x509_1.AlgorithmIdentifier();
this.signature = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.CertificationRequest = CertificationRequest;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: certification_request_info_1.CertificationRequestInfo, raw: true })
], CertificationRequest.prototype, "certificationRequestInfo", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier })
], CertificationRequest.prototype, "signatureAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString })
], CertificationRequest.prototype, "signature", void 0);
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CertificationRequestInfo = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const attributes_1 = require("./attributes");
class CertificationRequestInfo {
constructor(params = {}) {
this.version = 0;
this.subject = new asn1_x509_1.Name();
this.subjectPKInfo = new asn1_x509_1.SubjectPublicKeyInfo();
this.attributes = new attributes_1.Attributes();
Object.assign(this, params);
}
}
exports.CertificationRequestInfo = CertificationRequestInfo;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], CertificationRequestInfo.prototype, "version", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.Name })
], CertificationRequestInfo.prototype, "subject", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.SubjectPublicKeyInfo })
], CertificationRequestInfo.prototype, "subjectPKInfo", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: attributes_1.Attributes, implicit: true, context: 0, optional: true })
], CertificationRequestInfo.prototype, "attributes", void 0);
+6
View File
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./attributes"), exports);
tslib_1.__exportStar(require("./certification_request"), exports);
tslib_1.__exportStar(require("./certification_request_info"), exports);
+14
View File
@@ -0,0 +1,14 @@
var Attributes_1;
import { __decorate } from "tslib";
import { AsnArray, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";
import { Attribute } from "@peculiar/asn1-x509";
let Attributes = Attributes_1 = class Attributes extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, Attributes_1.prototype);
}
};
Attributes = Attributes_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: Attribute })
], Attributes);
export { Attributes };
+21
View File
@@ -0,0 +1,21 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
import { CertificationRequestInfo } from "./certification_request_info";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
export class CertificationRequest {
constructor(params = {}) {
this.certificationRequestInfo = new CertificationRequestInfo();
this.signatureAlgorithm = new AlgorithmIdentifier();
this.signature = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: CertificationRequestInfo, raw: true })
], CertificationRequest.prototype, "certificationRequestInfo", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier })
], CertificationRequest.prototype, "signatureAlgorithm", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.BitString })
], CertificationRequest.prototype, "signature", void 0);
@@ -0,0 +1,25 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
import { Name, SubjectPublicKeyInfo } from "@peculiar/asn1-x509";
import { Attributes } from "./attributes";
export class CertificationRequestInfo {
constructor(params = {}) {
this.version = 0;
this.subject = new Name();
this.subjectPKInfo = new SubjectPublicKeyInfo();
this.attributes = new Attributes();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], CertificationRequestInfo.prototype, "version", void 0);
__decorate([
AsnProp({ type: Name })
], CertificationRequestInfo.prototype, "subject", void 0);
__decorate([
AsnProp({ type: SubjectPublicKeyInfo })
], CertificationRequestInfo.prototype, "subjectPKInfo", void 0);
__decorate([
AsnProp({ type: Attributes, implicit: true, context: 0, optional: true })
], CertificationRequestInfo.prototype, "attributes", void 0);
+3
View File
@@ -0,0 +1,3 @@
export * from "./attributes";
export * from "./certification_request";
export * from "./certification_request_info";
+10
View File
@@ -0,0 +1,10 @@
import { AsnArray } from "@peculiar/asn1-schema";
import { Attribute } from "@peculiar/asn1-x509";
/**
* ```asn1
* Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
* ```
*/
export declare class Attributes extends AsnArray<Attribute> {
constructor(items?: Attribute[]);
}
+18
View File
@@ -0,0 +1,18 @@
import { CertificationRequestInfo } from "./certification_request_info";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
/**
* ```asn1
* CertificationRequest ::= SEQUENCE {
* certificationRequestInfo CertificationRequestInfo,
* signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
* signature BIT STRING
* }
* ```
*/
export declare class CertificationRequest {
certificationRequestInfo: CertificationRequestInfo;
certificationRequestInfoRaw?: ArrayBuffer;
signatureAlgorithm: AlgorithmIdentifier;
signature: ArrayBuffer;
constructor(params?: Partial<CertificationRequest>);
}
@@ -0,0 +1,37 @@
import { Name, SubjectPublicKeyInfo } from "@peculiar/asn1-x509";
import { Attributes } from "./attributes";
/**
* ```asn1
* CertificationRequestInfo ::= SEQUENCE {
* version INTEGER { v1(0) } (v1,...),
* subject Name,
* subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
* attributes [0] Attributes{{ CRIAttributes }}
* }
* ```
*/
export declare class CertificationRequestInfo {
version: number;
subject: Name;
subjectPKInfo: SubjectPublicKeyInfo;
/**
* List of attributes providing additional information about the
* subject of the certification request.
*
* @remarks
* The textual description in RFC 2986 (see https://datatracker.ietf.org/doc/rfc2986/)
* indicates that a certification request contains "optionally a set of attributes".
* The ASN.1 module in appendix A does not include the `OPTIONAL` keyword for this
* component, which is a formal inconsistency. In practice, popular implementations
* (for example OpenSSL) are tolerant and accept both forms:
* - the attributes field present as an empty context-specific element (A0 00),
* - the attributes field completely omitted.
*
* To be compatible with real-world CSR encodings, this property is marked
* `optional: true` in the decorator. Consumers should therefore treat
* `certificationRequestInfo.attributes` as possibly `undefined` and
* handle that case (for example, treat `undefined` as an empty set of attributes).
*/
attributes: Attributes;
constructor(params?: Partial<CertificationRequestInfo>);
}
+3
View File
@@ -0,0 +1,3 @@
export * from "./attributes";
export * from "./certification_request";
export * from "./certification_request_info";
+43
View File
@@ -0,0 +1,43 @@
{
"name": "@peculiar/asn1-csr",
"version": "2.6.1",
"description": "ASN.1 schema of `PKCS #10: Certification Request Syntax Specification Version 1.7` (RFC2986)",
"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/csr#readme",
"keywords": [
"asn"
],
"author": "PeculiarVentures, LLC",
"license": "MIT",
"main": "build/cjs/index.js",
"module": "build/es2015/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "mocha",
"clear": "rimraf build",
"build": "npm run build:module && npm run build:types",
"build:module": "npm run build:cjs && npm run build:es2015",
"build:cjs": "tsc -p tsconfig.compile.json --removeComments --module commonjs --outDir build/cjs",
"build:es2015": "tsc -p tsconfig.compile.json --removeComments --module ES2015 --outDir build/es2015",
"prebuild:types": "rimraf build/types",
"build:types": "tsc -p tsconfig.compile.json --outDir build/types --declaration --emitDeclarationOnly",
"rebuild": "npm run clear && npm run build"
},
"dependencies": {
"@peculiar/asn1-schema": "^2.6.0",
"@peculiar/asn1-x509": "^2.6.1",
"asn1js": "^3.0.6",
"tslib": "^2.8.1"
},
"gitHead": "e533eba96fe14ca21b9a1b3f47cb58aaaa78c0ad"
}