SaveCertificate Method
Saves the current certificate to a file.
Syntax
certmgr.saveCertificate(fileName, [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 certificate is saved in base64 (PEM) format to the file specified by FileName. If the file exists, it is overwritten.
Note: This does not include the private key. To export a certificate with the private key, use ExportCertificate.
By default when SaveCertificate is called the certificate will be written in a PEM format. The format may be changed by setting CertificateOutputFormat to one of the following values:
"PEM" (default) | A PEM formatted public certificate. Example: -----BEGIN CERTIFICATE----- MIIBkTCB+6ADAgECAgEBMA0GCSqGSIb3DQEBBQUAMA4xDDAKBgNVBAMTAzEwMDAgFw0wNzAx ... Pg49SpQ+HcUibIpum2O0hmnySH7BPGfXD8Lu -----END CERTIFICATE----- |
"SSH2PublicKey" | A SSH2 formated public key. Example: ---- BEGIN SSH2 PUBLIC KEY ---- AAAAB3NzaC1yc2EAAAADAQABAAAAgQD5/STHUd7YkN1JyoyYnUvCf+Fyx1+ZleBJxvwDcm3y ... 6bVPTODELil1PVWJDlfdwoLZZKY2ACFHzxBqaOlYv1rbd2JIYAuqGca2ow== ---- END SSH2 PUBLIC KEY ---- |
"OpenSSHPublicKey" | An OpenSSH formatted public key. Example: ssh-rsa AAAAB3NzaC1y... |
"JWK" | A JWK that contains a public key. |
"XML" | A XML file containing the public certificate. Example: <X509Data><X509Certificate>MIIBkTCB+6ADAgECAgEBMA0GCSqGSIb3DQEBBQUAMA4xDDAKBgNVBAMTAzEwMDAgFw0wNzAx ... Pg49SpQ+HcUibIpum2O0hmnySH7BPGfXD8Lu</X509Certificate></X509Data> |