node-forge 0.9.2 → 1.2.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/CHANGELOG.md +93 -1
- package/README.md +11 -41
- package/dist/forge.all.min.js +1 -1
- package/dist/forge.all.min.js.map +1 -1
- package/dist/forge.min.js +1 -1
- package/dist/forge.min.js.map +1 -1
- package/dist/prime.worker.min.js +1 -1
- package/lib/http.js +16 -34
- package/lib/index.js +0 -2
- package/lib/log.js +10 -5
- package/lib/oids.js +6 -1
- package/lib/pem.js +8 -1
- package/lib/pkcs7.js +6 -3
- package/lib/pkcs7asn1.js +2 -1
- package/lib/prng.js +1 -1
- package/lib/util.js +0 -351
- package/lib/x509.js +128 -219
- package/lib/xhr.js +8 -6
- package/package.json +20 -17
- package/lib/debug.js +0 -78
- package/lib/task.js +0 -725
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,99 @@
|
|
|
1
1
|
Forge ChangeLog
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
|
-
##
|
|
4
|
+
## 1.2.0 - 2022-01-07
|
|
5
|
+
|
|
6
|
+
### Fixed
|
|
7
|
+
- [x509] 'Expected' and 'Actual' issuers were backwards in verification failure
|
|
8
|
+
message.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- [oid,x509]: Added OID `1.3.14.3.2.29 / sha1WithRSASignature` for sha1 with
|
|
12
|
+
RSA. Considered a deprecated equivalent to `1.2.840.113549.1.1.5 /
|
|
13
|
+
sha1WithRSAEncryption`. See [discussion and
|
|
14
|
+
links](https://github.com/digitalbazaar/forge/issues/825).
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- [x509]: Reduce duplicate code. Add helper function to create a signature
|
|
18
|
+
digest given an signature algorithm OID. Add helper function to verify
|
|
19
|
+
signatures.
|
|
20
|
+
|
|
21
|
+
## 1.1.0 - 2022-01-06
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- [x509]: Correctly compute certificate issuer and subject hashes to match
|
|
25
|
+
behavior of openssl.
|
|
26
|
+
- [pem]: Accept certificate requests with "NEW" in the label. "BEGIN NEW
|
|
27
|
+
CERTIFICATE REQUEST" handled as "BEGIN CERTIFICATE REQUEST".
|
|
28
|
+
|
|
29
|
+
## 1.0.0 - 2022-01-04
|
|
30
|
+
|
|
31
|
+
### Notes
|
|
32
|
+
- **1.0.0**!
|
|
33
|
+
- This project is over a decade old! Time for a 1.0.0 release.
|
|
34
|
+
- The URL related changes may expose bugs in some of the networking related
|
|
35
|
+
code (unrelated to the much wider used cryptography code). The automated and
|
|
36
|
+
manual test coverage for this code is weak at best. Issues or patches to
|
|
37
|
+
update the code or tests would be appreciated.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
- **SECURITY**, **BREAKING**: Remove `forge.debug` API. The API has the
|
|
41
|
+
potential for prototype pollution. This API was only briefly used by the
|
|
42
|
+
maintainers for internal project debug purposes and was never intended to be
|
|
43
|
+
used with untrusted user inputs. This API was not documented or advertised
|
|
44
|
+
and is being removed rather than fixed.
|
|
45
|
+
- **SECURITY**, **BREAKING**: Remove `forge.util.parseUrl()` (and
|
|
46
|
+
`forge.http.parseUrl` alias) and use the [WHATWG URL
|
|
47
|
+
Standard](https://url.spec.whatwg.org/). `URL` is supported by modern browers
|
|
48
|
+
and modern Node.js. This change is needed to address URL parsing security
|
|
49
|
+
issues. If `forge.util.parseUrl()` is used directly or through `forge.xhr` or
|
|
50
|
+
`forge.http` APIs, and support is needed for environments without `URL`
|
|
51
|
+
support, then a polyfill must be used.
|
|
52
|
+
- **BREAKING**: Remove `forge.task` API. This API was never used, documented,
|
|
53
|
+
or advertised by the maintainers. If anyone was using this API and wishes to
|
|
54
|
+
continue development it in other project, please let the maintainers know.
|
|
55
|
+
Due to use in the test suite, a modified version is located in
|
|
56
|
+
`tests/support/`.
|
|
57
|
+
- **BREAKING**: Remove `forge.util.makeLink`, `forge.util.makeRequest`,
|
|
58
|
+
`forge.util.parseFragment`, `forge.util.getQueryVariables`. Replace with
|
|
59
|
+
`URL`, `URLSearchParams`, and custom code as needed.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- **BREAKING**: Increase supported Node.js version to 6.13.0 for URL support.
|
|
63
|
+
- **BREAKING**: Renamed `master` branch to `main`.
|
|
64
|
+
- **BREAKING**: Release process updated to use tooling that prefixes versions
|
|
65
|
+
with `v`. Other tools, scripts, or scanners may need to adapt.
|
|
66
|
+
- **BREAKING**: Remove docs related to Bower and
|
|
67
|
+
[forge-dist](https://github.com/digitalbazaar/forge-dist). Install using
|
|
68
|
+
[another method](./README.md#installation).
|
|
69
|
+
|
|
70
|
+
### Added
|
|
71
|
+
- OIDs for `surname`, `title`, and `givenName`.
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
- **BREAKING**: OID 2.5.4.5 name fixed from `serialName` to `serialNumber`.
|
|
75
|
+
Depending on how applications used this id to name association it could cause
|
|
76
|
+
compatibility issues.
|
|
77
|
+
|
|
78
|
+
## 0.10.0 - 2020-09-01
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
- **BREAKING**: Node.js 4 no longer supported. The code *may* still work, and
|
|
82
|
+
non-invasive patches to keep it working will be considered. However, more
|
|
83
|
+
modern tools no longer support old Node.js versions making testing difficult.
|
|
84
|
+
|
|
85
|
+
### Removed
|
|
86
|
+
- **BREAKING**: Remove `util.getPath`, `util.setPath`, and `util.deletePath`.
|
|
87
|
+
`util.setPath` had a potential prototype pollution security issue when used
|
|
88
|
+
with unsafe inputs. These functions are not used by `forge` itself. They date
|
|
89
|
+
from an early time when `forge` was targeted at providing general helper
|
|
90
|
+
functions. The library direction changed to be more focused on cryptography.
|
|
91
|
+
Many other excellent libraries are more suitable for general utilities. If
|
|
92
|
+
you need a replacement for these functions, consider `get`, `set`, and `unset`
|
|
93
|
+
from [lodash](https://lodash.com/). But also consider the potential similar
|
|
94
|
+
security issues with those APIs.
|
|
95
|
+
|
|
96
|
+
## 0.9.2 - 2020-09-01
|
|
5
97
|
|
|
6
98
|
### Changed
|
|
7
99
|
- Added `util.setPath` security note to function docs and to README.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://nodei.co/npm/node-forge/)
|
|
4
4
|
|
|
5
|
-
[](https://github.com/digitalbazaar/forge/actions?query=workflow%3A%22Main+Checks%22)
|
|
6
6
|
|
|
7
7
|
A native implementation of [TLS][] (and various other cryptographic tools) in
|
|
8
8
|
[JavaScript][].
|
|
@@ -80,7 +80,6 @@ Documentation
|
|
|
80
80
|
* [Tasks](#task)
|
|
81
81
|
* [Utilities](#util)
|
|
82
82
|
* [Logging](#log)
|
|
83
|
-
* [Debugging](#debug)
|
|
84
83
|
* [Flash Networking Support](#flash)
|
|
85
84
|
|
|
86
85
|
### Other
|
|
@@ -106,7 +105,7 @@ not be regularly updated.
|
|
|
106
105
|
|
|
107
106
|
If you want to use forge with [Node.js][], it is available through `npm`:
|
|
108
107
|
|
|
109
|
-
https://npmjs.
|
|
108
|
+
https://www.npmjs.com/package/node-forge
|
|
110
109
|
|
|
111
110
|
Installation:
|
|
112
111
|
|
|
@@ -121,24 +120,12 @@ var forge = require('node-forge');
|
|
|
121
120
|
The npm package includes pre-built `forge.min.js`, `forge.all.min.js`, and
|
|
122
121
|
`prime.worker.min.js` using the [UMD][] format.
|
|
123
122
|
|
|
124
|
-
### Bundle / Bower
|
|
125
|
-
|
|
126
|
-
Each release is published in a separate repository as pre-built and minimized
|
|
127
|
-
basic forge bundles using the [UMD][] format.
|
|
128
|
-
|
|
129
|
-
https://github.com/digitalbazaar/forge-dist
|
|
130
|
-
|
|
131
|
-
This bundle can be used in many environments. In particular it can be installed
|
|
132
|
-
with [Bower][]:
|
|
133
|
-
|
|
134
|
-
bower install forge
|
|
135
|
-
|
|
136
123
|
### jsDelivr CDN
|
|
137
124
|
|
|
138
125
|
To use it via [jsDelivr](https://www.jsdelivr.com/package/npm/node-forge) include this in your html:
|
|
139
126
|
|
|
140
127
|
```html
|
|
141
|
-
<script src="https://cdn.jsdelivr.net/npm/node-forge@0.
|
|
128
|
+
<script src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js"></script>
|
|
142
129
|
```
|
|
143
130
|
|
|
144
131
|
### unpkg CDN
|
|
@@ -146,7 +133,7 @@ To use it via [jsDelivr](https://www.jsdelivr.com/package/npm/node-forge) includ
|
|
|
146
133
|
To use it via [unpkg](https://unpkg.com/#/) include this in your html:
|
|
147
134
|
|
|
148
135
|
```html
|
|
149
|
-
<script src="https://unpkg.com/node-forge@0.
|
|
136
|
+
<script src="https://unpkg.com/node-forge@1.0.0/dist/forge.min.js"></script>
|
|
150
137
|
```
|
|
151
138
|
|
|
152
139
|
### Development Requirements
|
|
@@ -1452,7 +1439,7 @@ __Examples__
|
|
|
1452
1439
|
|
|
1453
1440
|
```js
|
|
1454
1441
|
// generate a key pair
|
|
1455
|
-
var keys = forge.pki.rsa.generateKeyPair(
|
|
1442
|
+
var keys = forge.pki.rsa.generateKeyPair(2048);
|
|
1456
1443
|
|
|
1457
1444
|
// create a certification request (CSR)
|
|
1458
1445
|
var csr = forge.pki.createCertificationRequest();
|
|
@@ -1969,10 +1956,6 @@ var nodeBuffer = Buffer.from(forgeBuffer.getBytes(), 'binary');
|
|
|
1969
1956
|
// make sure you specify the encoding as 'binary'
|
|
1970
1957
|
var nodeBuffer = Buffer.from('CAFE', 'hex');
|
|
1971
1958
|
var forgeBuffer = forge.util.createBuffer(nodeBuffer.toString('binary'));
|
|
1972
|
-
|
|
1973
|
-
// parse a URL
|
|
1974
|
-
var parsed = forge.util.parseUrl('http://example.com/foo?bar=baz');
|
|
1975
|
-
// parsed.scheme, parsed.host, parsed.port, parsed.path, parsed.fullHost
|
|
1976
1959
|
```
|
|
1977
1960
|
|
|
1978
1961
|
<a name="log" />
|
|
@@ -1988,19 +1971,6 @@ __Examples__
|
|
|
1988
1971
|
// TODO
|
|
1989
1972
|
```
|
|
1990
1973
|
|
|
1991
|
-
<a name="debug" />
|
|
1992
|
-
|
|
1993
|
-
### Debugging
|
|
1994
|
-
|
|
1995
|
-
Provides storage of debugging information normally inaccessible in
|
|
1996
|
-
closures for viewing/investigation.
|
|
1997
|
-
|
|
1998
|
-
__Examples__
|
|
1999
|
-
|
|
2000
|
-
```js
|
|
2001
|
-
// TODO
|
|
2002
|
-
```
|
|
2003
|
-
|
|
2004
1974
|
<a name="flash" />
|
|
2005
1975
|
|
|
2006
1976
|
### Flash Networking Support
|
|
@@ -2021,8 +1991,8 @@ When using this code please keep the following in mind:
|
|
|
2021
1991
|
runtime characteristics, runtime optimization, code optimization, code
|
|
2022
1992
|
minimization, code obfuscation, bundling tools, possible bugs, the Forge code
|
|
2023
1993
|
itself, and so on.
|
|
2024
|
-
- If using pre-built bundles from [
|
|
2025
|
-
ran the tools to create those files.
|
|
1994
|
+
- If using pre-built bundles from [NPM][], another CDN, or similar, be aware
|
|
1995
|
+
someone else ran the tools to create those files.
|
|
2026
1996
|
- Use a secure transport channel such as [TLS][] to load scripts and consider
|
|
2027
1997
|
using additional security mechanisms such as [Subresource Integrity][] script
|
|
2028
1998
|
attributes.
|
|
@@ -2035,8 +2005,6 @@ When using this code please keep the following in mind:
|
|
|
2035
2005
|
- Certain features in this library are less susceptible to attacks depending on
|
|
2036
2006
|
usage. This primarily includes features that deal with data format
|
|
2037
2007
|
manipulation or those that are not involved in communication.
|
|
2038
|
-
- Do not pass unsafe inputs to `util.setPath`. Doing so could expose a
|
|
2039
|
-
prototype pollution security issue.
|
|
2040
2008
|
|
|
2041
2009
|
Library Background
|
|
2042
2010
|
------------------
|
|
@@ -2050,7 +2018,8 @@ Contact
|
|
|
2050
2018
|
* Code: https://github.com/digitalbazaar/forge
|
|
2051
2019
|
* Bugs: https://github.com/digitalbazaar/forge/issues
|
|
2052
2020
|
* Email: support@digitalbazaar.com
|
|
2053
|
-
* IRC: [#forgejs][] on [freenode][]
|
|
2021
|
+
* IRC: [#forgejs][] on [Libera.Chat][] (people may also be on [freenode][] for
|
|
2022
|
+
historical reasons).
|
|
2054
2023
|
|
|
2055
2024
|
Donations
|
|
2056
2025
|
---------
|
|
@@ -2065,7 +2034,6 @@ Financial support is welcome and helps contribute to futher development:
|
|
|
2065
2034
|
[3DES]: https://en.wikipedia.org/wiki/Triple_DES
|
|
2066
2035
|
[AES]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
|
|
2067
2036
|
[ASN.1]: https://en.wikipedia.org/wiki/ASN.1
|
|
2068
|
-
[Bower]: https://bower.io/
|
|
2069
2037
|
[Browserify]: http://browserify.org/
|
|
2070
2038
|
[CBC]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
|
|
2071
2039
|
[CFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
|
|
@@ -2078,7 +2046,9 @@ Financial support is welcome and helps contribute to futher development:
|
|
|
2078
2046
|
[HMAC]: https://en.wikipedia.org/wiki/HMAC
|
|
2079
2047
|
[JavaScript]: https://en.wikipedia.org/wiki/JavaScript
|
|
2080
2048
|
[Karma]: https://karma-runner.github.io/
|
|
2049
|
+
[Libera.Chat]: https://libera.chat/
|
|
2081
2050
|
[MD5]: https://en.wikipedia.org/wiki/MD5
|
|
2051
|
+
[NPM]: https://www.npmjs.com/
|
|
2082
2052
|
[Node.js]: https://nodejs.org/
|
|
2083
2053
|
[OFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
|
|
2084
2054
|
[PKCS#10]: https://en.wikipedia.org/wiki/Certificate_signing_request
|