forked from enviPath/enviPy
Current Dev State
This commit is contained in:
57
static/js/ketcher2/node_modules/pem/HISTORY.md
generated
vendored
Normal file
57
static/js/ketcher2/node_modules/pem/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
Generated by [auto-changelog](https://github.com/CookPete/auto-changelog)
|
||||
|
||||
|
||||
## [Unreleased](https://github.com/Dexus/pem/compare/v1.12.1...HEAD)
|
||||
|
||||
### Fixed
|
||||
* fix #150: serial can now be an 20 octets string, number or hex [`#150`](https://github.com/Dexus/pem/issues/150)
|
||||
|
||||
|
||||
## [v1.12.1](https://github.com/Dexus/pem/compare/v1.12.0...v1.12.1) - 2017-10-07
|
||||
|
||||
### Fixed
|
||||
* fix #159; renamed helper methods [`#159`](https://github.com/Dexus/pem/issues/159)
|
||||
|
||||
|
||||
## [v1.12.0](https://github.com/Dexus/pem/compare/v1.11.2...v1.12.0) - 2017-09-28
|
||||
|
||||
### Commits
|
||||
* fix(package): consistent usage of -password -passin and -passout [`a7c5654`](https://github.com/Dexus/pem/commit/a7c56541ede4a8979eb83d513c6521efcbb1dd96)
|
||||
|
||||
|
||||
## [v1.11.2](https://github.com/Dexus/pem/compare/v1.11.1...v1.11.2) - 2017-09-21
|
||||
|
||||
### Fixed
|
||||
* fix(package): max 20 octets for serial (#141) [`#84`](https://github.com/Dexus/pem/issues/84)
|
||||
|
||||
|
||||
## [v1.11.1](https://github.com/Dexus/pem/compare/v1.11.0...v1.11.1) - 2017-09-20
|
||||
|
||||
### Merged
|
||||
* Update semantic-release to the latest version 🚀 [`#134`](https://github.com/Dexus/pem/pull/134)
|
||||
|
||||
|
||||
## [v1.11.0](https://github.com/Dexus/pem/compare/v1.9.8...v1.11.0) - 2017-09-13
|
||||
|
||||
### Fixed
|
||||
* Fix #132 new version 1.10.1 [`#132`](https://github.com/Dexus/pem/issues/132)
|
||||
|
||||
|
||||
## [v1.9.8](https://github.com/Dexus/pem/compare/v1.9.6...v1.9.8) - 2017-09-03
|
||||
|
||||
### Merged
|
||||
* Allow array values for CSRs [`#124`](https://github.com/Dexus/pem/pull/124)
|
||||
|
||||
### Fixed
|
||||
* chore(package): update semantic-release to version 7.0.2 [`#128`](https://github.com/Dexus/pem/issues/128)
|
||||
|
||||
|
||||
## v1.9.6 - 2017-04-27
|
||||
|
||||
### Merged
|
||||
* Update README [`#119`](https://github.com/Dexus/pem/pull/119)
|
||||
* Revert "Regex support for new format with spaces" [`#113`](https://github.com/Dexus/pem/pull/113)
|
||||
* Regex support for new format with spaces [`#111`](https://github.com/Dexus/pem/pull/111)
|
||||
17
static/js/ketcher2/node_modules/pem/LICENSE
generated
vendored
Normal file
17
static/js/ketcher2/node_modules/pem/LICENSE
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
Copyright (c) 2012 Andris Reinman
|
||||
Copyright (c) 2016 Josef Fröhle
|
||||
|
||||
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 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.
|
||||
332
static/js/ketcher2/node_modules/pem/README.md
generated
vendored
Normal file
332
static/js/ketcher2/node_modules/pem/README.md
generated
vendored
Normal file
@ -0,0 +1,332 @@
|
||||
pem
|
||||
===
|
||||
|
||||
Create private keys and certificates with node.js
|
||||
|
||||
[](http://travis-ci.org/Dexus/pem) [](http://badge.fury.io/js/pem) [](https://www.npmjs.com/package/pem) [](https://www.deineagentur.com/projects/pem) [](https://greenkeeper.io/)
|
||||
|
||||
|
||||
[](https://github.com/standard/standard)
|
||||
|
||||
## Installation
|
||||
|
||||
Install with npm
|
||||
|
||||
npm install pem
|
||||
|
||||
## Examples
|
||||
|
||||
Here are some examples for creating an SSL key/cert on the fly, and running an HTTPS server on port 443. 443 is the standard HTTPS port, but requires root permissions on most systems. To get around this, you could use a higher port number, like 4300, and use https://localhost:4300 to access your server.
|
||||
|
||||
### Basic https
|
||||
```javascript
|
||||
var https = require('https')
|
||||
var pem = require('pem')
|
||||
|
||||
pem.createCertificate({ days: 1, selfSigned: true }, function (err, keys) {
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
https.createServer({ key: keys.serviceKey, cert: keys.certificate }, function (req, res) {
|
||||
res.end('o hai!')
|
||||
}).listen(443)
|
||||
})
|
||||
```
|
||||
|
||||
### Express
|
||||
```javascript
|
||||
var https = require('https')
|
||||
var pem = require('pem')
|
||||
var express = require('express')
|
||||
|
||||
pem.createCertificate({ days: 1, selfSigned: true }, function (err, keys) {
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
var app = express()
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('o hai!')
|
||||
})
|
||||
|
||||
https.createServer({ key: keys.serviceKey, cert: keys.certificate }, app).listen(443)
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
Please have a look into the [API documentation](https://www.deineagentur.com/projects/pem/index.html).
|
||||
|
||||
_we had to clean up a bit_
|
||||
<!--
|
||||
### Create a dhparam key
|
||||
|
||||
Use `createDhparam` for creating dhparam keys
|
||||
|
||||
pem.createDhparam(keyBitsize, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **keyBitsize** is an optional size of the key, defaults to 512 (bit)
|
||||
* **callback** is a callback function with an error object and `{dhparam}`
|
||||
|
||||
### Create a ecparam key
|
||||
|
||||
Use `createEcparam` for creating ecparam keys
|
||||
|
||||
pem.createEcparam(keyName, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **keyName** is an optional name of the key curves name, defaults to secp256k1
|
||||
* **callback** is a callback function with an error object and `{ecparam}`
|
||||
|
||||
### Create a private key
|
||||
|
||||
Use `createPrivateKey` for creating private keys
|
||||
|
||||
pem.createPrivateKey(keyBitsize, [options,] callback)
|
||||
|
||||
Where
|
||||
|
||||
* **keyBitsize** is an optional size of the key, defaults to 2048 (bit)
|
||||
* **options** is an optional object of the cipher and password (both required for encryption), defaults {cipher:'',password:''}
|
||||
(ciphers:["aes128", "aes192", "aes256", "camellia128", "camellia192", "camellia256", "des", "des3", "idea"])
|
||||
* **callback** is a callback function with an error object and `{key}`
|
||||
|
||||
### Create a Certificate Signing Request
|
||||
|
||||
Use `createCSR` for creating certificate signing requests
|
||||
|
||||
pem.createCSR(options, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **options** is an optional options object
|
||||
* **callback** is a callback function with an error object and `{csr, clientKey}`
|
||||
|
||||
Possible options are the following
|
||||
|
||||
* **clientKey** is an optional client key to use
|
||||
* **clientKeyPassword** the optional password for `clientKey`
|
||||
* **keyBitsize** - if `clientKey` is undefined, bit size to use for generating a new key (defaults to 2048)
|
||||
* **hash** is a hash function to use (either `md5`, `sha1` or `sha256`, defaults to `sha256`)
|
||||
* **country** is a CSR country field
|
||||
* **state** is a CSR state field
|
||||
* **locality** is a CSR locality field
|
||||
* **organization** is a CSR organization field
|
||||
* **organizationUnit** is a CSR organizational unit field
|
||||
* **commonName** is a CSR common name field (defaults to `localhost`)
|
||||
* **altNames** is a list (`Array`) of subjectAltNames in the subjectAltName field (optional)
|
||||
* **emailAddress** is a CSR email address field
|
||||
* **csrConfigFile** is a CSR config file
|
||||
|
||||
### Create a certificate
|
||||
|
||||
Use `createCertificate` for creating private keys
|
||||
|
||||
pem.createCertificate(options, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **options** is an optional options object
|
||||
* **callback** is a callback function with an error object and `{certificate, csr, clientKey, serviceKey}`
|
||||
|
||||
Possible options include all the options for `createCSR` - in case `csr` parameter is not defined and a new
|
||||
CSR needs to be generated.
|
||||
|
||||
In addition, possible options are the following
|
||||
|
||||
* **serviceKey** is a private key for signing the certificate, if not defined a new one is generated
|
||||
* **serviceKeyPassword** Password of the service key
|
||||
* **serviceCertificate** is the optional certificate for the `serviceKey`
|
||||
* **serial** is the unique serial number for the signed certificate, required if `serviceCertificate` is defined
|
||||
* **selfSigned** - if set to true and `serviceKey` is not defined, use `clientKey` for signing
|
||||
* **csr** is a CSR for the certificate, if not defined a new one is generated
|
||||
* **days** is the certificate expire time in days
|
||||
* **extFile** extension config file - **without** `-extensions v3_req`
|
||||
* **config** extension config file - **with** `-extensions v3_req`
|
||||
|
||||
### Export a public key
|
||||
|
||||
Use `getPublicKey` for exporting a public key from a private key, CSR or certificate
|
||||
|
||||
pem.getPublicKey(certificate, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded private key, CSR or certificate
|
||||
* **callback** is a callback function with an error object and `{publicKey}`
|
||||
|
||||
### Read certificate info
|
||||
|
||||
Use `readCertificateInfo` for reading subject data from a certificate or a CSR
|
||||
|
||||
pem.readCertificateInfo(certificate, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded CSR or a certificate
|
||||
* **callback** is a callback function with an error object and `{serial, country, state, locality, organization, organizationUnit, commonName, emailAddress, validity{start, end}, san{dns, ip}?, issuer{country, state, locality, organization, organizationUnit}, signatureAlgorithm, publicKeyAlgorithm, publicKeySize }`
|
||||
|
||||
? *san* is only present if the CSR or certificate has SAN entries.
|
||||
|
||||
*signatureAlgorithm, publicKeyAlgorithm and publicKeySize* only available if supportet and can parsed form openssl output
|
||||
|
||||
### Get fingerprint
|
||||
|
||||
Use `getFingerprint` to get the default SHA1 fingerprint for a certificate
|
||||
|
||||
pem.getFingerprint(certificate, [hash], callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded certificate
|
||||
* **hash** is a hash function to use (either `md5`, `sha1` or `sha256`, defaults to `sha1`)
|
||||
* **callback** is a callback function with an error object and `{fingerprint}`
|
||||
|
||||
### Get modulus
|
||||
|
||||
Use `getModulus` to get the modulus for a certificate, a CSR or a private key. Modulus can be useful to check that a Private Key Matches a Certificate
|
||||
|
||||
pem.getModulus(certificate, [password], [hash], callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded certificate, CSR or private key
|
||||
* **password** is an optional passphrase for passpharse protected certificates
|
||||
* **hash** is an optional hash function to use (up to now `md5` supported) (default: none)
|
||||
* **callback** is a callback function with an error object and `{modulus}`
|
||||
|
||||
### Get DH parameter information
|
||||
|
||||
Use `getDhparamInfo` to get the size and prime of DH parameters.
|
||||
|
||||
pem.getDhparamInfo(dhparam, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **dhparam** is a PEM encoded DH parameters string
|
||||
* **callback** is a callback function with an error object and `{size, prime}`
|
||||
|
||||
|
||||
### Export to a PKCS12 keystore
|
||||
|
||||
Use `createPkcs12` to export a certificate, the private key and optionally any signing or intermediate CA certificates to a PKCS12 keystore.
|
||||
|
||||
pem.createPkcs12(clientKey, certificate, p12Password, [options], callback)
|
||||
|
||||
Where
|
||||
|
||||
* **clientKey** is a PEM encoded private key
|
||||
* **certificate** is a PEM encoded certificate
|
||||
* **p12Password** is the password of the exported keystore
|
||||
* **options** is an optional options object with `cipher`, (one of "aes128", "aes192", "aes256", "camellia128", "camellia192", "camellia256", "des", "des3" or "idea"), `clientKeyPassword` and `certFiles` (an array of additional certificates to include - e.g. CA certificates)
|
||||
* **callback** is a callback function with an error object and `{pkcs12}` (binary)
|
||||
|
||||
### Read a PKCS12 keystore
|
||||
|
||||
Use `readPkcs12` to read a certificate, private key and CA certificates from a PKCS12 keystore.
|
||||
|
||||
pem.readPkcs12(bufferOrPath, [options], callback)
|
||||
|
||||
Where
|
||||
|
||||
* **bufferOrPath** is a PKCS12 keystore as a [Buffer](https://nodejs.org/api/buffer.html) or the path to a file
|
||||
* **options** is an optional options object with `clientKeyPassword` which will be used to encrypt the stored key and `p12Password` which will be used to open the keystore
|
||||
* **callback** is a callback function with an error object and `{key: String, cert: String, ca: Array}`
|
||||
|
||||
### Check a PKCS12 keystore
|
||||
|
||||
Use `checkPkcs12` to check a PKCS12 keystore.
|
||||
|
||||
pem.checkPkcs12(bufferOrPath, [passphrase], callback)
|
||||
|
||||
Where
|
||||
|
||||
* **bufferOrPath** is a PKCS12 keystore as a [Buffer](https://nodejs.org/api/buffer.html) or the path to a file
|
||||
* **passphrase** is an optional passphrase which will be used to open the keystore
|
||||
* **callback** is a callback function with an error object and a boolean as arguments
|
||||
|
||||
### Verify a certificate signing chain
|
||||
|
||||
Use `verifySigningChain` to assert that a given certificate has a valid signing chain.
|
||||
|
||||
pem.verifySigningChain(certificate, ca, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded certificate string
|
||||
* **ca** is a PEM encoded CA certificate string or an array of certificate strings
|
||||
* **callback** is a callback function with an error object and a boolean as arguments
|
||||
|
||||
### Check a certificate file
|
||||
|
||||
Use `checkCertificate` to check / verify consistency of a certificate.
|
||||
|
||||
pem.checkCertificate(certificate, callback)
|
||||
|
||||
Where
|
||||
|
||||
* **certificate** is a PEM encoded certificate string
|
||||
* **callback** is a callback function with an error object and a boolean as arguments
|
||||
-->
|
||||
|
||||
### Custom extensions config file
|
||||
|
||||
You can specify custom OpenSSL extensions using the `config` or `extFile` options for `createCertificate` (or using `csrConfigFile` with `createCSR`).
|
||||
|
||||
`extFile` and `csrConfigFile` should be paths to the extension files. While `config` will generate a temporary file from the supplied file contents.
|
||||
|
||||
If you specify `config` then the `v3_req` section of your config file will be used.
|
||||
|
||||
The following would be an example of a Certificate Authority extensions file:
|
||||
|
||||
[req]
|
||||
req_extensions = v3_req
|
||||
distinguished_name = req_distinguished_name
|
||||
|
||||
[req_distinguished_name]
|
||||
commonName = Common Name
|
||||
commonName_max = 64
|
||||
|
||||
[v3_req]
|
||||
basicConstraints = critical,CA:TRUE
|
||||
|
||||
While the following would specify subjectAltNames in the resulting certificate:
|
||||
|
||||
[req]
|
||||
req_extensions = v3_req
|
||||
|
||||
[ v3_req ]
|
||||
basicConstraints = CA:FALSE
|
||||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = host1.example.com
|
||||
DNS.2 = host2.example.com
|
||||
DNS.3 = host3.example.com
|
||||
|
||||
Note that `createCertificate` and `createCSR` supports the `altNames` option which would be easier to use in most cases.
|
||||
|
||||
**Warning: If you specify `altNames` the custom extensions file will not be passed to OpenSSL.**
|
||||
|
||||
### Setting openssl location
|
||||
|
||||
In some systems the `openssl` executable might not be available by the default name or it is not included in $PATH. In this case you can define the location of the executable yourself as a one time action after you have loaded the pem module:
|
||||
|
||||
```javascript
|
||||
var pem = require('pem')
|
||||
pem.config({
|
||||
pathOpenSSL: '/usr/local/bin/openssl'
|
||||
})
|
||||
// do something with the pem module
|
||||
```
|
||||
|
||||
### Specialthanks to
|
||||
|
||||
- Andris Reinman (@andris9) - Initiator of pem
|
||||
|
||||
## License
|
||||
|
||||
**MIT**
|
||||
39
static/js/ketcher2/node_modules/pem/bin/aftersuccess.js
generated
vendored
Normal file
39
static/js/ketcher2/node_modules/pem/bin/aftersuccess.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
const deployOnce = require('../node_modules/travis-deploy-once')
|
||||
|
||||
const makeTest = async function () {
|
||||
let result
|
||||
|
||||
try {
|
||||
// Options can also be set as environment variables with the same name
|
||||
result = await deployOnce(
|
||||
{
|
||||
// Object passed to https://github.com/pwmckenna/node-travis-ci
|
||||
travisOpts: {pro: false},
|
||||
// GitHub oAuth token
|
||||
GH_TOKEN: process.env.GH_TOKEN,
|
||||
// Want to control which job is the build leader?
|
||||
// Set your preferred job id
|
||||
BUILD_LEADER_ID: 1
|
||||
}
|
||||
)
|
||||
} catch (err) {
|
||||
// something went wrong, and err will tell you what
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
process.exitCode = 0
|
||||
console.log(0)
|
||||
}
|
||||
if (result === false) {
|
||||
process.exitCode = 1
|
||||
console.log(1)
|
||||
}
|
||||
if (result === null) {
|
||||
process.exitCode = 1
|
||||
console.log(1)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
makeTest()
|
||||
33
static/js/ketcher2/node_modules/pem/bin/aftersuccess.sh
generated
vendored
Executable file
33
static/js/ketcher2/node_modules/pem/bin/aftersuccess.sh
generated
vendored
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
VAR_PUSH=0
|
||||
|
||||
for i in "$@" ; do
|
||||
if [[ $i == "-push" ]] ; then
|
||||
VAR_PUSH=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
git config --global user.name "Dexus via TravisCI"
|
||||
git config --global user.email "github@josef-froehle.de"
|
||||
git config credential.helper "store --file=.git/credentials"
|
||||
echo "https://$GH_TOKEN:@github.com" > .git/credentials
|
||||
git checkout "$TRAVIS_BRANCH" || exit 0
|
||||
|
||||
if [[ "${VAR_PUSH}" == "1" ]]
|
||||
then
|
||||
OUTPUT=$(node "$(pwd)/bin/aftersuccess.js")
|
||||
STATUS=$?
|
||||
echo "${OUTPUT}"
|
||||
fi
|
||||
|
||||
if [[ "${STATUS}" == "0" && "${VAR_PUSH}" == "1" ]]
|
||||
then
|
||||
sleep 10
|
||||
npm run changelog
|
||||
git add HISTORY.md
|
||||
git commit -m "Update HISTORY.md via TravisCI" -m "[ci skip]"
|
||||
git push
|
||||
fi
|
||||
73
static/js/ketcher2/node_modules/pem/bin/test_build_openssl.sh
generated
vendored
Executable file
73
static/js/ketcher2/node_modules/pem/bin/test_build_openssl.sh
generated
vendored
Executable file
@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ -d "${OPENSSL_DIR}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NORMALPATH=$(pwd)
|
||||
|
||||
sudo apt-get install -y --no-install-recommends curl
|
||||
|
||||
case "${LIBRARY}" in
|
||||
"libressl")
|
||||
URL1="http://ftp.eu.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${VERSION}.tar.gz"
|
||||
URL2="http://ftp3.usa.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${VERSION}.tar.gz"
|
||||
;;
|
||||
"openssl")
|
||||
URL1="https://openssl.org/source/openssl-${VERSION}.tar.gz"
|
||||
URL2="http://mirrors.ibiblio.org/openssl/source/openssl-${VERSION}.tar.gz"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${TARGET}" in
|
||||
"x86_64-unknown-linux-gnu")
|
||||
OS_COMPILER=linux-x86_64
|
||||
;;
|
||||
"i686-unknown-linux-gnu")
|
||||
OS_COMPILER=linux-elf
|
||||
OS_FLAGS=-m32
|
||||
;;
|
||||
"arm-unknown-linux-gnueabihf")
|
||||
OS_COMPILER=linux-armv4
|
||||
export AR=arm-linux-gnueabihf-ar
|
||||
export CC=arm-linux-gnueabihf-gcc
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p /tmp/build
|
||||
cd /tmp/build
|
||||
|
||||
OUT=/tmp/openssl.tgz
|
||||
MAX_REDIRECTS=5
|
||||
curl -o ${OUT} -L --max-redirs ${MAX_REDIRECTS} "${URL1}" \
|
||||
|| curl -o ${OUT} -L --max-redirs ${MAX_REDIRECTS} "${URL2}"
|
||||
|
||||
tar --strip-components=1 -xzf ${OUT}
|
||||
|
||||
case "${LIBRARY}" in
|
||||
"openssl")
|
||||
./Configure --prefix="${OPENSSL_DIR}" ${OS_COMPILER} -fPIC -g ${OS_FLAGS} no-shared -static
|
||||
;;
|
||||
"libressl")
|
||||
./configure --prefix="${OPENSSL_DIR}" --disable-shared --with-pic
|
||||
;;
|
||||
esac
|
||||
|
||||
make "-j$(nproc)"
|
||||
sudo make install_sw
|
||||
|
||||
case "${LIBRARY}" in
|
||||
"openssl")
|
||||
if [[ ! -f "${OPENSSL_DIR}/ssl/openssl.cnf" ]]; then sudo mkdir -p "${OPENSSL_DIR}/ssl" && sudo cp apps/openssl.cnf "${OPENSSL_DIR}/ssl/openssl.cnf" ; fi
|
||||
;;
|
||||
"libressl")
|
||||
if [[ ! -f "${OPENSSL_DIR}/ssl/openssl.cnf" ]]; then sudo mkdir -p "${OPENSSL_DIR}/ssl" && sudo cp apps/openssl/openssl.cnf "${OPENSSL_DIR}/ssl/openssl.cnf" ; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
sudo chmod -Rf 0755 /openssl
|
||||
|
||||
cd "${NORMALPATH}"
|
||||
|
||||
rm -r -f node_modules && npm i
|
||||
44
static/js/ketcher2/node_modules/pem/jsdoc.json
generated
vendored
Normal file
44
static/js/ketcher2/node_modules/pem/jsdoc.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"tags": {
|
||||
"allowUnknownTags": false
|
||||
},
|
||||
"source": {
|
||||
"include": "./lib",
|
||||
"includePattern": ".js$",
|
||||
"excludePattern": "(node_modules/|test/|docs)"
|
||||
},
|
||||
"plugins": ["plugins/markdown"],
|
||||
"templates": {
|
||||
"cleverLinks": true,
|
||||
"monospaceLinks": true,
|
||||
"outputSourceFiles": true,
|
||||
"outputSourcePath": true,
|
||||
"dateFormat": "MMMM Do YYYY, HH:mm Z",
|
||||
"systemName": "pem",
|
||||
"footer": "",
|
||||
"copyright": "Copyright (c) 2012 Andris Reinman; 2016 Josef Fröhle",
|
||||
"navType": "vertical",
|
||||
"linenums": true,
|
||||
"collapseSymbols": false,
|
||||
"inverseNav": true,
|
||||
"highlightTutorialCode": true,
|
||||
"protocol": "html://",
|
||||
"syntaxTheme": "dark"
|
||||
},
|
||||
"markdown": {
|
||||
"parser": "gfm",
|
||||
"hardwrap": true
|
||||
},
|
||||
"opts": {
|
||||
"verbose": true,
|
||||
"encoding": "utf8",
|
||||
"destination": "docs/jsdoc/",
|
||||
"recurse": true,
|
||||
"readme": "./README.md",
|
||||
"template": "node_modules/@deineagenturug/docdash"
|
||||
},
|
||||
"docdash": {
|
||||
"static": true,
|
||||
"sort": true
|
||||
}
|
||||
}
|
||||
278
static/js/ketcher2/node_modules/pem/lib/convert.js
generated
vendored
Normal file
278
static/js/ketcher2/node_modules/pem/lib/convert.js
generated
vendored
Normal file
@ -0,0 +1,278 @@
|
||||
'use strict'
|
||||
|
||||
var openssl = require('./openssl.js')
|
||||
var helper = require('./helper.js')
|
||||
|
||||
// PEM format: .pem, .crt, .cer (!bin), .key
|
||||
// base64 encoded; the cert file might also include the private key; so key file is optional
|
||||
|
||||
// DER format: .der, .cer (bin)
|
||||
// binary encoded format; cannot include key file
|
||||
|
||||
// PKCS#7 / P7B format: .p7b, .p7c
|
||||
// contains cert and ca chain cert files, but not the key file
|
||||
// A PKCS7 certificate is serialized using either PEM or DER format.
|
||||
|
||||
// PKCS#12 / PFX format: .pfx, .p12
|
||||
// contains all files: key file, cert and ca chain cert files
|
||||
|
||||
/**
|
||||
* pem convert module
|
||||
*
|
||||
* @module convert
|
||||
*/
|
||||
|
||||
/**
|
||||
* conversion from PEM to DER format
|
||||
* if private key is included in PEM encoded file, it won't be included in DER file
|
||||
* use this method with type 'rsa' to export private key in that case
|
||||
* @param {String} pathIN path of the PEM encoded certificate file
|
||||
* @param {String} pathOUT path of the DER encoded certificate file to generate
|
||||
* @param {String} [type] type of file, use 'rsa' for key file, 'x509' otherwise or leave this parameter out
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.PEM2DER = function (pathIN, pathOUT, type, callback) {
|
||||
if (!callback && typeof type === 'function') {
|
||||
callback = type
|
||||
type = 'x509'
|
||||
}
|
||||
var params = [
|
||||
type,
|
||||
'-outform',
|
||||
'der',
|
||||
'-in',
|
||||
pathIN,
|
||||
'-out',
|
||||
pathOUT
|
||||
]
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion from DER to PEM format
|
||||
* @param {String} pathIN path of the DER encoded certificate file
|
||||
* @param {String} pathOUT path of the PEM encoded certificate file to generate
|
||||
* @param {String} [type] type of file, use 'rsa' for key file, 'x509' otherwise or leave this parameter out
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.DER2PEM = function (pathIN, pathOUT, type, callback) {
|
||||
if (!callback && typeof type === 'function') {
|
||||
callback = type
|
||||
type = 'x509'
|
||||
}
|
||||
var params = [
|
||||
type,
|
||||
'-inform',
|
||||
'der',
|
||||
'-in',
|
||||
pathIN,
|
||||
'-out',
|
||||
pathOUT
|
||||
]
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion from PEM to P7B format
|
||||
* @param {Object} pathBundleIN paths of the PEM encoded certificate files ({cert: '...', ca: '...' or ['...', ...]})
|
||||
* @param {String} pathOUT path of the P7B encoded certificate file to generate
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.PEM2P7B = function (pathBundleIN, pathOUT, callback) {
|
||||
var params = [
|
||||
'crl2pkcs7',
|
||||
'-nocrl',
|
||||
'-certfile',
|
||||
pathBundleIN.cert,
|
||||
'-out',
|
||||
pathOUT
|
||||
]
|
||||
if (pathBundleIN.ca) {
|
||||
if (!Array.isArray(pathBundleIN.ca)) {
|
||||
pathBundleIN.ca = [ pathBundleIN.ca ]
|
||||
}
|
||||
pathBundleIN.ca.forEach(function (ca) {
|
||||
params.push('-certfile')
|
||||
params.push(ca)
|
||||
})
|
||||
}
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion from P7B to PEM format
|
||||
* @param {String} pathIN path of the P7B encoded certificate file
|
||||
* @param {String} pathOUT path of the PEM encoded certificate file to generate
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.P7B2PEM = function (pathIN, pathOUT, callback) {
|
||||
var params = [
|
||||
'pkcs7',
|
||||
'-print_certs',
|
||||
'-in',
|
||||
pathIN,
|
||||
'-out',
|
||||
pathOUT
|
||||
]
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
})
|
||||
}// TODO: CA also included?
|
||||
|
||||
/**
|
||||
* conversion from PEM to PFX
|
||||
* @param {Object} pathBundleIN paths of the PEM encoded certificate files ({cert: '...', key: '...', ca: '...' or ['...', ...]})
|
||||
* @param {String} pathOUT path of the PFX encoded certificate file to generate
|
||||
* @param {String} password password to set for accessing the PFX file
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.PEM2PFX = function (pathBundleIN, pathOUT, password, callback) {
|
||||
var params = [
|
||||
'pkcs12',
|
||||
'-export',
|
||||
'-out',
|
||||
pathOUT,
|
||||
'-inkey',
|
||||
pathBundleIN.key,
|
||||
'-in',
|
||||
pathBundleIN.cert
|
||||
]
|
||||
if (pathBundleIN.ca) {
|
||||
if (!Array.isArray(pathBundleIN.ca)) {
|
||||
pathBundleIN.ca = [ pathBundleIN.ca ]
|
||||
}
|
||||
pathBundleIN.ca.forEach(function (ca) {
|
||||
params.push('-certfile')
|
||||
params.push(ca)
|
||||
})
|
||||
}
|
||||
var delTempPWFiles = []
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'in'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'out'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
function done (error) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
}
|
||||
helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
|
||||
done(error || fsErr)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion from PFX to PEM
|
||||
* @param {Object} pathIN path of the PFX encoded certificate file
|
||||
* @param {String} pathOUT path of the PEM encoded certificate file to generate
|
||||
* @param {String} password password to set for accessing the PFX file
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.PFX2PEM = function (pathIN, pathOUT, password, callback) {
|
||||
var params = [
|
||||
'pkcs12',
|
||||
'-in',
|
||||
pathIN,
|
||||
'-out',
|
||||
pathOUT,
|
||||
'-nodes'
|
||||
]
|
||||
var delTempPWFiles = []
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'in'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'out'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
function done (error) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
}
|
||||
helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
|
||||
done(error || fsErr)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion from P7B to PFX/PKCS#12
|
||||
* @param {Object} pathBundleIN paths of the PEM encoded certificate files ({cert: '...', key: '...', ca: '...' or ['...', ...]})
|
||||
* @param {String} pathOUT path of the PFX certificate file to generate
|
||||
* @param {String} password password to be set for the PFX file and to be used to access the key file
|
||||
* @param {Function} callback callback method called with error, boolean result
|
||||
*/
|
||||
module.exports.P7B2PFX = function (pathBundleIN, pathOUT, password, callback) {
|
||||
var tmpfile = pathBundleIN.cert.replace(/\.[^.]+$/, '.cer')
|
||||
var params = [
|
||||
'pkcs7',
|
||||
'-print_certs',
|
||||
'-in',
|
||||
pathBundleIN.cert,
|
||||
'-out',
|
||||
tmpfile
|
||||
]
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
var params = [
|
||||
'pkcs12',
|
||||
'-export',
|
||||
'-in',
|
||||
tmpfile,
|
||||
'-inkey',
|
||||
pathBundleIN.key,
|
||||
'-out',
|
||||
pathOUT
|
||||
]
|
||||
if (pathBundleIN.ca) {
|
||||
if (!Array.isArray(pathBundleIN.ca)) {
|
||||
pathBundleIN.ca = [ pathBundleIN.ca ]
|
||||
}
|
||||
pathBundleIN.ca.forEach(function (ca) {
|
||||
params.push('-certfile')
|
||||
params.push(ca)
|
||||
})
|
||||
}
|
||||
var delTempPWFiles = [tmpfile]
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'in'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
helper.createPasswordFile({'cipher': '', 'password': password, 'passType': 'out'}, params, delTempPWFiles[delTempPWFiles.length])
|
||||
openssl.spawnWrapper(params, false, function (error, code) {
|
||||
function done (error) {
|
||||
if (error) {
|
||||
callback(error)
|
||||
} else {
|
||||
callback(null, code === 0)
|
||||
}
|
||||
}
|
||||
helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
|
||||
done(error || fsErr)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
137
static/js/ketcher2/node_modules/pem/lib/helper.js
generated
vendored
Normal file
137
static/js/ketcher2/node_modules/pem/lib/helper.js
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
'use strict'
|
||||
|
||||
var pathlib = require('path')
|
||||
var fs = require('fs')
|
||||
var crypto = require('crypto')
|
||||
var osTmpdir = require('os-tmpdir')
|
||||
var tempDir = process.env.PEMJS_TMPDIR || osTmpdir()
|
||||
/**
|
||||
* pem helper module
|
||||
*
|
||||
* @module helper
|
||||
*/
|
||||
|
||||
/**
|
||||
* helper function to check is the string a number or not
|
||||
* @param {String} str String that should be checked to be a number
|
||||
*/
|
||||
module.exports.isNumber = function (str) {
|
||||
if (Array.isArray(str)) {
|
||||
return false
|
||||
}
|
||||
/*
|
||||
var bstr = str && str.toString()
|
||||
str = str + ''
|
||||
|
||||
return bstr - parseFloat(bstr) + 1 >= 0 &&
|
||||
!/^\s+|\s+$/g.test(str) && /^\d+$/g.test(str) &&
|
||||
!isNaN(str) && !isNaN(parseFloat(str))
|
||||
*/
|
||||
return /^\d+$/g.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function to check is the string a hexaceximal value
|
||||
* @param {String} hex String that should be checked to be a hexaceximal
|
||||
*/
|
||||
module.exports.isHex = function isHex (hex) {
|
||||
return /^(0x){0,1}([0-9A-F]{1,40}|[0-9A-F]{1,40})$/gi.test(hex)
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function to convert a string to a hexaceximal value
|
||||
* @param {String} str String that should be converted to a hexaceximal
|
||||
*/
|
||||
module.exports.toHex = function toHex (str) {
|
||||
var hex = ''
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
hex += '' + str.charCodeAt(i).toString(16)
|
||||
}
|
||||
return hex
|
||||
}
|
||||
|
||||
// cipherPassword returns an array of supported ciphers.
|
||||
/**
|
||||
* list of supported ciphers
|
||||
* @type {Array}
|
||||
*/
|
||||
module.exports.ciphers = ['aes128', 'aes192', 'aes256', 'camellia128', 'camellia192', 'camellia256', 'des', 'des3', 'idea']
|
||||
var ciphers = module.exports.ciphers
|
||||
|
||||
/**
|
||||
* Creates a PasswordFile to hide the password form process infos via `ps auxf` etc.
|
||||
* @param {Object} options object of cipher, password and passType, mustPass, {cipher:'aes128', password:'xxxx', passType:"in/out/word"}, if the object empty we do nothing
|
||||
* @param {String} options.cipher cipher like 'aes128', 'aes192', 'aes256', 'camellia128', 'camellia192', 'camellia256', 'des', 'des3', 'idea'
|
||||
* @param {String} options.password password can be empty or at last 4 to 1023 chars
|
||||
* @param {String} options.passType passType: can be in/out/word for passIN/passOUT/passWORD
|
||||
* @param {Boolean} options.mustPass mustPass is used when you need to set the pass like as "-password pass:" most needed when empty password
|
||||
* @param {Object} params params will be extended with the data that need for the openssl command. IS USED AS POINTER!
|
||||
* @param {String} PasswordFile PasswordFile is the filePath that later need to deleted, after the openssl command. IS USED AS POINTER!
|
||||
* @return {Boolean} result
|
||||
*/
|
||||
module.exports.createPasswordFile = function (options, params, PasswordFile) {
|
||||
if (!options || !options.hasOwnProperty('password') || !options.hasOwnProperty('passType') || !/^(word|in|out)$/.test(options.passType)) {
|
||||
return false
|
||||
}
|
||||
PasswordFile = pathlib.join(tempDir, crypto.randomBytes(20).toString('hex'))
|
||||
options.password = options.password.trim()
|
||||
if (options.password === '') {
|
||||
options.mustPass = true
|
||||
}
|
||||
if (options.cipher && (ciphers.indexOf(options.cipher) !== -1)) {
|
||||
params.push('-' + options.cipher)
|
||||
}
|
||||
params.push('-pass' + options.passType)
|
||||
if (options.mustPass) {
|
||||
params.push('pass:' + options.password)
|
||||
} else {
|
||||
fs.writeFileSync(PasswordFile, options.password)
|
||||
params.push('file:' + PasswordFile)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file or an array of files
|
||||
* @param {Array} files array of files that shoudld be deleted
|
||||
* @param {errorCallback} callback Callback function with an error object
|
||||
*/
|
||||
module.exports.deleteTempFiles = function (files, callback) {
|
||||
var rmFiles = []
|
||||
if (typeof files === 'string') {
|
||||
rmFiles.push(files)
|
||||
} else if (Array.isArray(files)) {
|
||||
rmFiles = files
|
||||
} else {
|
||||
return callback(new Error('Unexcepted files parameter type; only string or array supported'))
|
||||
}
|
||||
var deleteSeries = function (list, finalCallback) {
|
||||
if (list.length) {
|
||||
var file = list.shift()
|
||||
var myCallback = function (err) {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
// file doens't exist
|
||||
return deleteSeries(list, finalCallback)
|
||||
} else if (err) {
|
||||
// other errors, e.g. maybe we don't have enough permission
|
||||
return finalCallback(err)
|
||||
} else {
|
||||
return deleteSeries(list, finalCallback)
|
||||
}
|
||||
}
|
||||
if (file && typeof file === 'string') {
|
||||
fs.unlink(file, myCallback)
|
||||
} else {
|
||||
return deleteSeries(list, finalCallback)
|
||||
}
|
||||
} else {
|
||||
return finalCallback(null) // no errors
|
||||
}
|
||||
}
|
||||
deleteSeries(rmFiles, callback)
|
||||
}
|
||||
/**
|
||||
* Callback for return an error object.
|
||||
* @callback errorCallback
|
||||
* @param {Error} err - An Error Object or null
|
||||
*/
|
||||
257
static/js/ketcher2/node_modules/pem/lib/openssl.js
generated
vendored
Normal file
257
static/js/ketcher2/node_modules/pem/lib/openssl.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var helper = require('./helper.js')
|
||||
var cpspawn = require('child_process').spawn
|
||||
var pathlib = require('path')
|
||||
var fs = require('fs')
|
||||
var osTmpdir = require('os-tmpdir')
|
||||
var crypto = require('crypto')
|
||||
var which = require('which')
|
||||
var settings = {}
|
||||
var tempDir = process.env.PEMJS_TMPDIR || osTmpdir()
|
||||
|
||||
/**
|
||||
* pem openssl module
|
||||
*
|
||||
* @module openssl
|
||||
*/
|
||||
|
||||
/**
|
||||
* configue this openssl module
|
||||
*
|
||||
* @static
|
||||
* @param {String} option name e.g. pathOpenSSL, openSslVersion; TODO rethink nomenclature
|
||||
* @param {*} value value
|
||||
*/
|
||||
function set (option, value) {
|
||||
settings[option] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* get configuration setting value
|
||||
*
|
||||
* @static
|
||||
* @param {String} option name
|
||||
*/
|
||||
function get (option) {
|
||||
return settings[option] || null
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn an openssl command
|
||||
*
|
||||
* @static
|
||||
* @param {Array} params Array of openssl command line parameters
|
||||
* @param {String} searchStr String to use to find data
|
||||
* @param {Array} [tmpfiles] list of temporary files
|
||||
* @param {Function} callback Called with (error, stdout-substring)
|
||||
*/
|
||||
function exec (params, searchStr, tmpfiles, callback) {
|
||||
if (!callback && typeof tmpfiles === 'function') {
|
||||
callback = tmpfiles
|
||||
tmpfiles = false
|
||||
}
|
||||
|
||||
spawnWrapper(params, tmpfiles, function (err, code, stdout, stderr) {
|
||||
var start, end
|
||||
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
if ((start = stdout.match(new RegExp('\\-+BEGIN ' + searchStr + '\\-+$', 'm')))) {
|
||||
start = start.index
|
||||
} else {
|
||||
start = -1
|
||||
}
|
||||
|
||||
// To get the full EC key with parameters and private key
|
||||
if (searchStr === 'EC PARAMETERS') {
|
||||
searchStr = 'EC PRIVATE KEY'
|
||||
}
|
||||
|
||||
if ((end = stdout.match(new RegExp('^\\-+END ' + searchStr + '\\-+', 'm')))) {
|
||||
end = end.index + end[0].length
|
||||
} else {
|
||||
end = -1
|
||||
}
|
||||
|
||||
if (start >= 0 && end >= 0) {
|
||||
return callback(null, stdout.substring(start, end))
|
||||
} else {
|
||||
return callback(new Error(searchStr + ' not found from openssl output:\n---stdout---\n' + stdout + '\n---stderr---\n' + stderr + '\ncode: ' + code))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn an openssl command and get binary output
|
||||
*
|
||||
* @static
|
||||
* @param {Array} params Array of openssl command line parameters
|
||||
* @param {Array} [tmpfiles] list of temporary files
|
||||
* @param {Function} callback Called with (error, stdout)
|
||||
*/
|
||||
function execBinary (params, tmpfiles, callback) {
|
||||
if (!callback && typeof tmpfiles === 'function') {
|
||||
callback = tmpfiles
|
||||
tmpfiles = false
|
||||
}
|
||||
spawnWrapper(params, tmpfiles, true, function (err, code, stdout, stderr) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
return callback(null, stdout)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Generically spawn openSSL, without processing the result
|
||||
*
|
||||
* @static
|
||||
* @param {Array} params The parameters to pass to openssl
|
||||
* @param {Boolean} binary Output of openssl is binary or text
|
||||
* @param {Function} callback Called with (error, exitCode, stdout, stderr)
|
||||
*/
|
||||
function spawn (params, binary, callback) {
|
||||
var pathBin = get('pathOpenSSL') || process.env.OPENSSL_BIN || 'openssl'
|
||||
|
||||
testOpenSSLPath(pathBin, function (err) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
var openssl = cpspawn(pathBin, params)
|
||||
var stderr = ''
|
||||
|
||||
var stdout = (binary ? new Buffer(0) : '')
|
||||
openssl.stdout.on('data', function (data) {
|
||||
if (!binary) {
|
||||
stdout += data.toString('binary')
|
||||
} else {
|
||||
stdout = Buffer.concat([stdout, data])
|
||||
}
|
||||
})
|
||||
|
||||
openssl.stderr.on('data', function (data) {
|
||||
stderr += data.toString('binary')
|
||||
})
|
||||
// We need both the return code and access to all of stdout. Stdout isn't
|
||||
// *really* available until the close event fires; the timing nuance was
|
||||
// making this fail periodically.
|
||||
var needed = 2 // wait for both exit and close.
|
||||
var code = -1
|
||||
var finished = false
|
||||
var done = function (err) {
|
||||
if (finished) {
|
||||
return
|
||||
}
|
||||
|
||||
if (err) {
|
||||
finished = true
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
if (--needed < 1) {
|
||||
finished = true
|
||||
if (code) {
|
||||
if (code === 2 && (stderr === '' || /depth lookup: unable to/.test(stderr))) {
|
||||
return callback(null, code, stdout, stderr)
|
||||
}
|
||||
return callback(new Error('Invalid openssl exit code: ' + code + '\n% openssl ' + params.join(' ') + '\n' + stderr), code)
|
||||
} else {
|
||||
return callback(null, code, stdout, stderr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openssl.on('error', done)
|
||||
|
||||
openssl.on('exit', function (ret) {
|
||||
code = ret
|
||||
done()
|
||||
})
|
||||
|
||||
openssl.on('close', function () {
|
||||
stdout = (binary ? stdout : new Buffer(stdout, 'binary').toString('utf-8'))
|
||||
stderr = new Buffer(stderr, 'binary').toString('utf-8')
|
||||
done()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for spawn method
|
||||
*
|
||||
* @static
|
||||
* @param {Array} params The parameters to pass to openssl
|
||||
* @param {Array} [tmpfiles] list of temporary files
|
||||
* @param {Boolean} [binary] Output of openssl is binary or text
|
||||
* @param {Function} callback Called with (error, exitCode, stdout, stderr)
|
||||
*/
|
||||
function spawnWrapper (params, tmpfiles, binary, callback) {
|
||||
if (!callback && typeof binary === 'function') {
|
||||
callback = binary
|
||||
binary = false
|
||||
}
|
||||
|
||||
var files = []
|
||||
var delTempPWFiles = []
|
||||
|
||||
if (tmpfiles) {
|
||||
tmpfiles = [].concat(tmpfiles)
|
||||
params.forEach(function (value, i) {
|
||||
var fpath
|
||||
if (value === '--TMPFILE--') {
|
||||
fpath = pathlib.join(tempDir, crypto.randomBytes(20).toString('hex'))
|
||||
files.push({
|
||||
path: fpath,
|
||||
contents: tmpfiles.shift()
|
||||
})
|
||||
params[i] = fpath
|
||||
delTempPWFiles[delTempPWFiles.length] = fpath
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: need to refactored
|
||||
files.forEach(function (file) {
|
||||
fs.writeFileSync(file.path, file.contents)
|
||||
})
|
||||
|
||||
spawn(params, binary, function (err, code, stdout, stderr) {
|
||||
helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
|
||||
callback(err || fsErr, code, stdout, stderr)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the pathBin for the openssl command
|
||||
*
|
||||
* @private
|
||||
* @param {String} pathBin The path to OpenSSL Bin
|
||||
* @param {Function} callback Callback function with an error object
|
||||
*/
|
||||
function testOpenSSLPath (pathBin, callback) {
|
||||
which(pathBin, function (error) {
|
||||
if (error) {
|
||||
return callback(new Error('Could not find openssl on your system on this path: ' + pathBin))
|
||||
}
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
/* Once PEM is imported, the openSslVersion is set with this function. */
|
||||
spawn(['version'], false, function (err, code, stdout, stderr) {
|
||||
var text = String(stdout) + '\n' + String(stderr) + '\n' + String(err)
|
||||
var tmp = text.match(/^LibreSSL/i)
|
||||
set('openSslVersion', (tmp && tmp[0] ? 'LibreSSL' : 'openssl').toUpperCase())
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
exec: exec,
|
||||
execBinary: execBinary,
|
||||
spawn: spawn,
|
||||
spawnWrapper: spawnWrapper,
|
||||
set: set,
|
||||
get: get
|
||||
}
|
||||
1206
static/js/ketcher2/node_modules/pem/lib/pem.js
generated
vendored
Normal file
1206
static/js/ketcher2/node_modules/pem/lib/pem.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
static/js/ketcher2/node_modules/pem/mocha.opts
generated
vendored
Normal file
6
static/js/ketcher2/node_modules/pem/mocha.opts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
--recursive
|
||||
--bail
|
||||
--inline-diffs
|
||||
--reporter spec
|
||||
--check-leaks
|
||||
--use_strict
|
||||
105
static/js/ketcher2/node_modules/pem/package.json
generated
vendored
Normal file
105
static/js/ketcher2/node_modules/pem/package.json
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
{
|
||||
"_from": "pem@^1.8.3",
|
||||
"_id": "pem@1.12.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hT7GwvQL35+0iqgYUl8vn5I5pAVR0HcJas07TXL8bNaR4c5kAFRquk4ZqQk1F9YMcQOr6WjGdY5OnDC0RBnzig==",
|
||||
"_location": "/pem",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "pem@^1.8.3",
|
||||
"name": "pem",
|
||||
"escapedName": "pem",
|
||||
"rawSpec": "^1.8.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.8.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/budo"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pem/-/pem-1.12.3.tgz",
|
||||
"_shasum": "b1fb5c8b79da8d18146c27fee79b0d4ddf9905b3",
|
||||
"_spec": "pem@^1.8.3",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/budo",
|
||||
"author": {
|
||||
"name": "Andris Reinman",
|
||||
"email": "andris@kreata.ee"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Dexus/pem/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Josef Fröhle",
|
||||
"email": "github@josef-froehle.de",
|
||||
"url": "https://www.josef-froehle.de/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"md5": "^2.2.1",
|
||||
"os-tmpdir": "^1.0.1",
|
||||
"safe-buffer": "^5.1.1",
|
||||
"which": "^1.2.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Create private keys and certificates with node.js and io.js",
|
||||
"devDependencies": {
|
||||
"@deineagenturug/docdash": "^0.4.1",
|
||||
"auto-changelog": "^0.3.5",
|
||||
"chai": "^4.1.2",
|
||||
"cross-env": "^5.0.5",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"docco": "^0.7.0",
|
||||
"eslint": "^4.8.0",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-json": "^1.2.0",
|
||||
"eslint-plugin-markdown": "^1.0.0-beta.7",
|
||||
"eslint-plugin-node": "^5.2.0",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"jsdoc": "^3.5.5",
|
||||
"mocha": "^4.0.1",
|
||||
"nyc": "^11.2.1",
|
||||
"semantic-release": "^8.1.1",
|
||||
"travis-deploy-once": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/Dexus/pem#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/pem",
|
||||
"name": "pem",
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"html",
|
||||
"text"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.spec.js",
|
||||
"test/pem.helper.js"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"debug": false
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Dexus/pem.git"
|
||||
},
|
||||
"scripts": {
|
||||
"aftersuccess": "bin/aftersuccess.sh",
|
||||
"changelog": "auto-changelog --output HISTORY.md",
|
||||
"coverage": "cross-env NODE_ENV=development nyc ./node_modules/.bin/_mocha --opts mocha.opts $(find . -type f -name '*.spec.js' ! -path './nyc_output/*' ! -path './coverage/*' ! -path './node_modules/*')",
|
||||
"docco": "docco -l parallel -o docs/docco lib/helper.js lib/openssl.js lib/pem.js",
|
||||
"documentation": "npm run docco --silent && npm run jsdoc --silent",
|
||||
"jsdoc": "jsdoc -c jsdoc.json",
|
||||
"lint": "eslint --fix --config=./.eslintrc.js *.js *.md *.json lib/*.js test/*.js test/*.spec.js",
|
||||
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
|
||||
"test": "npm run lint --silent && npm run coverage --silent"
|
||||
},
|
||||
"version": "1.12.3"
|
||||
}
|
||||
255
static/js/ketcher2/node_modules/pem/test/convert.spec.js
generated
vendored
Normal file
255
static/js/ketcher2/node_modules/pem/test/convert.spec.js
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
'use strict'
|
||||
|
||||
var pem = require('..')
|
||||
var pemHelper = require('../lib/helper.js')
|
||||
var fs = require('fs')
|
||||
var hlp = require('./pem.helper.js')
|
||||
var chai = require('chai')
|
||||
var dirtyChai = require('dirty-chai')
|
||||
var expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe('convert.js tests', function () {
|
||||
after(function (done) {
|
||||
var tmpfiles
|
||||
tmpfiles = [
|
||||
'./test/fixtures/tmp.der',
|
||||
'./test/fixtures/tmp.pem',
|
||||
'./test/fixtures/tmp.p7b',
|
||||
'./test/fixtures/tmp.pfx'
|
||||
]
|
||||
pemHelper.deleteTempFiles(tmpfiles, function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('trigger error case', function () {
|
||||
before(function () {
|
||||
pem.config({
|
||||
pathOpenSSL: 'zzzzzzzzzzz'
|
||||
})
|
||||
})
|
||||
it('#.PEM2DER()', function (done) {
|
||||
pem.convert.PEM2DER('./test/fixtures/nopkey.pem', './test/fixtures/tmp.der', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.DER2PEM()', function (done) {
|
||||
pem.convert.DER2PEM('./test/fixtures/tmp.der', './test/fixtures/tmp.pem', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.PEM2P7B()', function (done) {
|
||||
pem.convert.PEM2P7B({cert: './test/fixtures/nopkey.pem'}, './test/fixtures/tmp.p7b', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.P7B2PEM()', function (done) {
|
||||
pem.convert.P7B2PEM('./test/fixtures/tmp.p7b', './test/fixtures/tmp.pem', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.PEM2PFX()', function (done) {
|
||||
var pathIN = {
|
||||
cert: './test/fixtures/test.crt',
|
||||
key: './test/fixtures/testnopw.key'
|
||||
}
|
||||
// password is required to encrypt the .pfx file; enforced by openssl
|
||||
pem.convert.PEM2PFX(pathIN, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.PFX2PEM()', function (done) {
|
||||
pem.convert.PFX2PEM('./test/fixtures/tmp.pfx', './test/fixtures/tmp.pem', 'password', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.P7B2PFX() [error in 1st step]', function (done) {
|
||||
pem.convert.P7B2PFX({cert: './test/fixtures/test.p7b', key: './test/fixtures/test.key', ca: './test/fixtures/GeoTrust_Primary_CA.pem'}, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('#.P7B2PFX() [error in 2nd step]', function (done) {
|
||||
pem.config({
|
||||
pathOpenSSL: process.env.OPENSSL_BIN || 'openssl'
|
||||
})
|
||||
pem.convert.P7B2PFX({cert: './test/fixtures/test.p7b', key: './test/fixtures/test404.key', ca: './test/fixtures/ca404.pem'}, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('check all success cases', function () {
|
||||
it('#.PEM2DER() [not providing type]', function (done) {
|
||||
pem.convert.PEM2DER('./test/fixtures/nopkey.pem', './test/fixtures/tmp.der', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2DER() [providing type]', function (done) {
|
||||
pem.convert.PEM2DER('./test/fixtures/nopkey.pem', './test/fixtures/tmp.der', 'x509', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.DER2PEM() [not providing type]', function (done) {
|
||||
pem.convert.DER2PEM('./test/fixtures/tmp.der', './test/fixtures/tmp.pem', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
var f1 = fs.readFileSync('./test/fixtures/nopkey.pem').toString()
|
||||
var f2 = fs.readFileSync('./test/fixtures/tmp.pem').toString()
|
||||
expect(f1).to.equal(f2)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.DER2PEM() [providing type]', function (done) {
|
||||
pem.convert.DER2PEM('./test/fixtures/tmp.der', './test/fixtures/tmp.pem', 'x509', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
var f1 = fs.readFileSync('./test/fixtures/nopkey.pem').toString()
|
||||
var f2 = fs.readFileSync('./test/fixtures/tmp.pem').toString()
|
||||
expect(f1).to.equal(f2)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2P7B() [providing a CA cert; no array format]', function (done) {
|
||||
pem.convert.PEM2P7B({cert: './test/fixtures/nopkey.pem', ca: './test/fixtures/GeoTrust_Primary_CA.pem'}, './test/fixtures/tmp.p7b', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2P7B() [providing a CA cert; array format]', function (done) {
|
||||
pem.convert.PEM2P7B({cert: './test/fixtures/nopkey.pem', ca: ['./test/fixtures/GeoTrust_Primary_CA.pem']}, './test/fixtures/tmp.p7b', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2P7B() [not providing a CA cert]', function (done) {
|
||||
pem.convert.PEM2P7B({cert: './test/fixtures/nopkey.pem'}, './test/fixtures/tmp.p7b', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.P7B2PEM()', function (done) {
|
||||
pem.convert.P7B2PEM('./test/fixtures/tmp.p7b', './test/fixtures/tmp.pem', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
var f1 = fs.readFileSync('./test/fixtures/nopkey.pem').toString()
|
||||
var f2 = fs.readFileSync('./test/fixtures/tmp.pem').toString()
|
||||
// can't directly compare as f2 comes with x509v3 header which might not be included in source file
|
||||
pem.readCertificateInfo(f1, function (error, d1) {
|
||||
hlp.checkError(error)
|
||||
pem.readCertificateInfo(f2, function (error, d2) {
|
||||
hlp.checkError(error)
|
||||
expect(d1).to.eql(d2)
|
||||
})
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2PFX() [no password protected key file]', function (done) {
|
||||
var pathIN = {
|
||||
cert: './test/fixtures/test.crt',
|
||||
key: './test/fixtures/testnopw.key'
|
||||
}
|
||||
// password is required to encrypt the .pfx file; enforced by openssl
|
||||
pem.convert.PEM2PFX(pathIN, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2PFX() [password protected key file]', function (done) {
|
||||
var pathIN = {
|
||||
cert: './test/fixtures/test.crt',
|
||||
key: './test/fixtures/test.key'
|
||||
}
|
||||
pem.convert.PEM2PFX(pathIN, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2PFX() [providing CA cert; no array format]', function (done) {
|
||||
var pathIN = {
|
||||
cert: './test/fixtures/test.crt',
|
||||
key: './test/fixtures/test.key',
|
||||
ca: './test/fixtures/GeoTrust_Primary_CA.pem'
|
||||
}
|
||||
pem.convert.PEM2PFX(pathIN, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PEM2PFX() [providing CA cert; array format]', function (done) {
|
||||
var pathIN = {
|
||||
cert: './test/fixtures/test.crt',
|
||||
key: './test/fixtures/test.key',
|
||||
ca: ['./test/fixtures/GeoTrust_Primary_CA.pem']
|
||||
}
|
||||
pem.convert.PEM2PFX(pathIN, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.PFX2PEM()', function (done) {
|
||||
pem.convert.PFX2PEM('./test/fixtures/tmp.pfx', './test/fixtures/tmp.pem', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.P7B2PFX() [providing ca cert; no array format]', function (done) {
|
||||
pem.convert.P7B2PFX({cert: './test/fixtures/test.p7b', key: './test/fixtures/test.key', ca: './test/fixtures/GeoTrust_Primary_CA.pem'}, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.P7B2PFX() [providing ca cert; array format]', function (done) {
|
||||
pem.convert.P7B2PFX({cert: './test/fixtures/test.p7b', key: './test/fixtures/test.key', ca: ['./test/fixtures/GeoTrust_Primary_CA.pem']}, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('#.P7B2PFX() [not providing ca cert]', function (done) {
|
||||
pem.convert.P7B2PFX({cert: './test/fixtures/test.p7b', key: './test/fixtures/test.key'}, './test/fixtures/tmp.pfx', 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.true()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
21
static/js/ketcher2/node_modules/pem/test/fixtures/GeoTrust_Primary_CA.pem
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/pem/test/fixtures/GeoTrust_Primary_CA.pem
generated
vendored
Normal file
@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2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl
|
||||
4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K
|
||||
oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj
|
||||
UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU
|
||||
AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
|
||||
-----END CERTIFICATE-----
|
||||
68
static/js/ketcher2/node_modules/pem/test/fixtures/google.com.pem
generated
vendored
Normal file
68
static/js/ketcher2/node_modules/pem/test/fixtures/google.com.pem
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDwjCCAqqgAwIBAgIIMPfmgdxQ04QwDQYJKoZIhvcNAQELBQAwSTELMAkGA1UE
|
||||
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
|
||||
cm5ldCBBdXRob3JpdHkgRzIwHhcNMTcwOTI2MTA1OTAwWhcNMTcxMjE5MTA1OTAw
|
||||
WjBoMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN
|
||||
TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEXMBUGA1UEAwwOd3d3
|
||||
Lmdvb2dsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQptqSsDzHdgCpE
|
||||
2bLsaN1aKT/np0r/I2bQ2QZueQvOWKwaJD5Kt6s6HE1LUZ/omxTwacgT7HDWmj8f
|
||||
bhMEZ45No4IBWDCCAVQwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAsG
|
||||
A1UdDwQEAwIHgDAZBgNVHREEEjAQgg53d3cuZ29vZ2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k+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
|
||||
ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
|
||||
uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
|
||||
Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
|
||||
tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
|
||||
PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
|
||||
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
|
||||
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
|
||||
-----END CERTIFICATE-----
|
||||
BIN
static/js/ketcher2/node_modules/pem/test/fixtures/idsrv3test.pfx
generated
vendored
Normal file
BIN
static/js/ketcher2/node_modules/pem/test/fixtures/idsrv3test.pfx
generated
vendored
Normal file
Binary file not shown.
86
static/js/ketcher2/node_modules/pem/test/fixtures/inclpkey.pem
generated
vendored
Normal file
86
static/js/ketcher2/node_modules/pem/test/fixtures/inclpkey.pem
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJKAIBAAKCAgEA18CnxulIxFNAs3bZLzcoPaPEQtB2zQibUOMcUeUUcvoroLEG
|
||||
I/PBrZJ8ef4VVNHlZ2La7YGqfuKxUKn72CkJ2oRNPPRuE6sL1e6AYzJ9V6+DPBwn
|
||||
7exn1v0cEy1Av9Hav3q2Z36wdTttYZ3MbBqX8Vben4DTFmC7im9Gm740dcNM0vHI
|
||||
8z6YKDDkyy0lYWJIvi7c7ZCTrnS3+klD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||||
eGV1E8uNbCkAZXdAVWXEfU780qN4QCcNmL+Do2nkC/z7E78/m7bTIsk3bXKg3eyc
|
||||
dm5Sz0I5MrrSliE3WNZDL3RqbTQB+b7/e1MhuIW4pBCtePzbrfl6c/RJ9NjVp3nM
|
||||
x25cSx8pwCSDh1O63Tjs7S/YwLXOAm86QrsLsNZKh15KG5BTNoUCggEBAP7c6LPt
|
||||
ZUIHt5r6g1Yb38pR/y2e4d5x9HT/ej6WPCocILcBpHHgOreIER9ZchhrjWvldsk5
|
||||
N97TCPolGalKj/NxOdOCyTg4h79z/ivSTDzp+6XAtT/hkf0ylKszxaudbp/2BCpR
|
||||
/ioBqhcxTlpLEv89VGuGL69U1vySP0ulqfad7Qs3Oig1/tee8bFnj73RR31iDEda
|
||||
vuDllni7ZM74Q/ibM1T82b9CQyX5VliZbfqMGW6o1mzQEclV8VDBXetJKla3LysF
|
||||
peiegN1Cu7qxVqymBxoN1ON2x6UMJs2h63dDCrbM6j2j8uA22/RmBE0OtD8QboAH
|
||||
9q6TSHHmbiJAhysCggEBANi3E5sLY1SdyFTIw0xf/KKjqYQanDo44sZgpN718AtC
|
||||
gVIf0cn2phIfUx4zHMygQFs0jdo2dghSYIV827/5+X8hmWthVZOTWaQvgcME9PCA
|
||||
adWn4WcM6VMycWLFsKQzq5hTak17KUx56JETZOti0BKKy4kSr+NcS1ojFJILM0M3
|
||||
M1SlXvOIxmZa5QUKR5ZasUiXyFQxv6PiREhM5ppku6NnX+Iroygj09rz/7TrX4Di
|
||||
ivOi3mUJK/G5047aASR2TbAweKAJ1HYQ1wZkZONAluMRaPruzwQlPFmDmwggNT6a
|
||||
qW+1vLWd1KRQmoPsPTOX0OwNQq96dOJV59TsnpeWjVMCggEAO/JMDd493f0gs6RO
|
||||
9hcSWW1V/y4K5J6bKFXbNBN0TVdWXpVVT6+1P+wSUvRgANxzZDiR6xy5RoEO8H9/
|
||||
fLFcEJ/GQTjXCZFKZL7svvP1GLLUjRU5zK/K/epCy84epZIf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sthum
|
||||
A5PX739JsNUi/p5aG+H/6eNx+ukJP7QaM646YCfS5i8S9DJUvim+/BSlKi2ZiOCd
|
||||
0MYH4Xb7lmAOTNmTvSYpKo9J2fZ9erw0MYSBTyjh6F7PRbHBiivgUnJfGQ==
|
||||
-----END CERTIFICATE-----
|
||||
BIN
static/js/ketcher2/node_modules/pem/test/fixtures/nopkey.der
generated
vendored
Normal file
BIN
static/js/ketcher2/node_modules/pem/test/fixtures/nopkey.der
generated
vendored
Normal file
Binary file not shown.
23
static/js/ketcher2/node_modules/pem/test/fixtures/nopkey.pem
generated
vendored
Normal file
23
static/js/ketcher2/node_modules/pem/test/fixtures/nopkey.pem
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDwTCCAyqgAwIBAgICDh4wDQYJKoZIhvcNAQEFBQAwgZsxCzAJBgNVBAYTAkpQ
|
||||
MQ4wDAYDVQQIEwVUb2t5bzEQMA4GA1UEBxMHQ2h1by1rdTERMA8GA1UEChMIRnJh
|
||||
bms0REQxGDAWBgNVBAsTD1dlYkNlcnQgU3VwcG9ydDEYMBYGA1UEAxMPRnJhbms0
|
||||
REQgV2ViIENBMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QGZyYW5rNGRkLmNvbTAi
|
||||
GA8wMDAwMDEwMTAwMDAwMVoYDzk5OTkxMjMxMjM1OTU5WjCBgTELMAkGA1UEBhMC
|
||||
SlAxDjAMBgNVBAgTBVRva3lvMREwDwYDVQQKEwhGcmFuazRERDEQMA4GA1UECxMH
|
||||
U3VwcG9ydDEiMCAGCSqGSIb3DQEJARYTcHVibGljQGZyYW5rNGRkLmNvbTEZMBcG
|
||||
A1UEAxMQd3d3LmZyYW5rNGRkLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
|
||||
gYEA4rkBL30FzR2ZHZ1vpF9kGBO0DMwhu2pcrkcLJ0SEuf52ggo+md0tPis8f1KN
|
||||
Tchxj6DtxWT3c7ECW0c1ALpu6mNVE+GaM94KsckSDehoPfbLjT9Apcc/F0mqvDsC
|
||||
N6fPdDixWrjx6xKT7xXi3lCy1yIKRMHA6Ha+T4qPyyCyMPECAwEAAaOCASYwggEi
|
||||
MAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgWgMB0GA1UdDgQWBBRWKE5tXPIyS0pC
|
||||
fE5taGO5Q84gyTCB0AYDVR0jBIHIMIHFgBRi83vtBtSx1Zx/SOXvxckVYf3ZEaGB
|
||||
oaSBnjCBmzELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRAwDgYDVQQHEwdD
|
||||
aHVvLWt1MREwDwYDVQQKEwhGcmFuazRERDEYMBYGA1UECxMPV2ViQ2VydCBTdXBw
|
||||
b3J0MRgwFgYDVQQDEw9GcmFuazRERCBXZWIgQ0ExIzAhBgkqhkiG9w0BCQEWFHN1
|
||||
cHBvcnRAZnJhbms0ZGQuY29tggkAxscECbwiW6AwEwYDVR0lBAwwCgYIKwYBBQUH
|
||||
AwEwDQYJKoZIhvcNAQEFBQADgYEAfXCfXcePJwnMKc06qLa336cEPpXEsPed1bw4
|
||||
xiIXfgZ39duBnN+Nv4a49Yl2kbh4JO8tcr5h8WYAI/a/69w8qBFQBUAjTEY/+lcw
|
||||
9/6wU7UA3kh7yexeqDiNTRflnPUv3sfiVdLDTjqLWWAxGS8L26PjVaCUFfJLNiYJ
|
||||
jerREgM=
|
||||
-----END CERTIFICATE-----
|
||||
26
static/js/ketcher2/node_modules/pem/test/fixtures/test.cnf
generated
vendored
Normal file
26
static/js/ketcher2/node_modules/pem/test/fixtures/test.cnf
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
[ req ]
|
||||
default_bits = 4096
|
||||
days = 9999
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
prompt = no
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = EE
|
||||
ST = Harjumaa
|
||||
L = Tallinn
|
||||
O = Node.ee
|
||||
OU = test
|
||||
CN = www.node.ee
|
||||
emailAddress = andris@node.ee
|
||||
|
||||
[ req_attributes ]
|
||||
challengePassword = challengePass
|
||||
|
||||
[ v3_ca ]
|
||||
authorityInfoAccess = @issuer_info
|
||||
|
||||
[ issuer_info ]
|
||||
OCSP;URI.0 = http://ocsp.node.ee/
|
||||
caIssuers;URI.0 = http://node.ee/ca.cert
|
||||
16
static/js/ketcher2/node_modules/pem/test/fixtures/test.crt
generated
vendored
Normal file
16
static/js/ketcher2/node_modules/pem/test/fixtures/test.crt
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIChTCCAe4CCQDbGP0P9s69azANBgkqhkiG9w0BAQsFADCBhjELMAkGA1UEBhMC
|
||||
WlcxGzAZBgNVBAgMEk1hdGViZWxlbGFuZCBOb3J0aDERMA8GA1UEBwwIQnVsYXdh
|
||||
eW8xDDAKBgNVBAoMA0J5bzELMAkGA1UECwwCSVQxDzANBgNVBAMMBmJ5by56dzEb
|
||||
MBkGCSqGSIb3DQEJARYMYWRtaW5AYnlvLnp3MB4XDTE1MDQxMDA5NTM1OVoXDTE2
|
||||
MDQwOTA5NTM1OVowgYYxCzAJBgNVBAYTAlpXMRswGQYDVQQIDBJNYXRlYmVsZWxh
|
||||
bmQgTm9ydGgxETAPBgNVBAcMCEJ1bGF3YXlvMQwwCgYDVQQKDANCeW8xCzAJBgNV
|
||||
BAsMAklUMQ8wDQYDVQQDDAZieW8uencxGzAZBgkqhkiG9w0BCQEWDGFkbWluQGJ5
|
||||
by56dzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0q4cDxLRslRKvG2pw5Gx
|
||||
7fsq7YyiTokoBaDavNold5Vvayi02Mc7dqIanr/ckc0AqgiDd5Kw2bBAYmQpWiDn
|
||||
pZxp79JIV+gGh7pkiB4wDzvRBXMcew72B9uuYEeUQ8eonE/Yro0ZnD0ZGmBiuk/6
|
||||
5xyWNikBhfPLnb2V+Cr/EKsCAwEAATANBgkqhkiG9w0BAQsFAAOBgQAwigr+o+Y+
|
||||
5BiL6MuHLTaC+lcv9r2GTHb7wNea674Db3Bi3u6FgmyMsZ8npPSlR0t/YZcFWtRM
|
||||
y4uXmw5zUutGZTbO/JFxts6kPV+a76mnNm71fF4QINkemmojvJyPZq9N+hV16dba
|
||||
v1m+dTK7hDZvpd/sM5bMtqWEq4aHkGhujw==
|
||||
-----END CERTIFICATE-----
|
||||
13
static/js/ketcher2/node_modules/pem/test/fixtures/test.csr
generated
vendored
Normal file
13
static/js/ketcher2/node_modules/pem/test/fixtures/test.csr
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIIB3jCCAUcCAQAwgYYxCzAJBgNVBAYTAlpXMRswGQYDVQQIDBJNYXRlYmVsZWxh
|
||||
bmQgTm9ydGgxETAPBgNVBAcMCEJ1bGF3YXlvMQwwCgYDVQQKDANCeW8xCzAJBgNV
|
||||
BAsMAklUMQ8wDQYDVQQDDAZieW8uencxGzAZBgkqhkiG9w0BCQEWDGFkbWluQGJ5
|
||||
by56dzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0q4cDxLRslRKvG2pw5Gx
|
||||
7fsq7YyiTokoBaDavNold5Vvayi02Mc7dqIanr/ckc0AqgiDd5Kw2bBAYmQpWiDn
|
||||
pZxp79JIV+gGh7pkiB4wDzvRBXMcew72B9uuYEeUQ8eonE/Yro0ZnD0ZGmBiuk/6
|
||||
5xyWNikBhfPLnb2V+Cr/EKsCAwEAAaAXMBUGCSqGSIb3DQEJAjEIDAZCeW8gQ28w
|
||||
DQYJKoZIhvcNAQELBQADgYEAxP+4Z2POlTlCBYpGhhKpTBbRDeAQakXqGBlB7ZC2
|
||||
0K4fSxuAGVArLV5rbPDHlzNCtmF8mvt55F7zVny4YQ8BHE7ujV3SWtiAr0Otq9VV
|
||||
WG5LmBLAbyrrUZloHJEpX0wPgQDmMdLhkDkbcjcKOT6WKNW5q36MW+Q9nViStGD5
|
||||
lJg=
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
5
static/js/ketcher2/node_modules/pem/test/fixtures/test.dh
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/pem/test/fixtures/test.dh
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIGHAoGBAMYXwgiuPY6TqxODWXbRRWx6eWoJuGkjKN8RjhBiLxFJzwgpdfONv5iG
|
||||
IHHGI8/IfhHI78Mqq+5z3z8L16fuOYnpbaDa2BSUdHZQQmFiCV748lOv9he08UJ5
|
||||
qgrFgdgi56V4FdRs2EHJnezvYmviAbIsi8imn+9TVed4DnOmuE1rAgEC
|
||||
-----END DH PARAMETERS-----
|
||||
18
static/js/ketcher2/node_modules/pem/test/fixtures/test.key
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/pem/test/fixtures/test.key
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: DES-EDE3-CBC,8D7649F2550A3AD6
|
||||
|
||||
iD68IbbRZDJuiYBqiEMLSfQQqcbXr4CeHFVkAYxCKN785tg+icShBeYXP2H2Oa7m
|
||||
dmFBNrtuPclUjk1VFeDcRhd1WwabuSbKJkV26bqIwYKSa1blDcgviSvIc8OgN06G
|
||||
K7kX+3jQzUMeSj+B1phyysCSoSU059oJvcNknBOEe67ersYZhXWFDOxVOeCnpsVA
|
||||
xDPRGVWa5g5jj0WqcXey/oC/hUccX8w8RZJLSBurIxfWBGy1QtsnopNRaxs5gqXj
|
||||
FCucQtYTMwRzA0c65/6yDrYrnv3v0mmCKBKXoTvhcmxkE/Ejrk0+ydxlgWXoMjOD
|
||||
CzuDy8xQ2KN2/62fb0Eb6LwnI3EHceXAO9GbgpCTXDZt0yoKMBDZFYA1+TuYBXJj
|
||||
RRcKDcF+gt1VdloSkAWIaDwypnPi0xngsJbzNIHKoSKYPuxWdUXB5rThbSdPki5x
|
||||
r8La88LBK6/WarJevce8Ggg/KCAx5ng/w9XzQDlMSNVT6Ht+gGe6+69XjBA5IyIo
|
||||
bymu9PlwRMMYEeEcH53tGXcCgSkzlDs2Cc+1+JUypZpX4oggNV5YhsmLZS5BtPFs
|
||||
9i3lA7RsxXoV0u1BTgHIqrH58IKaXN9xs0ceie3cLR5tcSiSsU9sh3wpjZ2AZ/Q5
|
||||
zjoHuyzQVxY14qlE3uWzI9vJtc/kCkQ4D8wdBRVM8uRzf+YGYKRbI6vvsSICeLuW
|
||||
n82E2zin77HnIOGVHPJ5aNaTQD91Ubxxv7lVeuxZf2tgejs2DbJraKOtOmHLd9GA
|
||||
Zb5G9TdFMxVcXq18xUMm/Rbkj8ugALxRy8CGNSrTFTPHaEwYxqhnAQ==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
17
static/js/ketcher2/node_modules/pem/test/fixtures/test.p7b
generated
vendored
Normal file
17
static/js/ketcher2/node_modules/pem/test/fixtures/test.p7b
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
-----BEGIN PKCS7-----
|
||||
MIICtgYJKoZIhvcNAQcCoIICpzCCAqMCAQExADALBgkqhkiG9w0BBwGgggKJMIIC
|
||||
hTCCAe4CCQDbGP0P9s69azANBgkqhkiG9w0BAQsFADCBhjELMAkGA1UEBhMCWlcx
|
||||
GzAZBgNVBAgMEk1hdGViZWxlbGFuZCBOb3J0aDERMA8GA1UEBwwIQnVsYXdheW8x
|
||||
DDAKBgNVBAoMA0J5bzELMAkGA1UECwwCSVQxDzANBgNVBAMMBmJ5by56dzEbMBkG
|
||||
CSqGSIb3DQEJARYMYWRtaW5AYnlvLnp3MB4XDTE1MDQxMDA5NTM1OVoXDTE2MDQw
|
||||
OTA5NTM1OVowgYYxCzAJBgNVBAYTAlpXMRswGQYDVQQIDBJNYXRlYmVsZWxhbmQg
|
||||
Tm9ydGgxETAPBgNVBAcMCEJ1bGF3YXlvMQwwCgYDVQQKDANCeW8xCzAJBgNVBAsM
|
||||
AklUMQ8wDQYDVQQDDAZieW8uencxGzAZBgkqhkiG9w0BCQEWDGFkbWluQGJ5by56
|
||||
dzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0q4cDxLRslRKvG2pw5Gx7fsq
|
||||
7YyiTokoBaDavNold5Vvayi02Mc7dqIanr/ckc0AqgiDd5Kw2bBAYmQpWiDnpZxp
|
||||
79JIV+gGh7pkiB4wDzvRBXMcew72B9uuYEeUQ8eonE/Yro0ZnD0ZGmBiuk/65xyW
|
||||
NikBhfPLnb2V+Cr/EKsCAwEAATANBgkqhkiG9w0BAQsFAAOBgQAwigr+o+Y+5BiL
|
||||
6MuHLTaC+lcv9r2GTHb7wNea674Db3Bi3u6FgmyMsZ8npPSlR0t/YZcFWtRMy4uX
|
||||
mw5zUutGZTbO/JFxts6kPV+a76mnNm71fF4QINkemmojvJyPZq9N+hV16dbav1m+
|
||||
dTK7hDZvpd/sM5bMtqWEq4aHkGhuj6EAMQA=
|
||||
-----END PKCS7-----
|
||||
15
static/js/ketcher2/node_modules/pem/test/fixtures/testnopw.key
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/pem/test/fixtures/testnopw.key
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQDSrhwPEtGyVEq8banDkbHt+yrtjKJOiSgFoNq82iV3lW9rKLTY
|
||||
xzt2ohqev9yRzQCqCIN3krDZsEBiZClaIOelnGnv0khX6AaHumSIHjAPO9EFcxx7
|
||||
DvYH265gR5RDx6icT9iujRmcPRkaYGK6T/rnHJY2KQGF88udvZX4Kv8QqwIDAQAB
|
||||
AoGALuEtPzFp1eupwaoJR4pI9HKaR8euahlc/XugkLtd8PEgnNCvBTm4Aprpn3+D
|
||||
3jGmvy8rydSrY5UzjnFJPlPqF2kWkQaBFtqBJpQFjCPDbQ3nwVoaEN7X/lz3v91M
|
||||
BdoMT36CPvzDwtdrA3U16Jd1JOV09DxP/7jAuvrP3zvuoOkCQQD/eXu/UL++xUb8
|
||||
BH4hkookSWrRJHIsRw5gktMoo2tGhe0AXVDh+3Eg8KNfvy2T/PqI7z/pn3QTcjn6
|
||||
hJlG7ujVAkEA0x0KUstDNB8FEn64xfmmbCWJ/kyYm3dtiR1ByvqNBJ4Dt3IAIwnP
|
||||
1ww9NWJfZta34nUzI97rDLyvBubaN0rTfwJBAM1kDOIt+EpWbpBUyFcTai5sPA1y
|
||||
4LvKULvBrzQ/1hI3v+gIHevg6/3QmXhzyh/tRjrrJpYb1QWBUy2eh2Bo2RUCQQCl
|
||||
hPROG62yFMwORyqpleXkjr4VkopoAgfwY+7srOqZfyZc0tXGou/ApIjs7Rbtc1Wz
|
||||
CL6y1hkl4F2+JItcpJ8TAkBUGA1T46IMHtQ4D7HaemPup+ve7gwYx2c1EDlLYAc/
|
||||
M9y+va/N+2k6DAMHUNIRktmgYsA5inGT/QCftLql4v+5
|
||||
-----END RSA PRIVATE KEY-----
|
||||
77
static/js/ketcher2/node_modules/pem/test/helper.spec.js
generated
vendored
Normal file
77
static/js/ketcher2/node_modules/pem/test/helper.spec.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var helper = require('../lib/helper.js')
|
||||
var hlp = require('./pem.helper.js')
|
||||
var chai = require('chai')
|
||||
var dirtyChai = require('dirty-chai')
|
||||
chai.use(dirtyChai)
|
||||
|
||||
// NOTE: we cover here only the test cases left in coverage report
|
||||
describe('helper.js tests', function () {
|
||||
describe('#.createPasswordFile()', function () {
|
||||
it('invalid options [not sufficient object keys]', function (done) {
|
||||
var tmpfiles = []
|
||||
var bufferOrPath = fs.readFileSync('./test/fixtures/idsrv3test.pfx')
|
||||
helper.createPasswordFile(
|
||||
{},
|
||||
['pkcs12', '-info', '-in', bufferOrPath, '-noout', '-maciter', '-nodes'],
|
||||
tmpfiles[tmpfiles.length]
|
||||
)
|
||||
helper.deleteTempFiles(tmpfiles, function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('invalid options [no password and passType option]', function (done) {
|
||||
var tmpfiles = []
|
||||
var bufferOrPath = fs.readFileSync('./test/fixtures/idsrv3test.pfx')
|
||||
helper.createPasswordFile(
|
||||
{cipher: '', bla: true, blub: true},
|
||||
['pkcs12', '-info', '-in', bufferOrPath, '-noout', '-maciter', '-nodes'],
|
||||
tmpfiles[tmpfiles.length]
|
||||
)
|
||||
helper.deleteTempFiles(tmpfiles, function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('mustPass option', function (done) {
|
||||
var tmpfiles = []
|
||||
var bufferOrPath = fs.readFileSync('./test/fixtures/idsrv3test.pfx')
|
||||
helper.createPasswordFile(
|
||||
{cipher: '', password: 'gregegegeg', passType: 'in', mustPass: 'password'},
|
||||
['pkcs12', '-info', '-in', bufferOrPath, '-noout', '-maciter', '-nodes'],
|
||||
tmpfiles[tmpfiles.length]
|
||||
)
|
||||
helper.deleteTempFiles(tmpfiles, function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.deleteTempFiles()', function () {
|
||||
it('files argument typeof string', function (done) {
|
||||
helper.deleteTempFiles('404.pem', function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('files argument invalid type', function (done) {
|
||||
helper.deleteTempFiles(true, function (fsErr) {
|
||||
hlp.checkError(fsErr, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('files argument array contains non-string value', function (done) {
|
||||
helper.deleteTempFiles([true], function (fsErr) {
|
||||
hlp.checkError(fsErr)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it.skip('other error than ENOENT occured', function (done) {
|
||||
// TODO
|
||||
})
|
||||
})
|
||||
})
|
||||
47
static/js/ketcher2/node_modules/pem/test/openssl.spec.js
generated
vendored
Normal file
47
static/js/ketcher2/node_modules/pem/test/openssl.spec.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
|
||||
var openssl = require('../lib/openssl.js')
|
||||
var hlp = require('./pem.helper.js')
|
||||
var chai = require('chai')
|
||||
var dirtyChai = require('dirty-chai')
|
||||
var expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
// NOTE: we cover here only the test cases left in coverage report
|
||||
describe('openssl.js tests', function () {
|
||||
describe('#.exec()', function () {
|
||||
it('search string not found', function (done) {
|
||||
openssl.exec([
|
||||
'dhparam',
|
||||
'-outform',
|
||||
'PEM',
|
||||
128
|
||||
], 'DH PARAMETERS 404', function (error) {
|
||||
hlp.checkError(error, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.execBinary()', function () {
|
||||
it('no tmpfiles parameter', function (done) {
|
||||
openssl.execBinary([
|
||||
'dhparam',
|
||||
'-outform',
|
||||
'PEM',
|
||||
128
|
||||
], function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.ok()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.spawn()', function () {
|
||||
it.skip('error case [openssl return code 2]', function (done) {
|
||||
// TODO; couldn't figure an example out
|
||||
})
|
||||
// TODO; I expect some more cases in here or code cleanup required
|
||||
})
|
||||
})
|
||||
122
static/js/ketcher2/node_modules/pem/test/pem.helper.js
generated
vendored
Normal file
122
static/js/ketcher2/node_modules/pem/test/pem.helper.js
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var chai = require('chai')
|
||||
var dirtyChai = require('dirty-chai')
|
||||
var expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
process.env.PEMJS_TMPDIR = './tmp'
|
||||
|
||||
if (process.env.TRAVIS === 'true' && process.env.OPENSSL_DIR !== '') {
|
||||
process.env.OPENSSL_BIN = '/openssl/bin/openssl'
|
||||
}
|
||||
|
||||
function checkTmpEmpty () {
|
||||
expect(fs.readdirSync(process.env.PEMJS_TMPDIR)).to.be.empty()
|
||||
}
|
||||
|
||||
function checkError (error, expectError) {
|
||||
if (expectError) {
|
||||
expect(error).to.be.ok()
|
||||
if (expectError !== true) { // object
|
||||
Object.keys(expectError).forEach(function (k) {
|
||||
expect(error[k]).to.equal(expectError[k]) // code, message, ...
|
||||
})
|
||||
}
|
||||
} else { expect(error).to.not.be.ok() }
|
||||
}
|
||||
|
||||
function checkEcparam (data, min, max) {
|
||||
expect(data).to.be.an('object').that.has.property('ecparam')
|
||||
expect(data.ecparam).to.be.a('string')
|
||||
expect(/^\r?\n*-----BEGIN EC PARAMETERS-----\r?\n/.test(data.ecparam)).to.be.true()
|
||||
expect(/\r?\n-----END EC PARAMETERS-----\r?\n/.test(data.ecparam)).to.be.true()
|
||||
expect(/\r?\n-----BEGIN EC PRIVATE KEY-----\r?\n/.test(data.ecparam)).to.be.true()
|
||||
expect(/\r?\n-----END EC PRIVATE KEY-----\r?\n*$/.test(data.ecparam)).to.be.true()
|
||||
var matchup = /-----BEGIN EC PRIVATE KEY-----[\s\S]+-----END EC PRIVATE KEY-----/.exec(data.ecparam)
|
||||
expect(matchup[0].trim().length).to.be.within(min + 1, max - 1)
|
||||
}
|
||||
|
||||
function checkDhparam (data, min, max) {
|
||||
expect(data).to.be.an('object').that.has.property('dhparam')
|
||||
expect(data.dhparam).to.be.a('string')
|
||||
expect(/^\r?\n*-----BEGIN DH PARAMETERS-----\r?\n/.test(data.dhparam)).to.be.true()
|
||||
expect(/\r?\n-----END DH PARAMETERS-----\r?\n*$/.test(data.dhparam)).to.be.true()
|
||||
expect(data.dhparam.trim().length).to.be.within(min + 1, max - 1)
|
||||
}
|
||||
|
||||
function checkPrivateKey (data, min, max, encrypted) {
|
||||
expect(data).to.be.an('object').that.has.property('key')
|
||||
expect(data.key).to.be.a('string')
|
||||
if (encrypted) { expect(/ENCRYPTED\r?\n/.test(data.key)).to.be.true() }
|
||||
expect(/^\r?\n*-----BEGIN RSA PRIVATE KEY-----\r?\n/.test(data.key)).to.be.true()
|
||||
expect(/\r?\n-----END RSA PRIVATE KEY-----\r?\n*$/.test(data.key)).to.be.true()
|
||||
expect(data.key.trim().length).to.be.within(min + 1, max - 1)
|
||||
}
|
||||
|
||||
function checkCSR (data, expectClientKey) {
|
||||
expect(data).to.be.an('object');
|
||||
['clientKey', 'csr'].forEach(function (k) {
|
||||
expect(data).to.have.property(k)
|
||||
expect(data[k]).to.be.a('string')
|
||||
})
|
||||
if (expectClientKey) { expect(data.clientKey).to.equal(expectClientKey) }
|
||||
expect(/^\r?\n*-----BEGIN CERTIFICATE REQUEST-----\r?\n/.test(data.csr)).to.be.true()
|
||||
expect(/\r?\n-----END CERTIFICATE REQUEST-----\r?\n*$/.test(data.csr)).to.be.true()
|
||||
}
|
||||
|
||||
function checkCertificate (data, selfsigned) {
|
||||
expect(data).to.be.an('object');
|
||||
['certificate', 'clientKey', 'serviceKey', 'csr'].forEach(function (k) {
|
||||
expect(data).to.have.property(k)
|
||||
expect(data[k]).to.be.a('string')
|
||||
})
|
||||
expect(/^\r?\n*-----BEGIN CERTIFICATE-----\r?\n/.test(data.certificate)).to.be.true()
|
||||
expect(/\r?\n-----END CERTIFICATE-----\r?\n*$/.test(data.certificate)).to.be.true()
|
||||
if (selfsigned) { expect(data.clientKey).to.equal(data.serviceKey) } else { expect(data.clientKey).to.not.equal(data.serviceKey) }
|
||||
}
|
||||
|
||||
function checkCertificateData (data, info) {
|
||||
expect(data).to.deep.equal(info)
|
||||
}
|
||||
|
||||
function checkPublicKey (data) {
|
||||
expect(data).to.be.an('object').that.has.property('publicKey')
|
||||
expect(data.publicKey).to.be.a('string')
|
||||
expect(/^\r?\n*-----BEGIN PUBLIC KEY-----\r?\n/.test(data.publicKey)).to.be.true()
|
||||
expect(/\r?\n-----END PUBLIC KEY-----\r?\n*$/.test(data.publicKey)).to.be.true()
|
||||
}
|
||||
|
||||
function checkFingerprint (data) {
|
||||
expect(data).to.be.an('object').that.has.property('fingerprint')
|
||||
expect(data.fingerprint).to.be.a('string')
|
||||
expect(/^[0-9A-F]{2}(:[0-9A-F]{2}){19}$/.test(data.fingerprint)).to.be.true()
|
||||
}
|
||||
|
||||
function checkModulus (data, encryptAlgorithm) {
|
||||
expect(data).to.be.an('object').that.has.property('modulus')
|
||||
expect(data.modulus).to.be.a('string')
|
||||
switch (encryptAlgorithm) {
|
||||
case 'md5':
|
||||
expect(/^[a-f0-9]{32}$/i.test(data.modulus)).to.be.true()
|
||||
break
|
||||
default:
|
||||
expect(/^[0-9A-F]*$/.test(data.modulus)).to.be.true()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
checkTmpEmpty: checkTmpEmpty,
|
||||
checkError: checkError,
|
||||
checkDhparam: checkDhparam,
|
||||
checkEcparam: checkEcparam,
|
||||
checkPrivateKey: checkPrivateKey,
|
||||
checkCSR: checkCSR,
|
||||
checkCertificate: checkCertificate,
|
||||
checkCertificateData: checkCertificateData,
|
||||
checkPublicKey: checkPublicKey,
|
||||
checkFingerprint: checkFingerprint,
|
||||
checkModulus: checkModulus
|
||||
}
|
||||
800
static/js/ketcher2/node_modules/pem/test/pem.spec.js
generated
vendored
Normal file
800
static/js/ketcher2/node_modules/pem/test/pem.spec.js
generated
vendored
Normal file
@ -0,0 +1,800 @@
|
||||
'use strict'
|
||||
|
||||
var pem = require('..')
|
||||
var fs = require('fs')
|
||||
var hlp = require('./pem.helper.js')
|
||||
var chai = require('chai')
|
||||
var dirtyChai = require('dirty-chai')
|
||||
var expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe('General Tests', function () {
|
||||
this.timeout(300000)// 5 minutes
|
||||
this.slow(2000)// 2 seconds
|
||||
|
||||
describe('Requirements', function () {
|
||||
it('Create tmp folder', function () {
|
||||
expect(function () {
|
||||
if (!fs.existsSync(process.env.PEMJS_TMPDIR)) {
|
||||
fs.mkdirSync(process.env.PEMJS_TMPDIR)
|
||||
}
|
||||
}).to.not.throw()
|
||||
})
|
||||
|
||||
it('Return an error if openssl was not found', function (done) {
|
||||
pem.config({
|
||||
pathOpenSSL: 'zzzzzzzzzzz'
|
||||
})
|
||||
pem.createPrivateKey(function (error) {
|
||||
hlp.checkError(error, true)
|
||||
pem.config({
|
||||
pathOpenSSL: process.env.OPENSSL_BIN || 'openssl'
|
||||
})
|
||||
pem.createPrivateKey(function (error) {
|
||||
hlp.checkError(error)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.createDhparam tests', function () {
|
||||
it('Create default sized dhparam key', function (done) {
|
||||
pem.createDhparam(function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkDhparam(data, 150, 160)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Create 1024bit dhparam key', function (done) {
|
||||
this.timeout(600000)// 10 minutes
|
||||
pem.createDhparam(1024, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkDhparam(data, 240, 250)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.createEcparam tests', function () {
|
||||
it('Create default ecparam key', function (done) {
|
||||
pem.createEcparam(function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkEcparam(data, 430, 470)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Create secp521k1 ecparam key', function (done) {
|
||||
pem.createEcparam('secp521r1', function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkEcparam(data, 960, 1000)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Create prime256v1 ecparam key', function (done) {
|
||||
pem.createEcparam('prime256v1', function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkEcparam(data, 430, 570)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.createPrivateKey tests', function () {
|
||||
describe('default sized private key', function () {
|
||||
var pkey
|
||||
it('create private key', function (done) {
|
||||
pem.createPrivateKey(function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPrivateKey(data, 850, 1900)
|
||||
hlp.checkTmpEmpty()
|
||||
pkey = data
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('get its public key', function (done) {
|
||||
pem.getPublicKey(pkey.key, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPublicKey(data)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('create csr and check key', function (done) {
|
||||
pem.createCSR({
|
||||
clientKey: pkey.key
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data, pkey.key)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('create pkcs12 w/o password', function (done) {
|
||||
pem.createCertificate({
|
||||
clientKey: pkey.key,
|
||||
selfSigned: true
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
|
||||
pem.createPkcs12(data.clientKey, data.certificate, 'mypassword', function (error, pkcs12) {
|
||||
hlp.checkError(error)
|
||||
expect(pkcs12).to.be.ok()
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('2048bit Private key', function () {
|
||||
var pwkey
|
||||
it('create private key', function (done) {
|
||||
pem.createPrivateKey(2048, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPrivateKey(data, 1650, 1710)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('create private key with password', function (done) {
|
||||
pem.createPrivateKey(2048, {
|
||||
cipher: 'aes128',
|
||||
password: 'min4chars'
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPrivateKey(data, 1700, 1800, true)
|
||||
hlp.checkTmpEmpty()
|
||||
pwkey = data
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('create csr using private key with password', function (done) {
|
||||
pem.createCSR({
|
||||
clientKey: pwkey.key,
|
||||
clientKeyPassword: 'min4chars'
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data, pwkey.key)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('create cert using pkey w/ password; create pkcs12', function (done) {
|
||||
pem.createCertificate({
|
||||
clientKey: pwkey.key,
|
||||
clientKeyPassword: 'min4chars',
|
||||
selfSigned: true
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data, true)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.createPkcs12(data.clientKey, data.certificate, 'mypassword', {
|
||||
cipher: 'aes256',
|
||||
clientKeyPassword: 'min4chars'
|
||||
}, function (error, pkcs12) {
|
||||
hlp.checkError(error)
|
||||
expect(pkcs12).to.be.ok()
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.createCSR tests', function () {
|
||||
it('Create default CSR; get its public key; read its data', function (done) {
|
||||
pem.createCSR(function (error, data1) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data1)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.getPublicKey(data1.clientKey, function (error, data2) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPublicKey(data2)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data1.csr, function (error, data3) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificateData(data3, {
|
||||
issuer: {},
|
||||
country: '',
|
||||
state: '',
|
||||
locality: '',
|
||||
organization: '',
|
||||
organizationUnit: '',
|
||||
commonName: 'localhost',
|
||||
emailAddress: '',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Create CSR using config file', function (done) {
|
||||
pem.createCSR({
|
||||
csrConfigFile: './test/fixtures/test.cnf'
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data.csr, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificateData(data, {
|
||||
issuer: {},
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: 'Node.ee',
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
emailAddress: 'andris@node.ee',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Create CSR with multiple organizations using config file', function (done) {
|
||||
pem.createCSR({
|
||||
issuer: {},
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: ['Node2.ee', 'Node.ee'],
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
emailAddress: 'andris@node.ee',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data.csr, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificateData(data, {
|
||||
issuer: {},
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: ['Node.ee', 'Node2.ee'],
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
emailAddress: 'andris@node.ee',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Read edited cert data from CSR', function (done) {
|
||||
var certInfo = {
|
||||
issuer: {},
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: 'Node.ee',
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
emailAddress: 'andris@node.ee',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
}
|
||||
pem.createCSR(Object.create(certInfo), function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCSR(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data.csr, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificateData(data, certInfo)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.createCertificate tests', function () {
|
||||
describe('Default certificate', function () {
|
||||
var cert
|
||||
it('Create default certificate', function (done) {
|
||||
pem.createCertificate(function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
cert = data
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('get its public key', function (done) {
|
||||
pem.getPublicKey(cert.clientKey, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkPublicKey(data)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('get its fingerprint', function (done) {
|
||||
pem.getFingerprint(cert.certificate, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkFingerprint(data)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('get its modulus [not hashed]', function (done) {
|
||||
pem.getModulus(cert.certificate, function (error,
|
||||
data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkModulus(data)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('get its modulus [md5 hashed]', function (done) {
|
||||
pem.getModulus(cert.certificate, null, 'md5',
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkModulus(data, 'md5')
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('read its data', function (done) {
|
||||
pem.readCertificateInfo(cert.certificate, function (
|
||||
error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial', 'signatureAlgorithm',
|
||||
'publicKeySize', 'publicKeyAlgorithm'
|
||||
].forEach(function (k) {
|
||||
if (data[k]) { delete data[k] }
|
||||
})
|
||||
hlp.checkCertificateData(data, {
|
||||
issuer: {
|
||||
country: '',
|
||||
state: '',
|
||||
locality: '',
|
||||
organization: '',
|
||||
organizationUnit: '',
|
||||
commonName: 'localhost',
|
||||
dc: ''
|
||||
},
|
||||
country: '',
|
||||
state: '',
|
||||
locality: '',
|
||||
organization: '',
|
||||
organizationUnit: '',
|
||||
commonName: 'localhost',
|
||||
emailAddress: '',
|
||||
dc: ''
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('CA certificate', function () {
|
||||
var ca
|
||||
it('create ca certificate', function (done) {
|
||||
pem.createCertificate({
|
||||
commonName: 'CA Certificate'
|
||||
},
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
ca = data
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('create certificate with text serial "demo-serial"', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: 'demo-serial'
|
||||
},
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial'].forEach(function (k) {
|
||||
if (data[k]) {
|
||||
delete data[k]
|
||||
}
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('create certificate with hex serial "0x1234567890abcdef"', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: '0x1234567890abcdef'
|
||||
},
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial'].forEach(function (k) {
|
||||
if (data[k]) {
|
||||
delete data[k]
|
||||
}
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('create certificate with hex serial "1234567890abcdef"', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: '1234567890abcdef'
|
||||
},
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial'].forEach(function (k) {
|
||||
if (data[k]) {
|
||||
delete data[k]
|
||||
}
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('create certificate with number serial "1234567890"', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: 1234567890
|
||||
},
|
||||
function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial'].forEach(function (k) {
|
||||
if (data[k]) {
|
||||
delete data[k]
|
||||
}
|
||||
})
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('verify signing chain; create and read PKCS12', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: Date.now()
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.verifySigningChain(data.certificate,
|
||||
ca.certificate,
|
||||
function (error, valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.true()
|
||||
|
||||
pem.createPkcs12(data.clientKey,
|
||||
data.certificate, '', {
|
||||
certFiles: [ca.certificate]
|
||||
},
|
||||
function (error, d) {
|
||||
hlp.checkError(error)
|
||||
expect(d).to.be.ok()
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readPkcs12(d.pkcs12,
|
||||
function (error, keystore) {
|
||||
hlp.checkError(error)
|
||||
expect(keystore).to.be.an('object')
|
||||
expect(keystore).to.have.property('ca')
|
||||
expect(keystore).to.have.property('cert')
|
||||
expect(keystore).to.have.property('key')
|
||||
expect(keystore.ca).to.be.an('array')
|
||||
expect(keystore.cert).to.be.an('string')
|
||||
expect(keystore.key).to.be.an('string')
|
||||
expect(keystore.ca[0]).to.equal(ca.certificate)
|
||||
expect(keystore.cert).to.equal(data.certificate)
|
||||
expect(keystore.key).to.equal(data.clientKey)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
it('Fail to verify invalid sigining chain', function (done) {
|
||||
pem.createCertificate({
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: Date.now()
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.verifySigningChain(data.certificate,
|
||||
data.certificate,
|
||||
function (error, valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.false()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('Verify google.com certificate without provided CA certificates', function (done) {
|
||||
var certificate = fs.readFileSync('./test/fixtures/google.com.pem').toString()
|
||||
pem.verifySigningChain(certificate, function (error, valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.false()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Verify deep sigining chain', function (done) {
|
||||
pem.createCertificate({
|
||||
commonName: 'Intermediate CA Certificate',
|
||||
serviceKey: ca.serviceKey,
|
||||
serviceCertificate: ca.certificate,
|
||||
serial: Date.now()
|
||||
}, function (error, intermediate) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(intermediate)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.createCertificate({
|
||||
serviceKey: intermediate.clientKey,
|
||||
serviceCertificate: intermediate.certificate,
|
||||
serial: Date.now()
|
||||
// days: 1024
|
||||
}, function (error, cert) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(cert)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
// chain check ok
|
||||
pem.verifySigningChain([intermediate.certificate, cert.certificate], [
|
||||
ca.certificate, intermediate.certificate
|
||||
], function (error, valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.true()
|
||||
|
||||
// chain check fails -> missing ca cert in chain
|
||||
pem.verifySigningChain(cert.certificate, [
|
||||
intermediate.certificate
|
||||
], function (error, valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.false()
|
||||
|
||||
// chain check fails -> missing intermediate cert in chain
|
||||
pem.verifySigningChain(
|
||||
cert.certificate, [
|
||||
ca.certificate
|
||||
],
|
||||
function (error,
|
||||
valid) {
|
||||
hlp.checkError(error)
|
||||
expect(valid).to.be.false()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Create self signed certificate', function (done) {
|
||||
pem.createCertificate({
|
||||
selfSigned: true
|
||||
}, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data, true)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Create and verify wildcard certificate', function (done) {
|
||||
var certInfo = {
|
||||
commonName: '*.node.ee'
|
||||
}
|
||||
pem.createCertificate(Object.create(certInfo), function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
expect(data).to.be.an('object').that.has.property('commonName')
|
||||
expect(data.commonName).to.equal(certInfo.commonName)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
it('Read edited cert data from certificate', function (done) {
|
||||
var certInfo = {
|
||||
issuer: {
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: 'Node.ee',
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
dc: ''
|
||||
},
|
||||
country: 'EE',
|
||||
state: 'Harjumaa',
|
||||
locality: 'Tallinn',
|
||||
organization: 'Node.ee',
|
||||
organizationUnit: 'test',
|
||||
commonName: 'www.node.ee',
|
||||
emailAddress: 'andris@node.ee',
|
||||
dc: '',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
publicKeyAlgorithm: 'rsaEncryption',
|
||||
publicKeySize: '2048 bit'
|
||||
}
|
||||
pem.createCertificate(Object.create(certInfo), function (error, data) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkCertificate(data)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
pem.readCertificateInfo(data.certificate, function (error, data) {
|
||||
hlp.checkError(error);
|
||||
['validity', 'serial'].forEach(function (k) {
|
||||
if (data[k]) { delete data[k] }
|
||||
})
|
||||
hlp.checkCertificateData(data, certInfo)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.checkCertificate tests', function () {
|
||||
it('Check certificate file @ ./test/fixtures/test.key', function (done) {
|
||||
var d = fs.readFileSync('./test/fixtures/test.key').toString()
|
||||
pem.checkCertificate(d, 'password', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.ok()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Check certificate file @ ./test/fixtures/test.crt', function (done) {
|
||||
var d = fs.readFileSync('./test/fixtures/test.crt').toString()
|
||||
pem.checkCertificate(d, function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.ok()
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('Check certificate file @ ./test/fixtures/test.csr', function (done) {
|
||||
var d = fs.readFileSync('./test/fixtures/test.csr').toString()
|
||||
pem.checkCertificate(d, function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.ok()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.getModulus tests', function () {
|
||||
it('Check matching modulus of key and cert file', function (done) {
|
||||
var f = fs.readFileSync('./test/fixtures/test.crt').toString()
|
||||
pem.getModulus(f, function (error, data1) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkModulus(data1)
|
||||
hlp.checkTmpEmpty()
|
||||
|
||||
f = fs.readFileSync('./test/fixtures/test.key').toString()
|
||||
pem.getModulus(f, 'password', function (error, data2) {
|
||||
hlp.checkError(error)
|
||||
hlp.checkModulus(data2)
|
||||
expect(data1.modulus).to.equal(data2.modulus)
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.getDhparamInfo tests', function () {
|
||||
it('Get DH param info', function (done) {
|
||||
var dh = fs.readFileSync('./test/fixtures/test.dh').toString()
|
||||
pem.getDhparamInfo(dh, function (error, data) {
|
||||
hlp.checkError(error)
|
||||
var size = (data && data.size) || 0
|
||||
var prime = ((data && data.prime) || '').toString()
|
||||
expect(size).to.be.a('number')
|
||||
expect(size).to.equal(1024)
|
||||
expect(prime).to.be.a('string')
|
||||
expect(/([0-9a-f][0-9a-f]:)+[0-9a-f][0-9a-f]$/g.test(prime)).to.be.true()
|
||||
hlp.checkTmpEmpty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.readPkcs12 tests', function () {
|
||||
it('Respond with ENOENT for missing PKCS12 file', function (
|
||||
done) {
|
||||
pem.readPkcs12('/i/do/not/exist.p12', function (error) {
|
||||
hlp.checkError(error, {
|
||||
code: 'ENOENT'
|
||||
})
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#.checkPkcs12 tests', function () {
|
||||
it('Check PKCS12 keystore', function (done) {
|
||||
var pkcs12 = fs.readFileSync('./test/fixtures/idsrv3test.pfx')
|
||||
pem.checkPkcs12(pkcs12, 'idsrv3test', function (error, result) {
|
||||
hlp.checkError(error)
|
||||
expect(result).to.be.ok()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user