UA Server SDK C++ Bundle  1.4.1.271
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
UaPkiRsaKeyPair Class Reference

UaPkiRsaKeyPair. More...

#include <uapkirsakeypair.h>

Public Member Functions

 UaPkiRsaKeyPair ()
 Constructs an empty keypair. More...
 
 UaPkiRsaKeyPair (int bits)
 Constructs a key pair with given key size. More...
 
 ~UaPkiRsaKeyPair ()
 destruction
 
 UaPkiRsaKeyPair (const UaPkiRsaKeyPair &copy)
 construction More...
 
UaPkiPrivateKey privateKey () const
 Returns the private key part of this key pair. More...
 
UaPkiPublicKey publicKey () const
 Returns the public key part of this key pair. More...
 
int toPEMFile (const char *szFileName, const char *szPassword) const
 Stores the key pair into a PEM encoded file. More...
 
int toPEMFile (const UaString &sFileName, const char *szPassword) const
 Stores the key pair into a PEM encoded file. More...
 
UaByteArray toDER () const
 Converts the key pair to DER format. More...
 

Static Public Member Functions

static UaPkiRsaKeyPair fromPEMFile (const char *szFileName, const char *szPassword, fcnPassword_callback *pCallback=0, void *pCBData=0)
 Loads a key pair from a PEM encoded file. More...
 
static UaPkiRsaKeyPair fromPEMFile (const UaString &sFileName, const char *szPassword, fcnPassword_callback *pCallback=0, void *pCBData=0)
 Loads a key pair from a PEM encoded file. More...
 
static bool checkKeyPair (const UaPkiPublicKey &publicKey, const UaPkiPrivateKey &privateKey)
 Checks if a public key matches a private key. More...
 

Detailed Description

Constructor & Destructor Documentation

UaPkiRsaKeyPair::UaPkiRsaKeyPair ( )

Constructs an empty keypair.

UaPkiRsaKeyPair::UaPkiRsaKeyPair ( int  bits)

Constructs a key pair with given key size.

Parameters
bitsRSA modulus (key size) which should be 1024, 2048 or 4096.
UaPkiRsaKeyPair::UaPkiRsaKeyPair ( const UaPkiRsaKeyPair copy)

construction

Parameters
copyan existing UaPkiRsaKeyPair structure.

Member Function Documentation

bool UaPkiRsaKeyPair::checkKeyPair ( const UaPkiPublicKey publicKey,
const UaPkiPrivateKey privateKey 
)
static

Checks if a public key matches a private key.

Returns
True if the keys match, false otherwise.
UaPkiRsaKeyPair UaPkiRsaKeyPair::fromPEMFile ( const char *  szFileName,
const char *  szPassword,
fcnPassword_callback *  pCallback = 0,
void *  pCBData = 0 
)
static

Loads a key pair from a PEM encoded file.

Returns
The new key pair. If the file could not be loaded the returned key pair will be empty. Use isValid() to check this.
Parameters
[in]szFileNameThe filename locale 8bit encoded.
[in]szPasswordSpecify the password of the PEM file, or 0 if the file is not protected.
[in]pCallbackA callback handle
[out]pCBDataThe data from the PEM file
UaPkiRsaKeyPair UaPkiRsaKeyPair::fromPEMFile ( const UaString sFileName,
const char *  szPassword,
fcnPassword_callback *  pCallback = 0,
void *  pCBData = 0 
)
static

Loads a key pair from a PEM encoded file.

Returns
The new key pair. If the file could not be loaded the returned key pair will be empty. Use isValid() to check this.
Parameters
[in]sFileNameThe filename UTF8 encoded.
[in]szPasswordSpecify the password of the PEM file, or 0 if the file is not protected.
[in]pCallbackA callback handle
[out]pCBDataThe data from the PEM file
UaPkiPrivateKey UaPkiRsaKeyPair::privateKey ( ) const

Returns the private key part of this key pair.

UaPkiPublicKey UaPkiRsaKeyPair::publicKey ( ) const

Returns the public key part of this key pair.

UaByteArray UaPkiRsaKeyPair::toDER ( ) const

Converts the key pair to DER format.

Returns
DER encoded byte array.
int UaPkiRsaKeyPair::toPEMFile ( const char *  szFileName,
const char *  szPassword 
) const

Stores the key pair into a PEM encoded file.

Returns
This functions returns zero on success.
Parameters
[in]szFileNameThe filename locale 8bit encoded.
[in]szPasswordSpecify a password to protect the PEM file, or 0 if the file should be unprotected.
int UaPkiRsaKeyPair::toPEMFile ( const UaString sFileName,
const char *  szPassword 
) const

Stores the key pair into a PEM encoded file.

Returns
This functions returns zero on success.
Parameters
[in]sFileNameThe filename UTF8 encoded.
[in]szPasswordSpecify a password to protect the PEM file, or 0 if the file should be unprotected.

The documentation for this class was generated from the following files: