limal::ca_mgm::LocalManagement Class Reference

Functions for local certificate management. More...

#include <LocalManagement.hpp>

List of all members.

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")

Detailed Description

Functions for local certificate management.

This class provides functions for local certificate management which are usefull on every host.


Member Function Documentation

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.

Parameters:
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
Returns:
the PKCS12 file
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

Parameters:
crl the CRL in PEM or DER format
inform the format of crl
outform the output format
Returns:
the converted CRL
static CertificateData limal::ca_mgm::LocalManagement::getCertificate ( const limal::ByteBuffer data,
FormatType  type 
) [static]

Parse a Certificate and return the data

Parameters:
data the certificate data in PEM or DER format
type the format of the certificate
Returns:
the parsed certificate data
static CertificateData limal::ca_mgm::LocalManagement::getCertificate ( const String file,
FormatType  type 
) [static]

Parse a Certificate and return the data

Parameters:
file path to the certificate file in PEM or DER format
type the format of the certificate
Returns:
the parsed certificate data
static CRLData limal::ca_mgm::LocalManagement::getCRL ( const limal::ByteBuffer data,
FormatType  type 
) [static]

Parse a CRL and return the data

Parameters:
data the CRL data in PEM or DER format
type the format of the CRL
Returns:
the parsed CRL data
static CRLData limal::ca_mgm::LocalManagement::getCRL ( const String file,
FormatType  type 
) [static]

Parse a CRL and return the data

Parameters:
file path to the CRL file in PEM or DER format
type the format of the CRL
Returns:
the parsed CRL data
static RequestData limal::ca_mgm::LocalManagement::getRequest ( const limal::ByteBuffer data,
FormatType  type 
) [static]

Parse a Request and return the data

Parameters:
data the request data in PEM or DER format
type the format of the request
Returns:
the parsed request data
static RequestData limal::ca_mgm::LocalManagement::getRequest ( const String file,
FormatType  type 
) [static]

Parse a Request and return the data

Parameters:
file path to the request file in PEM or DER format
type the format of the request
Returns:
the parsed request data
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

Parameters:
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::importAsLocalCertificate ( const String pkcs12File,
const String password,
const String destinationCAsDir,
const String destinationCertFile,
const String destinationKeyFile 
) [static]

Import a certificate to a specific destination

Parameters:
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::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'.

Parameters:
pkcs12Data PKCS12 certificate data
password the password for the PKCS12 file
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'.

Parameters:
pkcs12File full path to a PKCS12 file with the certificates
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

Parameters:
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
Returns:
the certificates and private key
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

Parameters:
file the path to the file to read
Returns:
the file content
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

Parameters:
req the Request in PEm or DER format
inform the format of req
outform the output format
Returns:
the converted Request
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.

Parameters:
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
Returns:
the converted key
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

Parameters:
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

Parameters:
certificate the certificate in PEM or DER Format
inform format of certificate
outform the output format
Returns:
the converted certificate in the new format

The documentation for this class was generated from the following file:
Generated on Sun Aug 1 09:44:20 2010 for limal-ca-mgm by  doxygen 1.6.3