IP*Works! 2016 Node.js Edition
IP*Works! 2016 Node.js Edition
Questions / Feedback?

ExportCertificate Method

Saves the current certificate to a file.

Syntax

certmgr.exportCertificate(certFile, password, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method will save the current certificate to a file. The current certificate and its private key are saved to the file specified by CertFile in the specified format. The file contents are protected by Password.

In the Unix edition, the current certificate and its private key are saved to the file specified by PFXFile in PEM format. The private key is encrypted using the Password.

By default when ExportCertificate is called the certificate will be written as a PFX file. The format of the exported certificate may be changed by setting ExportFormat to one of the following values:

"PFX" or "PKCS12" (default) A PFX file (PKCS12).
"PEM" or "PKCS1" A PEM formatted PKCS1 private key file. Example:
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQD5/STHUd7YkN1JyoyYnUvCf+Fyx1+ZleBJxvwDcm3yaZ98bvry
...
91y8ydb3mQ9l1hZudo2sj8tHnvEgph0r7B8hMM6Qaw==
-----END RSA PRIVATE KEY-----
"PKCS8" A PEM formatted PKCS8 private key file. Example:
-----BEGIN PRIVATE KEY-----
MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAPn9JMdR3tiQ3UnK
...
HSvsHyEwzpBr
-----END PRIVATE KEY-----
"OpenSSHPrivateKey" An OpenSSH private key file. Example:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcnNh
...
AwQFBgcICQo=
-----END OPENSSH PRIVATE KEY-----
"PPK" A PuTTY private key file. Example:
PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20180822
Public-Lines: 4
AAAAB3NzaC1yc2EAAAADAQABAAAAgQCmz5j5kWUKxfwiv6J0LQ4wN9ekpeORXVaP
...
8pSSWejQ5Q==
Private-Lines: 8
AAAAgH87Sp/YcSw1dKoAZuWb0/2dKkKwMRIYEkS15caRpzAteay6WWX7l1sgBTU7
...
Oa0=
Private-MAC: d53e24f44bde8d1d3844a142fbb1fa7c88ea3585
"JWK"A JWK that contains a private key.

Note: On Linux/Unix the PFX/PKCS12 format is not supported. On Unix/Linux the default format is "PEM".

Note: ExportCertificate is not support on macOS.

If CertFile is empty the certificate will be exported to a string accessible via the ExportedCert configuration setting.

 
 
Copyright (c) 2019 /n software inc. - All rights reserved.
IP*Works! 2016 Node.js Edition - Version 16.0 [Build 7239]