|
limal-ca-mgm
|
Functions for local certificate management. More...
#include <LocalManagement.hpp>
Static Public Member Functions | |
| static void | importAsLocalCertificate (const String &pkcs12File, const String &password, const String &destinationCAsDir, const String &destinationCertFile, const String &destinationKeyFile) |
| static void | importAsLocalCertificate (const limal::ByteBuffer &pkcs12Data, const String &password, const String &destinationCAsDir, const String &destinationCertFile, const String &destinationKeyFile) |
| static void | importCommonServerCertificate (const String &pkcs12File, const String &password) |
| static void | importCommonServerCertificate (const limal::ByteBuffer &pkcs12Data, const String &password) |
| static CertificateData | getCertificate (const String &file, FormatType type) |
| static CertificateData | getCertificate (const limal::ByteBuffer &data, FormatType type) |
| static RequestData | getRequest (const String &file, FormatType type) |
| static RequestData | getRequest (const limal::ByteBuffer &data, FormatType type) |
| static CRLData | getCRL (const String &file, FormatType type) |
| static CRLData | getCRL (const limal::ByteBuffer &data, FormatType type) |
| static limal::ByteBuffer | readFile (const String &file) |
| static void | writeFile (const limal::ByteBuffer &data, const String &file, bool overwrite=true, mode_t mode=0644) |
| static limal::ByteBuffer | x509Convert (const limal::ByteBuffer &certificate, FormatType inform, FormatType outform) |
| static limal::ByteBuffer | rsaConvert (const limal::ByteBuffer &key, FormatType inform, FormatType outform, const String &inPassword, const String &outPassword, const String &algorithm="des3") |
| static limal::ByteBuffer | crlConvert (const limal::ByteBuffer &crl, FormatType inform, FormatType outform) |
| static limal::ByteBuffer | reqConvert (const limal::ByteBuffer &req, FormatType inform, FormatType outform) |
| static limal::ByteBuffer | createPKCS12 (const limal::ByteBuffer &certificate, const limal::ByteBuffer &key, const String &inPassword, const String &outPassword, const limal::ByteBuffer &caCert, const String &caPath, bool withChain=false) |
| static limal::ByteBuffer | pkcs12ToPEM (const limal::ByteBuffer &pkcs12, const String &inPassword, const String &outPassword, const String &algorithm="des3") |
Functions for local certificate management.
This class provides functions for local certificate management which are usefull on every host.
| static limal::ByteBuffer limal::ca_mgm::LocalManagement::createPKCS12 | ( | const limal::ByteBuffer & | certificate, |
| const limal::ByteBuffer & | key, | ||
| const String & | inPassword, | ||
| const String & | outPassword, | ||
| const limal::ByteBuffer & | caCert, | ||
| const String & | caPath, | ||
| bool | withChain = false |
||
| ) | [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 limal::ByteBuffer limal::ca_mgm::LocalManagement::crlConvert | ( | const limal::ByteBuffer & | crl, |
| FormatType | inform, | ||
| FormatType | outform | ||
| ) | [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 CertificateData limal::ca_mgm::LocalManagement::getCertificate | ( | const String & | file, |
| FormatType | type | ||
| ) | [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 CertificateData limal::ca_mgm::LocalManagement::getCertificate | ( | const limal::ByteBuffer & | data, |
| FormatType | type | ||
| ) | [static] |
Parse a Certificate and return the data
| data | the certificate data in PEM or DER format |
| type | the format of the certificate |
| static CRLData limal::ca_mgm::LocalManagement::getCRL | ( | const String & | file, |
| FormatType | type | ||
| ) | [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 CRLData limal::ca_mgm::LocalManagement::getCRL | ( | const limal::ByteBuffer & | data, |
| FormatType | type | ||
| ) | [static] |
Parse a CRL and return the data
| data | the CRL data in PEM or DER format |
| type | the format of the CRL |
| static RequestData limal::ca_mgm::LocalManagement::getRequest | ( | const String & | file, |
| FormatType | type | ||
| ) | [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 RequestData limal::ca_mgm::LocalManagement::getRequest | ( | const limal::ByteBuffer & | data, |
| FormatType | type | ||
| ) | [static] |
Parse a Request and return the data
| data | the request data in PEM or DER format |
| type | the format of the request |
| static void limal::ca_mgm::LocalManagement::importAsLocalCertificate | ( | const String & | pkcs12File, |
| const String & | password, | ||
| const String & | destinationCAsDir, | ||
| const String & | destinationCertFile, | ||
| const String & | destinationKeyFile | ||
| ) | [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 void limal::ca_mgm::LocalManagement::importAsLocalCertificate | ( | const limal::ByteBuffer & | pkcs12Data, |
| const String & | password, | ||
| const String & | destinationCAsDir, | ||
| const String & | destinationCertFile, | ||
| const String & | destinationKeyFile | ||
| ) | [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 void limal::ca_mgm::LocalManagement::importCommonServerCertificate | ( | const String & | pkcs12File, |
| const String & | password | ||
| ) | [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 void limal::ca_mgm::LocalManagement::importCommonServerCertificate | ( | const limal::ByteBuffer & | pkcs12Data, |
| const String & | password | ||
| ) | [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 limal::ByteBuffer limal::ca_mgm::LocalManagement::pkcs12ToPEM | ( | const limal::ByteBuffer & | pkcs12, |
| const String & | inPassword, | ||
| const String & | outPassword, | ||
| const String & | algorithm = "des3" |
||
| ) | [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 limal::ByteBuffer limal::ca_mgm::LocalManagement::readFile | ( | const String & | file | ) | [static] |
Read a file from the harddisk and return the content as ByteBuffer Object
| file | the path to the file to read |
| static limal::ByteBuffer limal::ca_mgm::LocalManagement::reqConvert | ( | const limal::ByteBuffer & | req, |
| FormatType | inform, | ||
| FormatType | outform | ||
| ) | [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 limal::ByteBuffer limal::ca_mgm::LocalManagement::rsaConvert | ( | const limal::ByteBuffer & | key, |
| FormatType | inform, | ||
| FormatType | outform, | ||
| const String & | inPassword, | ||
| const String & | outPassword, | ||
| const String & | algorithm = "des3" |
||
| ) | [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 void limal::ca_mgm::LocalManagement::writeFile | ( | const limal::ByteBuffer & | data, |
| const String & | file, | ||
| bool | overwrite = true, |
||
| mode_t | mode = 0644 |
||
| ) | [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 limal::ByteBuffer limal::ca_mgm::LocalManagement::x509Convert | ( | const limal::ByteBuffer & | certificate, |
| FormatType | inform, | ||
| FormatType | outform | ||
| ) | [static] |
Convert a certificate from PEM/DER to DER/PEM format
| certificate | the certificate in PEM or DER Format |
| inform | format of certificate |
| outform | the output format |
1.7.5.1