PTLib
Version 2.14.3
|
Private key for SSL. More...
#include <pssl.h>
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... | |
PSSLPrivateKey (evp_pkey_st *privKey, bool duplicate=true) | |
PSSLPrivateKey & | operator= (const PSSLPrivateKey &privKay) |
Create a copy of the private key. More... | |
PSSLPrivateKey & | operator= (evp_pkey_st *privKay) |
~PSSLPrivateKey () | |
Destroy and release storage for private key. More... | |
operator evp_pkey_st * () const | |
Get internal OpenSSL private key structure. More... | |
void | Attach (evp_pkey_st *key) |
Set 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... | |
bool | IsValid () const |
Return true if is a valid private key. More... | |
bool | SetData (const PBYTEArray &data) |
Set the certificate as binary ASN1 DER encoded data. 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... | |
bool | Parse (const PString &keyStr) |
Set the certificate from ASN1 DER base64 encoded data. More... | |
PBoolean | Load (const PFilePath &keyFile, PSSLFileTypes fileType=PSSLFileTypeDEFAULT, const PSSLPasswordNotifier ¬ifier=PSSLPasswordNotifier()) |
Load private key from file. More... | |
PBoolean | Save (const PFilePath &keyFile, PBoolean append=false, PSSLFileTypes fileType=PSSLFileTypeDEFAULT) |
Save private key to file. More... | |
![]() | |
unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
void | SetTraceContextIdentifier (unsigned id) |
void | GetTraceContextIdentifier (PObject &obj) |
void | GetTraceContextIdentifier (PObject *obj) |
void | SetTraceContextIdentifier (const PObject &obj) |
void | SetTraceContextIdentifier (const PObject *obj) |
virtual | ~PObject () |
virtual PObject * | Clone () const |
Create a copy of the class on the heap. More... | |
template<class CLS > | |
CLS * | CloneAs () const |
As for Clone() but converts to specified type. 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... | |
__inline const PObject * | PTraceObjectInstance () const |
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 Member Functions | |
void | FreePrivateKey () |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
Protected Attributes | |
evp_pkey_st * | m_pkey |
![]() | |
unsigned | m_traceContextIdentifier |
Additional Inherited Members | |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
![]() | |
static const char * | Class () |
Get the name of the class as a C string. More... | |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
![]() |
Private key for SSL.
This class embodies a common environment for all private keys used by the PSSLContext and PSSLChannel classes.
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.
modulus | Number of bits |
callback | Progress callback function |
cb_arg | Argument 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.
keyFile | Private key file |
fileType | Type of file to read |
PSSLPrivateKey::PSSLPrivateKey | ( | const BYTE * | keyData, |
PINDEX | keySize | ||
) |
Create private key from the binary ASN1 DER encoded data specified.
keyData | Private key data |
keySize | Size of private key data |
PSSLPrivateKey::PSSLPrivateKey | ( | const PBYTEArray & | keyData | ) |
Create private key from the binary ASN1 DER encoded data specified.
keyData | Private key data |
PSSLPrivateKey::PSSLPrivateKey | ( | const PSSLPrivateKey & | privKey | ) |
Create a copy of the private key.
PSSLPrivateKey::PSSLPrivateKey | ( | evp_pkey_st * | privKey, |
bool | duplicate = true |
||
) |
PSSLPrivateKey::~PSSLPrivateKey | ( | ) |
Destroy and release storage for private key.
PString PSSLPrivateKey::AsString | ( | ) | const |
Get the certificate as ASN1 DER base64 encoded data.
void PSSLPrivateKey::Attach | ( | evp_pkey_st * | key | ) |
Set internal OpenSSL private key structure.
PBoolean PSSLPrivateKey::Create | ( | unsigned | modulus, |
void(*)(int, int, void *) | callback = NULL , |
||
void * | cb_arg = NULL |
||
) |
Create a new private key.
modulus | Number of bits |
callback | Progress callback function |
cb_arg | Argument passed to callback |
|
protected |
PBYTEArray PSSLPrivateKey::GetData | ( | ) | const |
Get the certificate as binary ASN1 DER encoded data.
|
inline |
Return true if is a valid private key.
References m_pkey.
PBoolean PSSLPrivateKey::Load | ( | const PFilePath & | keyFile, |
PSSLFileTypes | fileType = PSSLFileTypeDEFAULT , |
||
const PSSLPasswordNotifier & | notifier = PSSLPasswordNotifier() |
||
) |
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.
keyFile | Private key file |
fileType | Type of file to read |
notifier | Call back for asking of password |
|
inline |
Get internal OpenSSL private key structure.
References m_pkey.
PSSLPrivateKey& PSSLPrivateKey::operator= | ( | const PSSLPrivateKey & | privKay | ) |
Create a copy of the private key.
PSSLPrivateKey& PSSLPrivateKey::operator= | ( | evp_pkey_st * | privKay | ) |
bool PSSLPrivateKey::Parse | ( | const PString & | keyStr | ) |
Set the certificate from ASN1 DER base64 encoded data.
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.
keyFile | Private key file |
append | Append to file |
fileType | Type of file to write |
bool PSSLPrivateKey::SetData | ( | const PBYTEArray & | data | ) |
Set the certificate as binary ASN1 DER encoded data.
|
protected |
Referenced by IsValid(), and operator evp_pkey_st *().