SaveCertificate Method
Saves the current certificate to a file.
Syntax
int SaveCertificate(char* lpszFileName);
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> |