node-opcua-role-set-common 2.176.0 → 2.178.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/x509_subject.d.ts +37 -1
- package/dist/x509_subject.js +18 -3
- package/dist/x509_subject.js.map +1 -1
- package/package.json +7 -7
- package/source/x509_subject.ts +44 -2
package/dist/x509_subject.d.ts
CHANGED
|
@@ -12,10 +12,40 @@
|
|
|
12
12
|
export interface X509SubjectName {
|
|
13
13
|
commonName?: string;
|
|
14
14
|
organizationName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* OU (2.5.4.11), as `node-opcua-crypto` actually reports it.
|
|
17
|
+
*
|
|
18
|
+
* Note the spelling. The OID table resolves this attribute to
|
|
19
|
+
* `organizational`**Unit**`Name`, and the certificate parser keys its result
|
|
20
|
+
* by that resolved name — so this is the property a parsed certificate
|
|
21
|
+
* carries. Verified against a real certificate with `/OU=Plant`:
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* {"commonName":"operator-1","organizationName":"Sterfive",
|
|
25
|
+
* "organizationalUnitName":"Plant","countryName":"FR"}
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
organizationalUnitName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Misspelling of {@link X509SubjectName.organizationalUnitName}.
|
|
31
|
+
*
|
|
32
|
+
* A parsed certificate never carries this property, so reading it always
|
|
33
|
+
* yielded `undefined` and the OU was silently dropped. Still accepted on
|
|
34
|
+
* input for callers that build a subject by hand.
|
|
35
|
+
*/
|
|
15
36
|
organizationUnitName?: string;
|
|
16
37
|
localityName?: string;
|
|
17
38
|
stateOrProvinceName?: string;
|
|
18
39
|
countryName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* These three are produced by the certificate parser — their OIDs resolve to
|
|
42
|
+
* these names — but were absent from this interface, so they never reached
|
|
43
|
+
* the criteria. Part 18 lists all three in Table 10.
|
|
44
|
+
*/
|
|
45
|
+
domainComponent?: string;
|
|
46
|
+
dnQualifier?: string;
|
|
47
|
+
/** The DN's own `serialNumber` attribute (2.5.4.5), not the certificate's. */
|
|
48
|
+
serialNumber?: string;
|
|
19
49
|
}
|
|
20
50
|
/**
|
|
21
51
|
* Order of the X509 subject name attributes (OPC 10000-18 §4.4.3, Table 10).
|
|
@@ -29,7 +59,13 @@ export declare const X509_SUBJECT_ORDER: string[];
|
|
|
29
59
|
export declare function canonicalizeX509Subject(pairs: Array<[string, string]>): string;
|
|
30
60
|
/** Parse a `CN="..."/O="..."` criteria String into ordered name/value pairs. */
|
|
31
61
|
export declare function parseX509SubjectCriteria(criteria: string): Array<[string, string]>;
|
|
32
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Build ordered name/value pairs from a certificate subject.
|
|
64
|
+
*
|
|
65
|
+
* Every attribute the subject carries must appear: Part 18 has no wildcards, so
|
|
66
|
+
* a pair silently left out here does not make matching *looser* — it makes the
|
|
67
|
+
* two sides disagree, and a correctly written rule then matches nobody.
|
|
68
|
+
*/
|
|
33
69
|
export declare function certificateSubjectPairs(subject: X509SubjectName): Array<[string, string]>;
|
|
34
70
|
/**
|
|
35
71
|
* Test whether an `X509Subject` criteria matches a certificate subject.
|
package/dist/x509_subject.js
CHANGED
|
@@ -41,21 +41,36 @@ function parseX509SubjectCriteria(criteria) {
|
|
|
41
41
|
}
|
|
42
42
|
return pairs;
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Build ordered name/value pairs from a certificate subject.
|
|
46
|
+
*
|
|
47
|
+
* Every attribute the subject carries must appear: Part 18 has no wildcards, so
|
|
48
|
+
* a pair silently left out here does not make matching *looser* — it makes the
|
|
49
|
+
* two sides disagree, and a correctly written rule then matches nobody.
|
|
50
|
+
*/
|
|
45
51
|
function certificateSubjectPairs(subject) {
|
|
46
52
|
const pairs = [];
|
|
47
53
|
if (subject.commonName)
|
|
48
54
|
pairs.push(["CN", subject.commonName]);
|
|
49
55
|
if (subject.organizationName)
|
|
50
56
|
pairs.push(["O", subject.organizationName]);
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
// Both spellings: a parsed certificate carries `organizationalUnitName`,
|
|
58
|
+
// while hand-built subjects in existing code may use the older misspelling.
|
|
59
|
+
const organizationalUnit = subject.organizationalUnitName ?? subject.organizationUnitName;
|
|
60
|
+
if (organizationalUnit)
|
|
61
|
+
pairs.push(["OU", organizationalUnit]);
|
|
62
|
+
if (subject.domainComponent)
|
|
63
|
+
pairs.push(["DC", subject.domainComponent]);
|
|
53
64
|
if (subject.localityName)
|
|
54
65
|
pairs.push(["L", subject.localityName]);
|
|
55
66
|
if (subject.stateOrProvinceName)
|
|
56
67
|
pairs.push(["S", subject.stateOrProvinceName]);
|
|
57
68
|
if (subject.countryName)
|
|
58
69
|
pairs.push(["C", subject.countryName]);
|
|
70
|
+
if (subject.dnQualifier)
|
|
71
|
+
pairs.push(["dnQualifier", subject.dnQualifier]);
|
|
72
|
+
if (subject.serialNumber)
|
|
73
|
+
pairs.push(["serialNumber", subject.serialNumber]);
|
|
59
74
|
return pairs;
|
|
60
75
|
}
|
|
61
76
|
/**
|
package/dist/x509_subject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x509_subject.js","sourceRoot":"","sources":["../source/x509_subject.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"x509_subject.js","sourceRoot":"","sources":["../source/x509_subject.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAuDH,0DAUC;AAGD,4DAOC;AASD,0DAeC;AAYD,4CAQC;AA1ED;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAExG,mFAAmF;AACnF,SAAgB,uBAAuB,CAAC,KAA8B;IAClE,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AgB,EAAE,OAAwB;IACvE,MAAM,OAAO,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,OAAO,CACH,uBAAuB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,KAAK,uBAAuB,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAC3H,CAAC;IACN,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-role-set-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.178.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - role-set common types and identity stores (OPC 10000-18)",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"bcryptjs": "3.0.3",
|
|
20
|
-
"node-opcua-basic-types": "2.
|
|
20
|
+
"node-opcua-basic-types": "2.177.0",
|
|
21
21
|
"node-opcua-binary-stream": "2.176.0",
|
|
22
22
|
"node-opcua-constants": "2.176.0",
|
|
23
|
-
"node-opcua-crypto": "5.
|
|
24
|
-
"node-opcua-nodeid": "2.
|
|
23
|
+
"node-opcua-crypto": "5.6.0",
|
|
24
|
+
"node-opcua-nodeid": "2.177.0",
|
|
25
25
|
"node-opcua-status-code": "2.176.0",
|
|
26
|
-
"node-opcua-types": "2.
|
|
27
|
-
"node-opcua-variant": "2.
|
|
26
|
+
"node-opcua-types": "2.177.0",
|
|
27
|
+
"node-opcua-variant": "2.177.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"node-opcua-leak-detector": "2.175.6"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"internet of things"
|
|
45
45
|
],
|
|
46
46
|
"homepage": "http://node-opcua.github.io/",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "d0e850e5f7df80e14ceb6d8e092e793472965301",
|
|
48
48
|
"files": [
|
|
49
49
|
"dist",
|
|
50
50
|
"source"
|
package/source/x509_subject.ts
CHANGED
|
@@ -13,10 +13,40 @@
|
|
|
13
13
|
export interface X509SubjectName {
|
|
14
14
|
commonName?: string;
|
|
15
15
|
organizationName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* OU (2.5.4.11), as `node-opcua-crypto` actually reports it.
|
|
18
|
+
*
|
|
19
|
+
* Note the spelling. The OID table resolves this attribute to
|
|
20
|
+
* `organizational`**Unit**`Name`, and the certificate parser keys its result
|
|
21
|
+
* by that resolved name — so this is the property a parsed certificate
|
|
22
|
+
* carries. Verified against a real certificate with `/OU=Plant`:
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
* {"commonName":"operator-1","organizationName":"Sterfive",
|
|
26
|
+
* "organizationalUnitName":"Plant","countryName":"FR"}
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
organizationalUnitName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Misspelling of {@link X509SubjectName.organizationalUnitName}.
|
|
32
|
+
*
|
|
33
|
+
* A parsed certificate never carries this property, so reading it always
|
|
34
|
+
* yielded `undefined` and the OU was silently dropped. Still accepted on
|
|
35
|
+
* input for callers that build a subject by hand.
|
|
36
|
+
*/
|
|
16
37
|
organizationUnitName?: string;
|
|
17
38
|
localityName?: string;
|
|
18
39
|
stateOrProvinceName?: string;
|
|
19
40
|
countryName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* These three are produced by the certificate parser — their OIDs resolve to
|
|
43
|
+
* these names — but were absent from this interface, so they never reached
|
|
44
|
+
* the criteria. Part 18 lists all three in Table 10.
|
|
45
|
+
*/
|
|
46
|
+
domainComponent?: string;
|
|
47
|
+
dnQualifier?: string;
|
|
48
|
+
/** The DN's own `serialNumber` attribute (2.5.4.5), not the certificate's. */
|
|
49
|
+
serialNumber?: string;
|
|
20
50
|
}
|
|
21
51
|
|
|
22
52
|
/**
|
|
@@ -51,15 +81,27 @@ export function parseX509SubjectCriteria(criteria: string): Array<[string, strin
|
|
|
51
81
|
return pairs;
|
|
52
82
|
}
|
|
53
83
|
|
|
54
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Build ordered name/value pairs from a certificate subject.
|
|
86
|
+
*
|
|
87
|
+
* Every attribute the subject carries must appear: Part 18 has no wildcards, so
|
|
88
|
+
* a pair silently left out here does not make matching *looser* — it makes the
|
|
89
|
+
* two sides disagree, and a correctly written rule then matches nobody.
|
|
90
|
+
*/
|
|
55
91
|
export function certificateSubjectPairs(subject: X509SubjectName): Array<[string, string]> {
|
|
56
92
|
const pairs: Array<[string, string]> = [];
|
|
57
93
|
if (subject.commonName) pairs.push(["CN", subject.commonName]);
|
|
58
94
|
if (subject.organizationName) pairs.push(["O", subject.organizationName]);
|
|
59
|
-
|
|
95
|
+
// Both spellings: a parsed certificate carries `organizationalUnitName`,
|
|
96
|
+
// while hand-built subjects in existing code may use the older misspelling.
|
|
97
|
+
const organizationalUnit = subject.organizationalUnitName ?? subject.organizationUnitName;
|
|
98
|
+
if (organizationalUnit) pairs.push(["OU", organizationalUnit]);
|
|
99
|
+
if (subject.domainComponent) pairs.push(["DC", subject.domainComponent]);
|
|
60
100
|
if (subject.localityName) pairs.push(["L", subject.localityName]);
|
|
61
101
|
if (subject.stateOrProvinceName) pairs.push(["S", subject.stateOrProvinceName]);
|
|
62
102
|
if (subject.countryName) pairs.push(["C", subject.countryName]);
|
|
103
|
+
if (subject.dnQualifier) pairs.push(["dnQualifier", subject.dnQualifier]);
|
|
104
|
+
if (subject.serialNumber) pairs.push(["serialNumber", subject.serialNumber]);
|
|
63
105
|
return pairs;
|
|
64
106
|
}
|
|
65
107
|
|