node-opcua-crypto
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -0,0 +0,0 @@ module.exports = { |
@@ -32,2 +32,6 @@ /** | ||
timeStamping: boolean; | ||
ocspSigning: boolean; | ||
ipsecEndSystem: boolean; | ||
ipsecTunnel: boolean; | ||
ipsecUser: boolean; | ||
} | ||
@@ -42,5 +46,3 @@ export interface SubjectPublicKey { | ||
}; | ||
value: string | AuthorithyKeyIdentifier | BasicConstraints | { | ||
[key: string]: string[]; | ||
} | KeyUsage; | ||
value: any; | ||
}; | ||
@@ -68,3 +70,3 @@ export interface SubjectPublicKeyInfo { | ||
keyUsage?: KeyUsage; | ||
extKeyUsage?: KeyUsage; | ||
extKeyUsage?: ExtKeyUsage; | ||
subjectAltName?: any; | ||
@@ -71,0 +73,0 @@ } |
@@ -278,15 +278,57 @@ "use strict"; | ||
function readExtKeyUsage(oid, buffer) { | ||
return "readExtKeyUsage " + oid + " " + buffer.toString("hex"); | ||
/* // handle extKeyUsage | ||
// value is a SEQUENCE of OIDs | ||
var ev = asn1.fromDer(e.value); | ||
for (var vi = 0; vi < ev.value.length; ++vi) { | ||
var oid = asn1.derToOid(ev.value[vi].value); | ||
if (oid in oids) { | ||
e[oids[oid]] = true; | ||
} else { | ||
e[oid] = true; | ||
} | ||
} | ||
*/ | ||
assert(oid === "2.5.29.37"); | ||
// see https://tools.ietf.org/html/rfc5280#section-4.2.1.12 | ||
const block_info = asn1_1.readTag(buffer, 0); | ||
const inner_blocks = asn1_1._readStruct(buffer, block_info); | ||
const extKeyUsage = { | ||
serverAuth: false, | ||
clientAuth: false, | ||
codeSigning: false, | ||
emailProtection: false, | ||
timeStamping: false, | ||
ipsecEndSystem: false, | ||
ipsecTunnel: false, | ||
ipsecUser: false, | ||
ocspSigning: false, | ||
}; | ||
for (const block of inner_blocks) { | ||
const identifier = asn1_1._readObjectIdentifier(buffer, block); | ||
extKeyUsage[identifier.name] = true; | ||
} | ||
/* | ||
id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } | ||
id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } | ||
-- TLS WWW server authentication | ||
-- Key usage bits that may be consistent: digitalSignature, | ||
-- keyEncipherment or keyAgreement | ||
id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } | ||
-- TLS WWW client authentication | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or keyAgreement | ||
id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } | ||
-- Signing of downloadable executable code | ||
-- Key usage bits that may be consistent: digitalSignature | ||
id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } | ||
-- Email protection | ||
-- Key usage bits that may be consistent: digitalSignature, | ||
-- nonRepudiation, and/or (keyEncipherment or keyAgreement) | ||
id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } | ||
-- Binding the hash of an object to a time | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or nonRepudiation | ||
id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } | ||
-- Signing OCSP responses | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or nonRepudiation | ||
*/ | ||
// set flags | ||
return extKeyUsage; | ||
} | ||
@@ -297,3 +339,3 @@ function _readSubjectPublicKey(buffer) { | ||
return { | ||
modulus: buffer.slice(blocks[0].position + 1, blocks[0].position + blocks[0].length) | ||
modulus: buffer.slice(blocks[0].position + 1, blocks[0].position + blocks[0].length), | ||
}; | ||
@@ -300,0 +342,0 @@ } |
export * from "./dist/source"; | ||
export * from "./dist/source_nodejs"; |
{ | ||
"name": "node-opcua-crypto", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Crypto tools for Node-OPCUA", | ||
@@ -32,9 +32,9 @@ "main": "./index.js", | ||
"@types/mocha": "^8.2.0", | ||
"@types/node": "^14.14.16", | ||
"@types/node": "^14.14.22", | ||
"@types/should": "^13.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.11.1", | ||
"@typescript-eslint/parser": "^4.11.1", | ||
"eslint": "^7.16.0", | ||
"eslint-config-prettier": "^7.1.0", | ||
"eslint-plugin-prettier": "^3.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.14.0", | ||
"@typescript-eslint/parser": "^4.14.0", | ||
"eslint": "^7.18.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"lorem-ipsum": "^2.0.3", | ||
@@ -55,3 +55,3 @@ "mocha": "^8.2.1", | ||
"hexy": "^0.3.1", | ||
"jsrsasign": "^10.1.4", | ||
"jsrsasign": "^10.1.5", | ||
"sshpk": "^1.16.1" | ||
@@ -58,0 +58,0 @@ }, |
@@ -0,0 +0,0 @@ import * as fs from "fs"; |
@@ -0,0 +0,0 @@ import * as assert from "assert"; |
@@ -0,0 +0,0 @@ import * as assert from "assert"; |
@@ -0,0 +0,0 @@ // |
@@ -0,0 +0,0 @@ export type Nonce = Buffer; |
@@ -203,3 +203,3 @@ /** | ||
? formatBuffer2DigitHexWithColum(_getBlock(buffer, authorityCertSerialNumber_block!)) | ||
: null, // can be null for self-signed certf | ||
: null, // can be null for self-signed cert | ||
keyIdentifier: keyIdentifier_block ? formatBuffer2DigitHexWithColum(_getBlock(buffer, keyIdentifier_block!)) : null, // can be null for self-signed certf | ||
@@ -324,2 +324,6 @@ }; | ||
timeStamping: boolean; | ||
ocspSigning: boolean; | ||
ipsecEndSystem: boolean; | ||
ipsecTunnel: boolean; | ||
ipsecUser: boolean; | ||
// etc ... to be completed | ||
@@ -365,24 +369,66 @@ } | ||
function readExtKeyUsage(oid: string, buffer: Buffer): string { | ||
return "readExtKeyUsage " + oid + " " + buffer.toString("hex"); | ||
/* // handle extKeyUsage | ||
// value is a SEQUENCE of OIDs | ||
var ev = asn1.fromDer(e.value); | ||
for (var vi = 0; vi < ev.value.length; ++vi) { | ||
var oid = asn1.derToOid(ev.value[vi].value); | ||
if (oid in oids) { | ||
e[oids[oid]] = true; | ||
} else { | ||
e[oid] = true; | ||
} | ||
} | ||
*/ | ||
function readExtKeyUsage(oid: string, buffer: Buffer): ExtKeyUsage { | ||
assert(oid === "2.5.29.37"); | ||
// see https://tools.ietf.org/html/rfc5280#section-4.2.1.12 | ||
const block_info = readTag(buffer, 0); | ||
const inner_blocks = _readStruct(buffer, block_info); | ||
const extKeyUsage: ExtKeyUsage = { | ||
serverAuth: false, | ||
clientAuth: false, | ||
codeSigning: false, | ||
emailProtection: false, | ||
timeStamping: false, | ||
ipsecEndSystem: false, | ||
ipsecTunnel: false, | ||
ipsecUser: false, | ||
ocspSigning: false, | ||
}; | ||
for (const block of inner_blocks) { | ||
const identifier = _readObjectIdentifier(buffer, block); | ||
(extKeyUsage as any)[identifier.name] = true; | ||
} | ||
/* | ||
id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } | ||
id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } | ||
-- TLS WWW server authentication | ||
-- Key usage bits that may be consistent: digitalSignature, | ||
-- keyEncipherment or keyAgreement | ||
id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } | ||
-- TLS WWW client authentication | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or keyAgreement | ||
id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } | ||
-- Signing of downloadable executable code | ||
-- Key usage bits that may be consistent: digitalSignature | ||
id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } | ||
-- Email protection | ||
-- Key usage bits that may be consistent: digitalSignature, | ||
-- nonRepudiation, and/or (keyEncipherment or keyAgreement) | ||
id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } | ||
-- Binding the hash of an object to a time | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or nonRepudiation | ||
id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } | ||
-- Signing OCSP responses | ||
-- Key usage bits that may be consistent: digitalSignature | ||
-- and/or nonRepudiation | ||
*/ | ||
// set flags | ||
return extKeyUsage; | ||
} | ||
export interface SubjectPublicKey { | ||
modulus: Buffer | ||
modulus: Buffer; | ||
} | ||
function _readSubjectPublicKey(buffer: Buffer): SubjectPublicKey{ | ||
function _readSubjectPublicKey(buffer: Buffer): SubjectPublicKey { | ||
const block_info = readTag(buffer, 0); | ||
@@ -392,4 +438,4 @@ const blocks = _readStruct(buffer, block_info); | ||
return { | ||
modulus: buffer.slice(blocks[0].position+1, blocks[0].position+ blocks[0].length) | ||
} | ||
modulus: buffer.slice(blocks[0].position + 1, blocks[0].position + blocks[0].length), | ||
}; | ||
} | ||
@@ -406,3 +452,3 @@ /* | ||
*/ | ||
export function _readExtension(buffer: Buffer, block: BlockInfo) { | ||
export function _readExtension(buffer: Buffer, block: BlockInfo): { identifier: { oid: string; name: string }; value: any } { | ||
const inner_blocks = _readStruct(buffer, block); | ||
@@ -550,3 +596,3 @@ | ||
keyUsage?: KeyUsage; | ||
extKeyUsage?: KeyUsage; | ||
extKeyUsage?: ExtKeyUsage; | ||
subjectAltName?: any; | ||
@@ -553,0 +599,0 @@ } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ // https://github.com/lapo-luchini/asn1js/blob/master/oids.js |
@@ -0,0 +0,0 @@ // tslint:disable: no-console |
@@ -0,0 +0,0 @@ // tslint:disable: no-console |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
319539
5196
Updatedjsrsasign@^10.1.5