PTLib  Version 2.10.11
PSSLPrivateKey Class Reference

Private key for SSL. More...

#include <pssl.h>

Inheritance diagram for PSSLPrivateKey:
PObject

Public Member Functions

 PSSLPrivateKey ()
 Create an empty private key. More...
 
 PSSLPrivateKey (unsigned modulus, void(*callback)(int, int, void *)=NULL, void *cb_arg=NULL)
 Create a new RSA private key. More...
 
 PSSLPrivateKey (const PFilePath &keyFile, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Create a new private key given the file. More...
 
 PSSLPrivateKey (const BYTE *keyData, PINDEX keySize)
 Create private key from the binary ASN1 DER encoded data specified. More...
 
 PSSLPrivateKey (const PBYTEArray &keyData)
 Create private key from the binary ASN1 DER encoded data specified. More...
 
 PSSLPrivateKey (const PSSLPrivateKey &privKey)
 Create a copy of the private key. More...
 
PSSLPrivateKeyoperator= (const PSSLPrivateKey &privKay)
 Create a copy of the private key. More...
 
 ~PSSLPrivateKey ()
 Destroy and release storage for private key. More...
 
 operator evp_pkey_st * () const
 Get internal OpenSSL private key structure. More...
 
PBoolean Create (unsigned modulus, void(*callback)(int, int, void *)=NULL, void *cb_arg=NULL)
 Create a new private key. More...
 
PBYTEArray GetData () const
 Get the certificate as binary ASN1 DER encoded data. More...
 
PString AsString () const
 Get the certificate as ASN1 DER base64 encoded data. More...
 
PBoolean Load (const PFilePath &keyFile, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Load private key from file. More...
 
PBoolean Save (const PFilePath &keyFile, PBoolean append=false, PSSLFileTypes fileType=PSSLFileTypeDEFAULT)
 Save private key to file. More...
 
- Public Member Functions inherited from PObject
virtual ~PObject ()
 
virtual PObjectClone () const
 Create a copy of the class on the heap. More...
 
virtual PINDEX HashFunction () const
 This function yields a hash value required by the PDictionary class. More...
 
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance. More...
 
PBoolean IsClass (const char *cls) const
 
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class. More...
 
virtual Comparison Compare (const PObject &obj) const
 Compare the two objects and return their relative rank. More...
 
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects. More...
 
bool operator== (const PObject &obj) const
 Compare the two objects. More...
 
bool operator!= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator< (const PObject &obj) const
 Compare the two objects. More...
 
bool operator> (const PObject &obj) const
 Compare the two objects. More...
 
bool operator<= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator>= (const PObject &obj) const
 Compare the two objects. More...
 
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream. More...
 
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Protected Attributes

evp_pkey_st * key
 

Additional Inherited Members

- Public Types inherited from PObject
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
 Result of the comparison operation performed by the Compare() function. More...
 
- Static Public Member Functions inherited from PObject
static const char * Class ()
 Get the name of the class as a C string. More...
 
static Comparison InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
 Internal function caled from CompareObjectMemoryDirect() More...
 
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 

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

PSSLPrivateKey::PSSLPrivateKey ( )

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
PSSLPrivateKey::PSSLPrivateKey ( const PFilePath keyFile,
PSSLFileTypes  fileType = PSSLFileTypeDEFAULT 
)

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
PSSLPrivateKey::PSSLPrivateKey ( const PBYTEArray keyData)

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

Parameters
keyDataPrivate key data
PSSLPrivateKey::PSSLPrivateKey ( const PSSLPrivateKey privKey)

Create a copy of the private key.

PSSLPrivateKey::~PSSLPrivateKey ( )

Destroy and release storage for private key.

Member Function Documentation

PString PSSLPrivateKey::AsString ( ) const

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
PBYTEArray PSSLPrivateKey::GetData ( ) const

Get the certificate as binary ASN1 DER encoded data.

PBoolean PSSLPrivateKey::Load ( const PFilePath keyFile,
PSSLFileTypes  fileType = PSSLFileTypeDEFAULT 
)

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: