Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Cert Class Reference

Manipulates digital certificates. More...

#include <Cert.h>

List of all members.

Public Methods

 Cert ()
 ~Cert ()
bool load (char *file)
bool verify (Cert &signed_cert)
X509 * getCert (void)

Static Public Methods

bool generateRandomCerts (char *working_dir, char *openssl_conf, char *cert, char *priv, char *priv_passwd)

Static Private Methods

bool createFile (char *file_name, char *contents)
void deleteFile (char *file_name)

Private Attributes

X509 * m_cert


Detailed Description

Manipulates digital certificates.

==========
Cert Class
==========

    Cert is a class which contains certificates.
    Cert load certificates and generates cert files at random.

========
Cert API
========

 Member Variables

    m_cert: openssl cert structure.

 Member Functions

    Cert() is a constructor.

    ~Cert() is a destructor.

    load() loads cerificates from a file.
    ex) cert.load("cert.pem");
        // cert loads certificates from "cert.pem".
    
    verify() checks if a given cert is signed with this cert.
    ex) cert1.verify(cert2);
        // return true if cert2 is signed with cert1,
        // otherwise return false.

    getCert() returns the openssl cert structure.

    generateRandomCerts() generates a cert file and a private key file.
    example:
    
        // Generate "./cert.pem" and "./priv.pem".
        //   "./cert.pem" is a generated cert file which contains certificates
        //   and its public key.
        //   "./priv.pem" is a generated private key file which contains 
        //   a public and private key pair.
        //   "./priv.pem" is encrypted with a key "testpasswd".
        //   "./openssl.cnf" is a configuration file for openssl.
        //   "/tmp" is a tmp directory where temporary files are created 
        //   and deleted. 
        Cert::generateRandomCerts("/tmp", "./openssl.cnf", 
                                  "./cert.pem", "./priv.pem", "testpasswd");
    

Definition at line 13 of file Cert.h.


Constructor & Destructor Documentation

Cert::Cert
 

Definition at line 75 of file Cert.cpp.

Cert::~Cert
 

Definition at line 81 of file Cert.cpp.


Member Function Documentation

bool Cert::createFile char * file_name,
char * contents
[static, private]
 

Create a file with initial contents.

Parameters:
file_name   file to be created
contents   the contents of the file
Returns:
true if successful, otherwise false

Definition at line 351 of file Cert.cpp.

Referenced by generateRandomCerts().

void Cert::deleteFile char * file_name [static, private]
 

Delete a file.

Parameters:
file_name   file to be deleted

Definition at line 373 of file Cert.cpp.

Referenced by generateRandomCerts().

bool Cert::generateRandomCerts char * working_dir,
char * openssl_conf,
char * client_cert,
char * client_private_key_file,
char * client_private_key_password
[static]
 

Generate random certificates.

Parameters:
working_dir   The directory where temporary files are located.
openssl_conf   The openssl configuration file to be used.
client_cert   The client certificate file to create.
client_private_key_file   The client private key file to create.
client_private_key_password   The password of the client private key file.

Returns:
true if successful, otherwise false

Definition at line 202 of file Cert.cpp.

X509 * Cert::getCert void
 

Get cert in X509 format.

Definition at line 184 of file Cert.cpp.

Referenced by Rsa::loadKey().

bool Cert::load char * file
 

Load cerficates from file.

Parameters:
file   the file containing certificates in PEM format.
Returns:
true if succeed, false otherwise.

Definition at line 96 of file Cert.cpp.

bool Cert::verify Cert & signed_cert
 

Verify if signed_cert is signed with this cert.

Parameters:
signed_cert   the certificates to be verified.
Returns:
true if succeed, false otherwise.

Definition at line 145 of file Cert.cpp.


Member Data Documentation

X509* Cert::m_cert [private]
 

Definition at line 36 of file Cert.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:31:55 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001