Namespaces
Members
(static) convert :module:convert
quick access the convert module
Type:
Methods
(static) checkCertificate(certificate, passphraseopt, callback)
Check a certificate
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
certificate |
String | PEM encoded certificate |
|
passphrase |
String |
<optional> |
password for the certificate |
callback |
function | Callback function with an error object and a boolean valid |
(static) checkPkcs12(bufferOrPath, passphraseopt, callback)
check a PKCS#12 file (.pfx or.p12)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bufferOrPath |
Buffer | String | PKCS#12 certificate |
|
passphrase |
String |
<optional> |
optional passphrase which will be used to open the keystore |
callback |
function | Callback function with an error object and a boolean valid |
(static) config(options)
config the pem module
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
(static) createCertificate(optionsopt, callback)
Creates a certificate based on a CSR. If CSR is not defined, a new one
will be generated automatically. For CSR generation all the options values
can be used as with createCSR.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Optional options object Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
function | Callback function with an error object and {certificate, csr, clientKey, serviceKey} |
(static) createCSR(optionsopt, callback)
Creates a Certificate Signing Request
If client key is undefined, a new key is created automatically. The used key is included
in the callback return as clientKey
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Optional options object Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
function | Callback function with an error object and {csr, clientKey} |
(static) createDhparam(keyBitsizeopt, callback)
Creates a dhparam key
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keyBitsize |
Number |
<optional> |
512
|
Size of the key, defaults to 512bit |
callback |
function | Callback function with an error object and {dhparam} |
(static) createEcparam(keyNameopt, paramEncopt, noOutopt, callback)
Creates a ecparam key
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keyName |
String |
<optional> |
secp256k1
|
Name of the key, defaults to secp256k1 |
paramEnc |
String |
<optional> |
explicit
|
Encoding of the elliptic curve parameters, defaults to explicit |
noOut |
Boolean |
<optional> |
false
|
This option inhibits the output of the encoded version of the parameters. |
callback |
function | Callback function with an error object and {ecparam} |
(static) createPkcs12(key, certificate, password, optionsopt, callback)
Export private key and certificate to a PKCS12 keystore
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | PEM encoded private key |
|
certificate |
String | PEM encoded certificate |
|
password |
String | Password of the result PKCS12 file |
|
options |
Object |
<optional> |
object of cipher and optional client key password {cipher:'aes128', clientKeyPassword: 'xxxx', certFiles: ['file1','file2']} |
callback |
function | Callback function with an error object and {pkcs12} |
(static) createPrivateKey(keyBitsizeopt, optionsopt, callback)
Creates a private key
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keyBitsize |
Number |
<optional> |
2048
|
Size of the key, defaults to 2048bit |
||||||||||||
options |
Object |
<optional> |
object of cipher and password {cipher:'aes128',password:'xxx'}, defaults empty object Properties
|
|||||||||||||
callback |
function | Callback function with an error object and {key} |
(static) getDhparamInfo(dh, callback)
get the size and prime of DH parameters
Parameters:
Name | Type | Description |
---|---|---|
dh |
String | parameters PEM encoded |
callback |
function | Callback function with an error object and {size, prime} |
(static) getFingerprint(certificate, hashopt, callback)
Gets the fingerprint for a certificate
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
certificate |
String | PEM encoded certificate |
|
hash |
String |
<optional> |
hash function to use (either |
callback |
function | Callback function with an error object and {fingerprint} |
(static) getModulus(certificate, passwordopt, hashopt, callback)
get the modulus from a certificate, a CSR or a private key
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
certificate |
String | PEM encoded, CSR PEM encoded, or private key |
|
password |
String |
<optional> |
password for the certificate |
hash |
String |
<optional> |
hash function to use (up to now |
callback |
function | Callback function with an error object and {modulus} |
(static) getPublicKey(certificate, callback)
Exports a public key from a private key, CSR or certificate
Parameters:
Name | Type | Description |
---|---|---|
certificate |
String | PEM encoded private key, CSR or certificate |
callback |
function | Callback function with an error object and {publicKey} |
(static) readCertificateInfo(certificate, callback)
Reads subject data from a certificate or a CSR
Parameters:
Name | Type | Description |
---|---|---|
certificate |
String | PEM encoded CSR or certificate |
callback |
function | Callback function with an error object and {country, state, locality, organization, organizationUnit, commonName, emailAddress} |
(static) readPkcs12(bufferOrPath, optionsopt, callback)
read sslcert data from Pkcs12 file. Results are provided in callback response in object notation ({cert: .., ca:..., key:...})
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bufferOrPath |
Buffer | String | Buffer or path to file |
|
options |
Object |
<optional> |
openssl options |
callback |
function | Called with error object and sslcert bundle object |
(static) verifySigningChain(certificate, ca, callback)
Verifies the signing chain of the passed certificate
Parameters:
Name | Type | Description |
---|---|---|
certificate |
String | Array | PEM encoded certificate include intermediate certificates |
ca |
String | Array | [List] of CA certificates |
callback |
function | Callback function with an error object and a boolean valid |