PTLib  Version 2.10.4
PSSLPrivateKey Class Reference

Private key for SSL. More...

#include <pssl.h>

Inheritance diagram for PSSLPrivateKey:
PObject

List of all members.

Public Member Functions

 PSSLPrivateKey ()
 Create an empty private key.
 PSSLPrivateKey (unsigned modulus, void(*callback)(int, int, void *)=NULL, void *cb_arg=NULL)
 Create a new RSA private key.
 PSSLPrivateKey (const PFilePath &keyFile, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Create a new private key given the file.
 PSSLPrivateKey (const BYTE *keyData, PINDEX keySize)
 Create private key from the binary ASN1 DER encoded data specified.
 PSSLPrivateKey (const PBYTEArray &keyData)
 Create private key from the binary ASN1 DER encoded data specified.
 PSSLPrivateKey (const PSSLPrivateKey &privKey)
 Create a copy of the private key.
PSSLPrivateKeyoperator= (const PSSLPrivateKey &privKay)
 Create a copy of the private key.
 ~PSSLPrivateKey ()
 Destroy and release storage for private key.
 operator evp_pkey_st * () const
 Get internal OpenSSL private key structure.
PBoolean Create (unsigned modulus, void(*callback)(int, int, void *)=NULL, void *cb_arg=NULL)
 Create a new private key.
PBYTEArray GetData () const
 Get the certificate as binary ASN1 DER encoded data.
PString AsString () const
 Get the certificate as ASN1 DER base64 encoded data.
PBoolean Load (const PFilePath &keyFile, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Load private key from file.
PBoolean Save (const PFilePath &keyFile, PBoolean append=false, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Save private key to file.

Protected Attributes

evp_pkey_st * key

Detailed Description

Private key for SSL.

This class embodies a common environment for all private keys used by the PSSLContext and PSSLChannel classes.


Constructor & Destructor Documentation

Create an empty private key.

PSSLPrivateKey::PSSLPrivateKey ( unsigned  modulus,
void(*)(int, int, void *)  callback = NULL,
void *  cb_arg = NULL 
)

Create a new RSA private key.

Parameters:
modulusNumber of bits
callbackProgress callback function
cb_argArgument passed to callback

Create a new private key given the file.

The type of the private key can be specified explicitly, or if PSSLFileTypeDEFAULT it will be determined from the file extension, ".pem" is a text file, anything else eg ".der" is a binary ASN1 file.

Parameters:
keyFilePrivate key file
fileTypeType of file to read
PSSLPrivateKey::PSSLPrivateKey ( const BYTE *  keyData,
PINDEX  keySize 
)

Create private key from the binary ASN1 DER encoded data specified.

Parameters:
keyDataPrivate key data
keySizeSize of private key data

Create private key from the binary ASN1 DER encoded data specified.

Parameters:
keyDataPrivate key data

Create a copy of the private key.

Destroy and release storage for private key.


Member Function Documentation

Get the certificate as ASN1 DER base64 encoded data.

PBoolean PSSLPrivateKey::Create ( unsigned  modulus,
void(*)(int, int, void *)  callback = NULL,
void *  cb_arg = NULL 
)

Create a new private key.

Parameters:
modulusNumber of bits
callbackProgress callback function
cb_argArgument passed to callback

Get the certificate as binary ASN1 DER encoded data.

Load private key from file.

The type of the private key can be specified explicitly, or if PSSLFileTypeDEFAULT it will be determined from the file extension, ".pem" is a text file, anything else eg ".der" is a binary ASN1 file.

Parameters:
keyFilePrivate key file
fileTypeType of file to read
PSSLPrivateKey::operator evp_pkey_st * ( ) const [inline]

Get internal OpenSSL private key structure.

References key.

PSSLPrivateKey& PSSLPrivateKey::operator= ( const PSSLPrivateKey privKay)

Create a copy of the private key.

PBoolean PSSLPrivateKey::Save ( const PFilePath keyFile,
PBoolean  append = false,
PSSLFileTypes  fileType = PSSLFileTypeDEFAULT 
)

Save private key to file.

The type of the private key can be specified explicitly, or if PSSLFileTypeDEFAULT it will be determined from the file extension, ".pem" is a text file, anything else eg ".der" is a binary ASN1 file.

Parameters:
keyFilePrivate key file
appendAppend to file
fileTypeType of file to write

Member Data Documentation

evp_pkey_st* PSSLPrivateKey::key [protected]

Referenced by operator evp_pkey_st *().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines