Qore Programming Language Reference Manual  0.8.13
Qore::SSLPrivateKey Class Reference

This class implements a container for private key data. More...

Public Member Functions

 constructor (string pem, *string pass)
 Creates the SSLPrivateKey object from the PEM-encoded text representation of the private key passed. More...
 
 constructor (binary der)
 Creates the SSLPrivateKey object from the data argument passed. More...
 
 copy ()
 Copying objects of this class is not supported, an exception will be thrown. More...
 
int getBitLength ()
 Returns the bit length of the private key. More...
 
hash getInfo ()
 Returns a hash of all information for the private key. More...
 
string getPEM ()
 Returns a string in PEM format representing the private key. More...
 
string getType ()
 Returns a string giving the algorithm used for the private key. More...
 
int getVersion ()
 Returns a constant value of 1; do not use; only included for backwards-compatibility. More...
 

Detailed Description

This class implements a container for private key data.

Member Function Documentation

◆ constructor() [1/2]

Qore::SSLPrivateKey::constructor ( string  pem,
*string  pass 
)

Creates the SSLPrivateKey object from the PEM-encoded text representation of the private key passed.

Parameters
pemThe PEM-encoded text representation of the private key
passThe optional password or passphrase for the private key
Example:
SSLPrivateKey key(pem);
Exceptions
SSLPRIVATEKEY-CONSTRUCTOR-ERRORerror in private key data
Since
0.8.4: the deprecated functionality where the if the string passed was less than 200 bytes long, it was assumed to be a file name has been removed; the string is assumed to be the PEM-encoded private key itself

◆ constructor() [2/2]

Qore::SSLPrivateKey::constructor ( binary  der)

Creates the SSLPrivateKey object from the data argument passed.

Parameters
derThe DER-encoded binary representation of the private key
Example:
SSLPrivateKey key(der);
Exceptions
SSLPRIVATEKEY-CONSTRUCTOR-ERRORerror in private key data

◆ copy()

Qore::SSLPrivateKey::copy ( )

Copying objects of this class is not supported, an exception will be thrown.

Exceptions
SSLPRIVATEKEY-COPY-ERRORSSLPrivateKey objects cannot be copied

◆ getBitLength()

int Qore::SSLPrivateKey::getBitLength ( )

Returns the bit length of the private key.

Returns
the bit length of the private key
Code Flags:
CONSTANT
Example:
int len = key.getBitLength();

◆ getInfo()

hash Qore::SSLPrivateKey::getInfo ( )

Returns a hash of all information for the private key.

Returns
a hash of all information for the private key with the following keys:
Code Flags:
CONSTANT
Example:
hash h = key.getInfo();

◆ getPEM()

string Qore::SSLPrivateKey::getPEM ( )

Returns a string in PEM format representing the private key.

Returns
a string in PEM format representing the private key
Example:
string pem = key.getPEM();
Exceptions
SSLPRIVATEKEY-ERRORcould not create PEM string from private key data

◆ getType()

string Qore::SSLPrivateKey::getType ( )

Returns a string giving the algorithm used for the private key.

Returns
a string giving the algorithm used for the private key (ex: "RSA", "RSA2", "DSA", "DSA1", "DSA2", "DAS3", "DAS4", "DH", "unknown")
Code Flags:
CONSTANT
Example:
string str = pkey.getType();

◆ getVersion()

int Qore::SSLPrivateKey::getVersion ( )

Returns a constant value of 1; do not use; only included for backwards-compatibility.

Code Flags:
CONSTANT

The openssl library never put any usable value into the internal fields that were used to provide this information; newer versions of openssl do not expose this information at all, therefore this method now returns a constant value of 1 for backwards-compatibility.

Returns
a constant value of 1; do not use; only included for backwards-compatibility