libcamgm
|
Functions for local certificate management. More...
#include <LocalManagement.hpp>
Static Public Member Functions | |
static void | importAsLocalCertificate (const std::string &pkcs12File, const std::string &password, const std::string &destinationCAsDir, const std::string &destinationCertFile, const std::string &destinationKeyFile) |
static void | importAsLocalCertificate (const ca_mgm::ByteBuffer &pkcs12Data, const std::string &password, const std::string &destinationCAsDir, const std::string &destinationCertFile, const std::string &destinationKeyFile) |
static void | importCommonServerCertificate (const std::string &pkcs12File, const std::string &password) |
static void | importCommonServerCertificate (const ca_mgm::ByteBuffer &pkcs12Data, const std::string &password) |
static CertificateData | getCertificate (const std::string &file, FormatType type) |
static CertificateData | getCertificate (const ca_mgm::ByteBuffer &data, FormatType type) |
static RequestData | getRequest (const std::string &file, FormatType type) |
static RequestData | getRequest (const ca_mgm::ByteBuffer &data, FormatType type) |
static CRLData | getCRL (const std::string &file, FormatType type) |
static CRLData | getCRL (const ca_mgm::ByteBuffer &data, FormatType type) |
static ca_mgm::ByteBuffer | readFile (const std::string &file) |
static void | writeFile (const ca_mgm::ByteBuffer &data, const std::string &file, bool overwrite=true, mode_t mode=0644) |
static ca_mgm::ByteBuffer | x509Convert (const ca_mgm::ByteBuffer &certificate, FormatType inform, FormatType outform) |
static ca_mgm::ByteBuffer | rsaConvert (const ca_mgm::ByteBuffer &key, FormatType inform, FormatType outform, const std::string &inPassword, const std::string &outPassword, const std::string &algorithm="des3") |
static ca_mgm::ByteBuffer | crlConvert (const ca_mgm::ByteBuffer &crl, FormatType inform, FormatType outform) |
static ca_mgm::ByteBuffer | reqConvert (const ca_mgm::ByteBuffer &req, FormatType inform, FormatType outform) |
static ca_mgm::ByteBuffer | createPKCS12 (const ca_mgm::ByteBuffer &certificate, const ca_mgm::ByteBuffer &key, const std::string &inPassword, const std::string &outPassword, const ca_mgm::ByteBuffer &caCert, const std::string &caPath, bool withChain=false) |
static ca_mgm::ByteBuffer | pkcs12ToPEM (const ca_mgm::ByteBuffer &pkcs12, const std::string &inPassword, const std::string &outPassword, const std::string &algorithm="des3") |
Functions for local certificate management.
This class provides functions for local certificate management which are usefull on every host.
|
static |
Create a PKCS12 bundle. Certificate and key has to be in PEM format.
certificate | the certificate in PEM format |
key | the private key in PEM format |
inPassword | the password of key. If key is not encrypted use "". |
outPassword | the password of the pkcs12 file (empty not allowed) |
caCert | additional certificates to include in this container |
caPath | set the path to the CA store |
withChain | include the entire certificate chain of certificate |
|
static |
Convert a CRL from PEM/DER to DER/PEM format
crl | the CRL in PEM or DER format |
inform | the format of crl |
outform | the output format |
|
static |
Parse a Certificate and return the data
file | path to the certificate file in PEM or DER format |
type | the format of the certificate |
|
static |
Parse a Certificate and return the data
data | the certificate data in PEM or DER format |
type | the format of the certificate |
|
static |
Parse a CRL and return the data
file | path to the CRL file in PEM or DER format |
type | the format of the CRL |
|
static |
Parse a CRL and return the data
data | the CRL data in PEM or DER format |
type | the format of the CRL |
|
static |
Parse a Request and return the data
file | path to the request file in PEM or DER format |
type | the format of the request |
|
static |
Parse a Request and return the data
data | the request data in PEM or DER format |
type | the format of the request |
|
static |
Import a certificate to a specific destination
pkcs12File | full path to a PKCS12 file with the certificates |
password | the password for the PKCS12 file |
destinationCAsDir | path to the directory where the CAs are stored |
destinationCertFile | the path where the certificate should be stored |
destinationKeyFile | the path where the private key should be stored |
|
static |
Import a certificate to a specific destination
pkcs12Data | PKCS12 certificate data |
password | the password for the PKCS12 file |
destinationCAsDir | path to the directory where the CAs are stored |
destinationCertFile | the path where the certificate should be stored |
destinationKeyFile | the path where the private key should be stored |
|
static |
Import a certificate as common server certificate. This function store the CAs to '/etc/ssl/certs', the certificate to '/etc/ssl/servercerts/servercert.pem' and the private key to '/etc/ssl/servercerts/serverkey.pem'.
pkcs12File | full path to a PKCS12 file with the certificates |
password | the password for the PKCS12 file |
|
static |
Import a certificate as common server certificate. This function store the CAs to '/etc/ssl/certs', the certificate to '/etc/ssl/servercerts/servercert.pem' and the private key to '/etc/ssl/servercerts/serverkey.pem'.
pkcs12Data | PKCS12 certificate data |
password | the password for the PKCS12 file |
|
static |
Extract PKCS12 to PEM
pkcs12 | the PKCS12 file |
inPassword | the password of pkcs12 |
outPassword | the new password for the private key. If outPasswort is "", the private key will not be encrypted. |
algorithm | the encryption algorithm for the key valid values are: des, des3, aes128, aes192, aes256 |
|
static |
Read a file from the harddisk and return the content as ByteBuffer Object
file | the path to the file to read |
|
static |
Convert a Request from PEM/DER to DER/PEM format
req | the Request in PEm or DER format |
inform | the format of req |
outform | the output format |
|
static |
Convert a rsa key from PEM/DER to DER/PEM. This function can also be used to set a new password or remove the encryption from the key. An encrypted key is only available if the format is PEM.
key | the key data |
inform | the format of the key data |
outform | the output format of the key |
inPassword | the password for the key data. "" == no password set. |
outPassword | the new password for the key. "" == no password for the new key. |
algorithm | the encryption algorithm for the key valid values are: des, des3, aes128, aes192, aes256 |
|
static |
Write data into a file
data | the data to write |
file | the path to the file |
overwrite | if this is true and the file exists it will be overwritten with the new data, if false it throws an exception |
mode | the file permissions for the file (only if it is new created) |
|
static |
Convert a certificate from PEM/DER to DER/PEM format
certificate | the certificate in PEM or DER str::form |
inform | format of certificate |
outform | the output format |