CkPublicKey C++ Class Reference (Visual C++)

CkPublicKey

* This is a freeware class/component/library.

Represents an RSA public key. Provides methods for importing and exporting to/from OpenSSL DER and PEM formats, RSA DER format, and XML format. Public keys can be imported/exported to both memory and files.

Properties

void LastErrorHtml(CkString &str);

Error information in HTML format for the last method called.

void LastErrorText(CkString &str);

Error information in plain-text format for the last method called.

void LastErrorXml(CkString &str);

Error information in XML format for the last method called.

bool get_Utf8(void) const;
void put_Utf8(bool b);

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

Methods

bool GetOpenSslDer(CkByteData & data);

Gets the public key in OpenSSL DER format.

The DER bytes are written to the CkByteData output-only argument.

bool GetOpenSslPem(CkString & str);

Gets the public key in OpenSSL PEM format.

Returns true for success, false for failure.

bool GetRsaDer(CkByteData & data);

Gets the public key in RSA DER format.

The DER bytes are written to the CkByteData output-only argument.

bool GetXml(CkString & str);

Gets the public key in XML format. The XML has this format where the key parts are base64 encoded:

<RSAKeyValue>
  <Modulus>...</Modulus>
  <Exponent>...</Exponent>
</RSAKeyValue>

Returns true for success, false for failure.

bool LoadOpenSslDer(CkByteData & data);

Loads a public key from in-memory OpenSSL DER formatted byte data.

Returns true for success, false for failure.

bool LoadOpenSslDerFile(const char * filename);

Loads a public key from an OpenSSL DER format file.

Returns true for success, false for failure.

bool LoadOpenSslPem(const char * str);

Loads a public key from an OpenSSL PEM string.

Returns true for success, false for failure.

bool LoadOpenSslPemFile(const char * filename);

Loads a public key from an OpenSSL PEM file.

Returns true for success, false for failure.

bool LoadRsaDer(CkByteData & data);

Loads a public key from in-memory RSA DER formatted byte data.

Returns true for success, false for failure.

bool LoadRsaDerFile(const char * filename);

Loads a public key from an RSA DER formatted file.

Returns true for success, false for failure.

bool LoadXml(const char * xml);

Loads a public key from an XML string.

Returns true for success, false for failure.

bool LoadXmlFile(const char * filename);

Loads a public key from an XML file.

Returns true for success, false for failure.

bool SaveLastError(const char * filename);

Saves the last error information to an XML formatted file.

bool SaveOpenSslDerFile(const char * filename);

Saves the public key to an OpenSSL DER format file.

Returns true for success, false for failure.

bool SaveOpenSslPemFile(const char * filename);

Saves the public key to an OpenSSL PEM format file.

Returns true for success, false for failure.

bool SaveRsaDerFile(const char * filename);

Saves the public key to an RSA DER format file.

Returns true for success, false for failure.

bool SaveXmlFile(const char * filename);

Saves the public key to an XML file.

Returns true for success, false for failure.

const char * getOpenSslPem();

Gets the public key in OpenSSL PEM format.

const char * getXml();

Gets the public key in XML format. The XML has this format where the key parts are base64 encoded:

<RSAKeyValue>
  <Modulus>...</Modulus>
  <Exponent>...</Exponent>
</RSAKeyValue>

const char * lastErrorHtml();

Error information in HTML format for the last method called.

The "const char *" returned by this method will be overwritten or become invalid when other methods returning "const char *" are called. The calling application should copy the returned string to a safe place immediately.

const char * lastErrorText();

Error information in plain-text format for the last method called.

The "const char *" returned by this method will be overwritten or become invalid when other methods returning "const char *" are called. The calling application should copy the returned string to a safe place immediately.

const char * lastErrorXml();

Error information in XML format for the last method called.

The "const char *" returned by this method will be overwritten or become invalid when other methods returning "const char *" are called. The calling application should copy the returned string to a safe place immediately.