@peculiar/asn1-x509
Advanced tools
Comparing version 2.3.13 to 2.3.15
@@ -13,8 +13,8 @@ "use strict"; | ||
isEqual(data) { | ||
return data instanceof AlgorithmIdentifier | ||
&& data.algorithm == this.algorithm | ||
&& ((data.parameters && this.parameters | ||
&& pvtsutils.isEqual(data.parameters, this.parameters)) | ||
|| | ||
(data.parameters === this.parameters)); | ||
return (data instanceof AlgorithmIdentifier && | ||
data.algorithm == this.algorithm && | ||
((data.parameters && | ||
this.parameters && | ||
pvtsutils.isEqual(data.parameters, this.parameters)) || | ||
data.parameters === this.parameters)); | ||
} | ||
@@ -21,0 +21,0 @@ } |
@@ -25,6 +25,16 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_2.AsnPropTypes.Boolean, context: 1, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_2.AsnPropTypes.Boolean, | ||
context: 1, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsUserCerts", void 0); | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_2.AsnPropTypes.Boolean, context: 2, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_2.AsnPropTypes.Boolean, | ||
context: 2, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsCACerts", void 0); | ||
@@ -35,6 +45,16 @@ tslib_1.__decorate([ | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_2.AsnPropTypes.Boolean, context: 4, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_2.AsnPropTypes.Boolean, | ||
context: 4, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "indirectCRL", void 0); | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_2.AsnPropTypes.Boolean, context: 5, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_2.AsnPropTypes.Boolean, | ||
context: 5, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsAttributeCerts", void 0); |
@@ -35,3 +35,3 @@ "use strict"; | ||
constructor(params = {}) { | ||
this.entrustVers = ''; | ||
this.entrustVers = ""; | ||
this.entrustInfoFlags = new EntrustInfo(); | ||
@@ -38,0 +38,0 @@ Object.assign(this, params); |
@@ -16,3 +16,6 @@ "use strict"; | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_1.AsnPropTypes.Integer, context: 0, implicit: true, optional: true, | ||
type: asn1_schema_1.AsnPropTypes.Integer, | ||
context: 0, | ||
implicit: true, | ||
optional: true, | ||
converter: asn1_schema_1.AsnIntegerArrayBufferConverter, | ||
@@ -23,5 +26,8 @@ }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_1.AsnPropTypes.Integer, context: 1, implicit: true, optional: true, | ||
type: asn1_schema_1.AsnPropTypes.Integer, | ||
context: 1, | ||
implicit: true, | ||
optional: true, | ||
converter: asn1_schema_1.AsnIntegerArrayBufferConverter, | ||
}) | ||
], PolicyConstraints.prototype, "inhibitPolicyMapping", void 0); |
@@ -18,3 +18,3 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true, }) | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true }) | ||
], PrivateKeyUsagePeriod.prototype, "notAfter", void 0); |
@@ -67,3 +67,8 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString, context: 7, implicit: true, converter: exports.AsnIpConverter }) | ||
(0, asn1_schema_1.AsnProp)({ | ||
type: asn1_schema_1.AsnPropTypes.OctetString, | ||
context: 7, | ||
implicit: true, | ||
converter: exports.AsnIpConverter, | ||
}) | ||
], GeneralName.prototype, "iPAddress", void 0); | ||
@@ -70,0 +75,0 @@ tslib_1.__decorate([ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IpConverter = void 0; | ||
const ip = require("ipaddr.js"); | ||
const pvtsutils_1 = require("pvtsutils"); | ||
class IpConverter { | ||
static isIPv4(ip) { | ||
return /^(\d{1,3}\.){3}\d{1,3}$/.test(ip); | ||
} | ||
static parseIPv4(ip) { | ||
const parts = ip.split("."); | ||
if (parts.length !== 4) { | ||
throw new Error("Invalid IPv4 address"); | ||
} | ||
return parts.map((part) => { | ||
const num = parseInt(part, 10); | ||
if (isNaN(num) || num < 0 || num > 255) { | ||
throw new Error("Invalid IPv4 address part"); | ||
} | ||
return num; | ||
}); | ||
} | ||
static parseIPv6(ip) { | ||
const expandedIP = this.expandIPv6(ip); | ||
const parts = expandedIP.split(":"); | ||
if (parts.length !== 8) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
return parts.reduce((bytes, part) => { | ||
const num = parseInt(part, 16); | ||
if (isNaN(num) || num < 0 || num > 0xffff) { | ||
throw new Error("Invalid IPv6 address part"); | ||
} | ||
bytes.push((num >> 8) & 0xff); | ||
bytes.push(num & 0xff); | ||
return bytes; | ||
}, []); | ||
} | ||
static expandIPv6(ip) { | ||
if (!ip.includes("::")) { | ||
return ip; | ||
} | ||
const parts = ip.split("::"); | ||
if (parts.length > 2) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
const left = parts[0] ? parts[0].split(":") : []; | ||
const right = parts[1] ? parts[1].split(":") : []; | ||
const missing = 8 - (left.length + right.length); | ||
if (missing < 0) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
return [...left, ...Array(missing).fill("0"), ...right].join(":"); | ||
} | ||
static formatIPv6(bytes) { | ||
const parts = []; | ||
for (let i = 0; i < 16; i += 2) { | ||
parts.push(((bytes[i] << 8) | bytes[i + 1]).toString(16)); | ||
} | ||
return this.compressIPv6(parts.join(":")); | ||
} | ||
static compressIPv6(ip) { | ||
const parts = ip.split(":"); | ||
let longestZeroStart = -1; | ||
let longestZeroLength = 0; | ||
let currentZeroStart = -1; | ||
let currentZeroLength = 0; | ||
for (let i = 0; i < parts.length; i++) { | ||
if (parts[i] === "0") { | ||
if (currentZeroStart === -1) { | ||
currentZeroStart = i; | ||
} | ||
currentZeroLength++; | ||
} | ||
else { | ||
if (currentZeroLength > longestZeroLength) { | ||
longestZeroStart = currentZeroStart; | ||
longestZeroLength = currentZeroLength; | ||
} | ||
currentZeroStart = -1; | ||
currentZeroLength = 0; | ||
} | ||
} | ||
if (currentZeroLength > longestZeroLength) { | ||
longestZeroStart = currentZeroStart; | ||
longestZeroLength = currentZeroLength; | ||
} | ||
if (longestZeroLength > 1) { | ||
const before = parts.slice(0, longestZeroStart).join(":"); | ||
const after = parts.slice(longestZeroStart + longestZeroLength).join(":"); | ||
return `${before}::${after}`; | ||
} | ||
return ip; | ||
} | ||
static parseCIDR(text) { | ||
const [addr, prefixStr] = text.split("/"); | ||
const prefix = parseInt(prefixStr, 10); | ||
if (this.isIPv4(addr)) { | ||
if (prefix < 0 || prefix > 32) { | ||
throw new Error("Invalid IPv4 prefix length"); | ||
} | ||
return [this.parseIPv4(addr), prefix]; | ||
} | ||
else { | ||
if (prefix < 0 || prefix > 128) { | ||
throw new Error("Invalid IPv6 prefix length"); | ||
} | ||
return [this.parseIPv6(addr), prefix]; | ||
} | ||
} | ||
static decodeIP(value) { | ||
@@ -16,6 +119,5 @@ if (value.length === 64 && parseInt(value, 16) === 0) { | ||
.toString(2) | ||
.split('') | ||
.reduce((a, k) => a + (+k), 0); | ||
let ip = value.slice(0, 8) | ||
.replace(/(.{2})/g, match => `${parseInt(match, 16)}.`); | ||
.split("") | ||
.reduce((a, k) => a + +k, 0); | ||
let ip = value.slice(0, 8).replace(/(.{2})/g, (match) => `${parseInt(match, 16)}.`); | ||
ip = ip.slice(0, -1); | ||
@@ -25,14 +127,53 @@ return `${ip}/${mask}`; | ||
static toString(buf) { | ||
if (buf.byteLength === 4 || buf.byteLength === 16) { | ||
const uint8 = new Uint8Array(buf); | ||
const addr = ip.fromByteArray(Array.from(uint8)); | ||
return addr.toString(); | ||
const uint8 = new Uint8Array(buf); | ||
if (uint8.length === 4) { | ||
return Array.from(uint8).join("."); | ||
} | ||
if (uint8.length === 16) { | ||
return this.formatIPv6(uint8); | ||
} | ||
if (uint8.length === 8 || uint8.length === 32) { | ||
const half = uint8.length / 2; | ||
const addrBytes = uint8.slice(0, half); | ||
const maskBytes = uint8.slice(half); | ||
const isAllZeros = uint8.every((byte) => byte === 0); | ||
if (isAllZeros) { | ||
return uint8.length === 8 ? "0.0.0.0/0" : "::/0"; | ||
} | ||
const prefixLen = maskBytes.reduce((a, b) => a + (b.toString(2).match(/1/g) || []).length, 0); | ||
if (uint8.length === 8) { | ||
const addrStr = Array.from(addrBytes).join("."); | ||
return `${addrStr}/${prefixLen}`; | ||
} | ||
else { | ||
const addrStr = this.formatIPv6(addrBytes); | ||
return `${addrStr}/${prefixLen}`; | ||
} | ||
} | ||
return this.decodeIP(pvtsutils_1.Convert.ToHex(buf)); | ||
} | ||
static fromString(text) { | ||
const addr = ip.parse(text); | ||
return new Uint8Array(addr.toByteArray()).buffer; | ||
if (text.includes("/")) { | ||
const [addr, prefix] = this.parseCIDR(text); | ||
const maskBytes = new Uint8Array(addr.length); | ||
let bitsLeft = prefix; | ||
for (let i = 0; i < maskBytes.length; i++) { | ||
if (bitsLeft >= 8) { | ||
maskBytes[i] = 0xff; | ||
bitsLeft -= 8; | ||
} | ||
else if (bitsLeft > 0) { | ||
maskBytes[i] = 0xff << (8 - bitsLeft); | ||
bitsLeft = 0; | ||
} | ||
} | ||
const out = new Uint8Array(addr.length * 2); | ||
out.set(addr, 0); | ||
out.set(maskBytes, addr.length); | ||
return out.buffer; | ||
} | ||
const bytes = this.isIPv4(text) ? this.parseIPv4(text) : this.parseIPv6(text); | ||
return new Uint8Array(bytes).buffer; | ||
} | ||
} | ||
exports.IpConverter = IpConverter; |
@@ -13,4 +13,8 @@ "use strict"; | ||
toString() { | ||
return this.bmpString || this.printableString || this.teletexString || this.universalString | ||
|| this.utf8String || ""; | ||
return (this.bmpString || | ||
this.printableString || | ||
this.teletexString || | ||
this.universalString || | ||
this.utf8String || | ||
""); | ||
} | ||
@@ -17,0 +21,0 @@ }; |
@@ -10,8 +10,8 @@ import { __decorate } from "tslib"; | ||
isEqual(data) { | ||
return data instanceof AlgorithmIdentifier | ||
&& data.algorithm == this.algorithm | ||
&& ((data.parameters && this.parameters | ||
&& pvtsutils.isEqual(data.parameters, this.parameters)) | ||
|| | ||
(data.parameters === this.parameters)); | ||
return (data instanceof AlgorithmIdentifier && | ||
data.algorithm == this.algorithm && | ||
((data.parameters && | ||
this.parameters && | ||
pvtsutils.isEqual(data.parameters, this.parameters)) || | ||
data.parameters === this.parameters)); | ||
} | ||
@@ -18,0 +18,0 @@ } |
var Extensions_1; | ||
import { __decorate } from "tslib"; | ||
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString } from "@peculiar/asn1-schema"; | ||
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema"; | ||
export class Extension { | ||
@@ -5,0 +5,0 @@ constructor(params = {}) { |
import { __decorate } from "tslib"; | ||
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, OctetString } from "@peculiar/asn1-schema"; | ||
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, OctetString, } from "@peculiar/asn1-schema"; | ||
import { GeneralName } from "../general_name"; | ||
@@ -4,0 +4,0 @@ import { id_ce } from "../object_identifiers"; |
@@ -21,6 +21,16 @@ import { __decorate } from "tslib"; | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.Boolean, context: 1, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
AsnProp({ | ||
type: AsnPropTypes.Boolean, | ||
context: 1, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsUserCerts", void 0); | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.Boolean, context: 2, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
AsnProp({ | ||
type: AsnPropTypes.Boolean, | ||
context: 2, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsCACerts", void 0); | ||
@@ -31,6 +41,16 @@ __decorate([ | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.Boolean, context: 4, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
AsnProp({ | ||
type: AsnPropTypes.Boolean, | ||
context: 4, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "indirectCRL", void 0); | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.Boolean, context: 5, defaultValue: IssuingDistributionPoint.ONLY, implicit: true }) | ||
AsnProp({ | ||
type: AsnPropTypes.Boolean, | ||
context: 5, | ||
defaultValue: IssuingDistributionPoint.ONLY, | ||
implicit: true, | ||
}) | ||
], IssuingDistributionPoint.prototype, "onlyContainsAttributeCerts", void 0); |
@@ -31,3 +31,3 @@ import { __decorate } from "tslib"; | ||
constructor(params = {}) { | ||
this.entrustVers = ''; | ||
this.entrustVers = ""; | ||
this.entrustInfoFlags = new EntrustInfo(); | ||
@@ -34,0 +34,0 @@ Object.assign(this, params); |
import { __decorate } from "tslib"; | ||
import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema"; | ||
import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnIntegerArrayBufferConverter, } from "@peculiar/asn1-schema"; | ||
import { id_ce } from "../object_identifiers"; | ||
@@ -4,0 +4,0 @@ export const id_ce_inhibitAnyPolicy = `${id_ce}.54`; |
@@ -12,3 +12,6 @@ import { __decorate } from "tslib"; | ||
AsnProp({ | ||
type: AsnPropTypes.Integer, context: 0, implicit: true, optional: true, | ||
type: AsnPropTypes.Integer, | ||
context: 0, | ||
implicit: true, | ||
optional: true, | ||
converter: AsnIntegerArrayBufferConverter, | ||
@@ -19,5 +22,8 @@ }) | ||
AsnProp({ | ||
type: AsnPropTypes.Integer, context: 1, implicit: true, optional: true, | ||
type: AsnPropTypes.Integer, | ||
context: 1, | ||
implicit: true, | ||
optional: true, | ||
converter: AsnIntegerArrayBufferConverter, | ||
}) | ||
], PolicyConstraints.prototype, "inhibitPolicyMapping", void 0); |
@@ -14,3 +14,3 @@ import { __decorate } from "tslib"; | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true, }) | ||
AsnProp({ type: AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true }) | ||
], PrivateKeyUsagePeriod.prototype, "notAfter", void 0); |
import { __decorate } from "tslib"; | ||
import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnOctetStringConverter } from "@peculiar/asn1-schema"; | ||
import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnOctetStringConverter, } from "@peculiar/asn1-schema"; | ||
import { IpConverter } from "./ip_converter"; | ||
@@ -61,3 +61,8 @@ import { DirectoryString, Name } from "./name"; | ||
__decorate([ | ||
AsnProp({ type: AsnPropTypes.OctetString, context: 7, implicit: true, converter: AsnIpConverter }) | ||
AsnProp({ | ||
type: AsnPropTypes.OctetString, | ||
context: 7, | ||
implicit: true, | ||
converter: AsnIpConverter, | ||
}) | ||
], GeneralName.prototype, "iPAddress", void 0); | ||
@@ -64,0 +69,0 @@ __decorate([ |
@@ -1,4 +0,107 @@ | ||
import * as ip from "ipaddr.js"; | ||
import { Convert } from "pvtsutils"; | ||
export class IpConverter { | ||
static isIPv4(ip) { | ||
return /^(\d{1,3}\.){3}\d{1,3}$/.test(ip); | ||
} | ||
static parseIPv4(ip) { | ||
const parts = ip.split("."); | ||
if (parts.length !== 4) { | ||
throw new Error("Invalid IPv4 address"); | ||
} | ||
return parts.map((part) => { | ||
const num = parseInt(part, 10); | ||
if (isNaN(num) || num < 0 || num > 255) { | ||
throw new Error("Invalid IPv4 address part"); | ||
} | ||
return num; | ||
}); | ||
} | ||
static parseIPv6(ip) { | ||
const expandedIP = this.expandIPv6(ip); | ||
const parts = expandedIP.split(":"); | ||
if (parts.length !== 8) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
return parts.reduce((bytes, part) => { | ||
const num = parseInt(part, 16); | ||
if (isNaN(num) || num < 0 || num > 0xffff) { | ||
throw new Error("Invalid IPv6 address part"); | ||
} | ||
bytes.push((num >> 8) & 0xff); | ||
bytes.push(num & 0xff); | ||
return bytes; | ||
}, []); | ||
} | ||
static expandIPv6(ip) { | ||
if (!ip.includes("::")) { | ||
return ip; | ||
} | ||
const parts = ip.split("::"); | ||
if (parts.length > 2) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
const left = parts[0] ? parts[0].split(":") : []; | ||
const right = parts[1] ? parts[1].split(":") : []; | ||
const missing = 8 - (left.length + right.length); | ||
if (missing < 0) { | ||
throw new Error("Invalid IPv6 address"); | ||
} | ||
return [...left, ...Array(missing).fill("0"), ...right].join(":"); | ||
} | ||
static formatIPv6(bytes) { | ||
const parts = []; | ||
for (let i = 0; i < 16; i += 2) { | ||
parts.push(((bytes[i] << 8) | bytes[i + 1]).toString(16)); | ||
} | ||
return this.compressIPv6(parts.join(":")); | ||
} | ||
static compressIPv6(ip) { | ||
const parts = ip.split(":"); | ||
let longestZeroStart = -1; | ||
let longestZeroLength = 0; | ||
let currentZeroStart = -1; | ||
let currentZeroLength = 0; | ||
for (let i = 0; i < parts.length; i++) { | ||
if (parts[i] === "0") { | ||
if (currentZeroStart === -1) { | ||
currentZeroStart = i; | ||
} | ||
currentZeroLength++; | ||
} | ||
else { | ||
if (currentZeroLength > longestZeroLength) { | ||
longestZeroStart = currentZeroStart; | ||
longestZeroLength = currentZeroLength; | ||
} | ||
currentZeroStart = -1; | ||
currentZeroLength = 0; | ||
} | ||
} | ||
if (currentZeroLength > longestZeroLength) { | ||
longestZeroStart = currentZeroStart; | ||
longestZeroLength = currentZeroLength; | ||
} | ||
if (longestZeroLength > 1) { | ||
const before = parts.slice(0, longestZeroStart).join(":"); | ||
const after = parts.slice(longestZeroStart + longestZeroLength).join(":"); | ||
return `${before}::${after}`; | ||
} | ||
return ip; | ||
} | ||
static parseCIDR(text) { | ||
const [addr, prefixStr] = text.split("/"); | ||
const prefix = parseInt(prefixStr, 10); | ||
if (this.isIPv4(addr)) { | ||
if (prefix < 0 || prefix > 32) { | ||
throw new Error("Invalid IPv4 prefix length"); | ||
} | ||
return [this.parseIPv4(addr), prefix]; | ||
} | ||
else { | ||
if (prefix < 0 || prefix > 128) { | ||
throw new Error("Invalid IPv6 prefix length"); | ||
} | ||
return [this.parseIPv6(addr), prefix]; | ||
} | ||
} | ||
static decodeIP(value) { | ||
@@ -13,6 +116,5 @@ if (value.length === 64 && parseInt(value, 16) === 0) { | ||
.toString(2) | ||
.split('') | ||
.reduce((a, k) => a + (+k), 0); | ||
let ip = value.slice(0, 8) | ||
.replace(/(.{2})/g, match => `${parseInt(match, 16)}.`); | ||
.split("") | ||
.reduce((a, k) => a + +k, 0); | ||
let ip = value.slice(0, 8).replace(/(.{2})/g, (match) => `${parseInt(match, 16)}.`); | ||
ip = ip.slice(0, -1); | ||
@@ -22,13 +124,52 @@ return `${ip}/${mask}`; | ||
static toString(buf) { | ||
if (buf.byteLength === 4 || buf.byteLength === 16) { | ||
const uint8 = new Uint8Array(buf); | ||
const addr = ip.fromByteArray(Array.from(uint8)); | ||
return addr.toString(); | ||
const uint8 = new Uint8Array(buf); | ||
if (uint8.length === 4) { | ||
return Array.from(uint8).join("."); | ||
} | ||
if (uint8.length === 16) { | ||
return this.formatIPv6(uint8); | ||
} | ||
if (uint8.length === 8 || uint8.length === 32) { | ||
const half = uint8.length / 2; | ||
const addrBytes = uint8.slice(0, half); | ||
const maskBytes = uint8.slice(half); | ||
const isAllZeros = uint8.every((byte) => byte === 0); | ||
if (isAllZeros) { | ||
return uint8.length === 8 ? "0.0.0.0/0" : "::/0"; | ||
} | ||
const prefixLen = maskBytes.reduce((a, b) => a + (b.toString(2).match(/1/g) || []).length, 0); | ||
if (uint8.length === 8) { | ||
const addrStr = Array.from(addrBytes).join("."); | ||
return `${addrStr}/${prefixLen}`; | ||
} | ||
else { | ||
const addrStr = this.formatIPv6(addrBytes); | ||
return `${addrStr}/${prefixLen}`; | ||
} | ||
} | ||
return this.decodeIP(Convert.ToHex(buf)); | ||
} | ||
static fromString(text) { | ||
const addr = ip.parse(text); | ||
return new Uint8Array(addr.toByteArray()).buffer; | ||
if (text.includes("/")) { | ||
const [addr, prefix] = this.parseCIDR(text); | ||
const maskBytes = new Uint8Array(addr.length); | ||
let bitsLeft = prefix; | ||
for (let i = 0; i < maskBytes.length; i++) { | ||
if (bitsLeft >= 8) { | ||
maskBytes[i] = 0xff; | ||
bitsLeft -= 8; | ||
} | ||
else if (bitsLeft > 0) { | ||
maskBytes[i] = 0xff << (8 - bitsLeft); | ||
bitsLeft = 0; | ||
} | ||
} | ||
const out = new Uint8Array(addr.length * 2); | ||
out.set(addr, 0); | ||
out.set(maskBytes, addr.length); | ||
return out.buffer; | ||
} | ||
const bytes = this.isIPv4(text) ? this.parseIPv4(text) : this.parseIPv6(text); | ||
return new Uint8Array(bytes).buffer; | ||
} | ||
} |
@@ -10,4 +10,8 @@ var RelativeDistinguishedName_1, RDNSequence_1, Name_1; | ||
toString() { | ||
return this.bmpString || this.printableString || this.teletexString || this.universalString | ||
|| this.utf8String || ""; | ||
return (this.bmpString || | ||
this.printableString || | ||
this.teletexString || | ||
this.universalString || | ||
this.utf8String || | ||
""); | ||
} | ||
@@ -14,0 +18,0 @@ }; |
export type ParametersType = ArrayBuffer | null; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AlgorithmIdentifier ::= SEQUENCE { | ||
@@ -5,0 +5,0 @@ * algorithm OBJECT IDENTIFIER, |
/** | ||
* ``` | ||
* ```asn1 | ||
* Attribute ::= SEQUENCE { | ||
@@ -4,0 +4,0 @@ * type AttributeType, |
import { AlgorithmIdentifier } from "./algorithm_identifier"; | ||
import { TBSCertList } from "./tbs_cert_list"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CertificateList ::= SEQUENCE { | ||
@@ -6,0 +6,0 @@ * tbsCertList TBSCertList, |
import { AlgorithmIdentifier } from "./algorithm_identifier"; | ||
import { TBSCertificate } from "./tbs_certificate"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Certificate ::= SEQUENCE { | ||
@@ -6,0 +6,0 @@ * tbsCertificate TBSCertificate, |
import { AsnArray, OctetString } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Extension ::= SEQUENCE { | ||
@@ -22,3 +22,3 @@ * extnID OBJECT IDENTIFIER, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension | ||
@@ -25,0 +25,0 @@ * ``` |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
import { GeneralName } from "../general_name"; | ||
/*** | ||
* ``` | ||
* ```asn1 | ||
* id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AccessDescription ::= SEQUENCE { | ||
@@ -23,3 +23,3 @@ * accessMethod OBJECT IDENTIFIER, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AuthorityInfoAccessSyntax ::= | ||
@@ -26,0 +26,0 @@ * SEQUENCE SIZE (1..MAX) OF AccessDescription |
@@ -5,3 +5,3 @@ import { OctetString } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 } | ||
@@ -12,3 +12,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* KeyIdentifier ::= OCTET STRING | ||
@@ -20,3 +20,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AuthorityKeyIdentifier ::= SEQUENCE { | ||
@@ -23,0 +23,0 @@ * keyIdentifier [0] KeyIdentifier OPTIONAL, |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* BasicConstraints ::= SEQUENCE { | ||
@@ -11,0 +11,0 @@ * cA BOOLEAN DEFAULT FALSE, |
import { GeneralNames } from "../general_names"; | ||
import { GeneralName } from '../general_name'; | ||
import { GeneralName } from "../general_name"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-certificateIssuer OBJECT IDENTIFIER ::= { id-ce 29 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CertificateIssuer ::= GeneralNames | ||
@@ -13,0 +13,0 @@ * ``` |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-certificatePolicies OBJECT IDENTIFIER ::= { id-ce 32 } | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* anyPolicy OBJECT IDENTIFIER ::= { id-ce-certificatePolicies 0 } | ||
@@ -16,3 +16,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* DisplayText ::= CHOICE { | ||
@@ -34,3 +34,3 @@ * ia5String IA5String (SIZE (1..200)), | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* NoticeReference ::= SEQUENCE { | ||
@@ -47,3 +47,3 @@ * organization DisplayText, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* UserNotice ::= SEQUENCE { | ||
@@ -60,3 +60,3 @@ * noticeRef NoticeReference OPTIONAL, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CPSuri ::= IA5String | ||
@@ -67,3 +67,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Qualifier ::= CHOICE { | ||
@@ -80,3 +80,3 @@ * cPSuri CPSuri, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyQualifierId ::= OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice ) | ||
@@ -87,3 +87,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyQualifierInfo ::= SEQUENCE { | ||
@@ -100,3 +100,3 @@ * policyQualifierId PolicyQualifierId, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CertPolicyId ::= OBJECT IDENTIFIER | ||
@@ -107,3 +107,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyInformation ::= SEQUENCE { | ||
@@ -121,3 +121,3 @@ * policyIdentifier CertPolicyId, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation | ||
@@ -124,0 +124,0 @@ * ``` |
import { CRLNumber } from "./crl_number"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-deltaCRLIndicator OBJECT IDENTIFIER ::= { id-ce 27 } | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* BaseCRLNumber ::= CRLNumber | ||
@@ -12,0 +12,0 @@ * ``` |
@@ -5,3 +5,3 @@ import { AsnArray, BitString } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-cRLDistributionPoints OBJECT IDENTIFIER ::= { id-ce 31 } | ||
@@ -24,3 +24,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* ReasonFlags ::= BIT STRING { | ||
@@ -43,3 +43,3 @@ * unused (0), | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* DistributionPointName ::= CHOICE { | ||
@@ -56,3 +56,3 @@ * fullName [0] GeneralNames, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* DistributionPoint ::= SEQUENCE { | ||
@@ -71,3 +71,3 @@ * distributionPoint [0] DistributionPointName OPTIONAL, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint | ||
@@ -74,0 +74,0 @@ * ``` |
import { CRLDistributionPoints, DistributionPoint } from "./crl_distribution_points"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-freshestCRL OBJECT IDENTIFIER ::= { id-ce 46 } | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* FreshestCRL ::= CRLDistributionPoints | ||
@@ -12,0 +12,0 @@ * ``` |
import { DistributionPointName, Reason } from "./crl_distribution_points"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-issuingDistributionPoint OBJECT IDENTIFIER ::= { id-ce 28 } | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* IssuingDistributionPoint ::= SEQUENCE { | ||
@@ -12,0 +12,0 @@ * distributionPoint [0] DistributionPointName OPTIONAL, |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-cRLNumber OBJECT IDENTIFIER ::= { id-ce 20 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CRLNumber ::= INTEGER (0..MAX) | ||
@@ -11,0 +11,0 @@ * ``` |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-cRLReasons OBJECT IDENTIFIER ::= { id-ce 21 } | ||
@@ -20,3 +20,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CRLReason ::= ENUMERATED { | ||
@@ -23,0 +23,0 @@ * unspecified (0), |
import { BitString } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-entrust-entrustVersInfo OBJECT IDENTIFIER ::= {iso(1) | ||
@@ -17,3 +17,3 @@ * member-body(2) us(840) nortelnetworks(113533) entrust(7) | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* EntrustInfoFlags ::= BIT STRING { | ||
@@ -30,3 +30,3 @@ * keyUpdateAllowed (0), | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* EntrustVersionInfo ::= SEQUENCE { | ||
@@ -33,0 +33,0 @@ * entrustVers GeneralString, |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 } | ||
@@ -8,5 +8,10 @@ * ``` | ||
export declare const id_ce_extKeyUsage = "2.5.29.37"; | ||
/** | ||
* ```asn1 | ||
* KeyPurposeId ::= OBJECT IDENTIFIER | ||
* ``` | ||
*/ | ||
export type KeyPurposeId = string; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId | ||
@@ -19,3 +24,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 } | ||
@@ -26,3 +31,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } | ||
@@ -36,3 +41,3 @@ * -- TLS WWW server authentication | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } | ||
@@ -46,3 +51,3 @@ * -- TLS WWW client authentication | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } | ||
@@ -55,3 +60,3 @@ * -- Signing of downloadable executable code | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } | ||
@@ -65,3 +70,3 @@ * -- Email protection | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } | ||
@@ -75,3 +80,3 @@ * -- Binding the hash of an object to a time | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } | ||
@@ -78,0 +83,0 @@ * -- Signing OCSP responses |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-inhibitAnyPolicy OBJECT IDENTIFIER ::= { id-ce 54 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* InhibitAnyPolicy ::= SkipCerts | ||
@@ -11,0 +11,0 @@ * ``` |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-invalidityDate OBJECT IDENTIFIER ::= { id-ce 24 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* InvalidityDate ::= GeneralizedTime | ||
@@ -11,0 +11,0 @@ * ``` |
import { GeneralNames } from "../general_names"; | ||
import { GeneralName } from '../general_name'; | ||
import { GeneralName } from "../general_name"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-issuerAltName OBJECT IDENTIFIER ::= { id-ce 18 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* IssuerAltName ::= GeneralNames | ||
@@ -13,0 +13,0 @@ * ``` |
import { BitString } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } | ||
@@ -21,3 +21,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* KeyUsage ::= BIT STRING { | ||
@@ -24,0 +24,0 @@ * digitalSignature (0), |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
import { GeneralName } from "../general_name"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-nameConstraints OBJECT IDENTIFIER ::= { id-ce 30 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* BaseDistance ::= INTEGER (0..MAX) | ||
@@ -17,3 +17,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* GeneralSubtree ::= SEQUENCE { | ||
@@ -32,3 +32,3 @@ * base GeneralName, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree | ||
@@ -41,3 +41,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* NameConstraints ::= SEQUENCE { | ||
@@ -44,0 +44,0 @@ * permittedSubtrees [0] GeneralSubtrees OPTIONAL, |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-policyConstraints OBJECT IDENTIFIER ::= { id-ce 36 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SkipCerts ::= INTEGER (0..MAX) | ||
@@ -15,3 +15,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyConstraints ::= SEQUENCE { | ||
@@ -18,0 +18,0 @@ * requireExplicitPolicy [0] SkipCerts OPTIONAL, |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
import { CertPolicyId } from "./certificate_policies"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-policyMappings OBJECT IDENTIFIER ::= { id-ce 33 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyMapping ::= SEQUENCE { | ||
@@ -23,3 +23,3 @@ * issuerDomainPolicy CertPolicyId, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF PolicyMapping | ||
@@ -26,0 +26,0 @@ * ``` |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-privateKeyUsagePeriod OBJECT IDENTIFIER ::= { id-ce 16 } | ||
@@ -8,3 +8,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* PrivateKeyUsagePeriod ::= SEQUENCE { | ||
@@ -11,0 +11,0 @@ * notBefore [0] GeneralizedTime OPTIONAL, |
import { GeneralNames } from "../general_names"; | ||
import { GeneralName } from '../general_name'; | ||
import { GeneralName } from "../general_name"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-subjectAltName OBJECT IDENTIFIER ::= { id-ce 17 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SubjectAltName ::= GeneralNames | ||
@@ -13,0 +13,0 @@ * ``` |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
import { Attribute } from "../attribute"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-subjectDirectoryAttributes OBJECT IDENTIFIER ::= { id-ce 9 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute | ||
@@ -13,0 +13,0 @@ * ``` |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
import { AccessDescription } from "./authority_information_access"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-pe-subjectInfoAccess OBJECT IDENTIFIER ::= { id-pe 11 } | ||
@@ -10,3 +10,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SubjectInfoAccessSyntax ::= | ||
@@ -13,0 +13,0 @@ * SEQUENCE SIZE (1..MAX) OF AccessDescription |
import { KeyIdentifier } from "./authority_key_identifier"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce-subjectKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 14 } | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SubjectKeyIdentifier ::= KeyIdentifier | ||
@@ -12,0 +12,0 @@ * ``` |
@@ -5,3 +5,3 @@ import { IAsnConverter } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* OtherName ::= SEQUENCE { | ||
@@ -18,3 +18,3 @@ * type-id OBJECT IDENTIFIER, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* EDIPartyName ::= SEQUENCE { | ||
@@ -31,3 +31,3 @@ * nameAssigner [0] DirectoryString OPTIONAL, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* GeneralName ::= CHOICE { | ||
@@ -34,0 +34,0 @@ * otherName [0] OtherName, |
import { GeneralName } from "./general_name"; | ||
import { AsnArray } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName | ||
@@ -6,0 +6,0 @@ * ``` |
export declare class IpConverter { | ||
private static isIPv4; | ||
private static parseIPv4; | ||
private static parseIPv6; | ||
private static expandIPv6; | ||
private static formatIPv6; | ||
private static compressIPv6; | ||
private static parseCIDR; | ||
private static decodeIP; | ||
@@ -3,0 +10,0 @@ static toString(buf: ArrayBuffer): string; |
import { AsnArray } from "@peculiar/asn1-schema"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AttributeType ::= OBJECT IDENTIFIER | ||
@@ -9,3 +9,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* DirectoryString ::= CHOICE { | ||
@@ -32,3 +32,3 @@ * teletexString TeletexString (SIZE (1..MAX)), | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AttributeValue ::= ANY -- DEFINED BY AttributeType | ||
@@ -45,3 +45,3 @@ * in general it will be a DirectoryString | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* AttributeTypeAndValue ::= SEQUENCE { | ||
@@ -58,3 +58,3 @@ * type AttributeType, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue | ||
@@ -67,3 +67,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* RDNSequence ::= SEQUENCE OF RelativeDistinguishedName | ||
@@ -76,3 +76,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Name ::= CHOICE { -- only one possibility for now -- | ||
@@ -79,0 +79,0 @@ * rdnSequence RDNSequence } |
/** | ||
* ``` | ||
* ```asn1 | ||
* id-pkix OBJECT IDENTIFIER ::= | ||
@@ -10,3 +10,3 @@ * { iso(1) identified-organization(3) dod(6) internet(1) | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-pe OBJECT IDENTIFIER ::= { id-pkix 1 } | ||
@@ -18,3 +18,3 @@ * -- arc for private certificate extensions | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-qt OBJECT IDENTIFIER ::= { id-pkix 2 } | ||
@@ -26,3 +26,3 @@ * -- arc for policy qualifier types | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } | ||
@@ -34,3 +34,3 @@ * -- arc for extended key purpose OIDS | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ad OBJECT IDENTIFIER ::= { id-pkix 48 } | ||
@@ -42,3 +42,3 @@ * -- arc for access descriptors | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-qt-cps OBJECT IDENTIFIER ::= { id-qt 1 } | ||
@@ -50,3 +50,3 @@ * -- OID for CPS qualifier | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 } | ||
@@ -58,3 +58,3 @@ * -- OID for user notice qualifier | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 } | ||
@@ -65,3 +65,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 } | ||
@@ -72,3 +72,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ad-timeStamping OBJECT IDENTIFIER ::= { id-ad 3 } | ||
@@ -79,3 +79,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ad-caRepository OBJECT IDENTIFIER ::= { id-ad 5 } | ||
@@ -86,3 +86,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* id-ce OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 29} | ||
@@ -89,0 +89,0 @@ * ``` |
import { AlgorithmIdentifier } from "./algorithm_identifier"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* SubjectPublicKeyInfo ::= SEQUENCE { | ||
@@ -5,0 +5,0 @@ * algorithm AlgorithmIdentifier, |
@@ -8,3 +8,3 @@ import { AlgorithmIdentifier } from "./algorithm_identifier"; | ||
* Revoked certificate | ||
* ``` | ||
* ```asn1 | ||
* SEQUENCE { | ||
@@ -31,3 +31,3 @@ * userCertificate CertificateSerialNumber, | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* TBSCertList ::= SEQUENCE { | ||
@@ -34,0 +34,0 @@ * version Version OPTIONAL, |
@@ -8,3 +8,3 @@ import { AlgorithmIdentifier } from "./algorithm_identifier"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* TBSCertificate ::= SEQUENCE { | ||
@@ -11,0 +11,0 @@ * version [0] Version DEFAULT v1, |
/** | ||
* ``` | ||
* ```asn1 | ||
* Time ::= CHOICE { | ||
@@ -4,0 +4,0 @@ * utcTime UTCTime, |
/** | ||
* ``` | ||
* ```asn1 | ||
* Version ::= INTEGER { v1(0), v2(1), v3(2) } | ||
@@ -12,3 +12,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* CertificateSerialNumber ::= INTEGER | ||
@@ -19,3 +19,3 @@ * ``` | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* UniqueIdentifier ::= BIT STRING | ||
@@ -22,0 +22,0 @@ * ``` |
@@ -7,3 +7,3 @@ import { Time } from "./time"; | ||
/** | ||
* ``` | ||
* ```asn1 | ||
* Validity ::= SEQUENCE { | ||
@@ -10,0 +10,0 @@ * notBefore Time, |
{ | ||
"name": "@peculiar/asn1-x509", | ||
"version": "2.3.13", | ||
"version": "2.3.15", | ||
"description": "ASN.1 schema of `Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile` (RFC5280)", | ||
@@ -40,9 +40,8 @@ "files": [ | ||
"dependencies": { | ||
"@peculiar/asn1-schema": "^2.3.13", | ||
"@peculiar/asn1-schema": "^2.3.15", | ||
"asn1js": "^3.0.5", | ||
"ipaddr.js": "^2.1.0", | ||
"pvtsutils": "^1.3.5", | ||
"tslib": "^2.6.2" | ||
"pvtsutils": "^1.3.6", | ||
"tslib": "^2.8.1" | ||
}, | ||
"gitHead": "c0a11836bb6ffcc71607099c8de936b6ab86d164" | ||
"gitHead": "b6c7130efa9bc3ee5e2ea1da5d01aede5182921f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166175
4
4434
- Removedipaddr.js@^2.1.0
- Removedipaddr.js@2.2.0(transitive)
Updatedpvtsutils@^1.3.6
Updatedtslib@^2.8.1