Chilkat C# PublicKey Class Reference

PublicKey

* 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

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

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

public string LastErrorXml {get; }

Error information in XML format for the last method called.

Methods

public byte[] GetOpenSslDer();

Gets the public key in OpenSSL DER format.

Returns a byte array.

Returns null on failure

public string GetOpenSslPem();

Gets the public key in OpenSSL PEM format.

Returns a null on failure

public byte[] GetRsaDer();

Gets the public key in RSA DER format.

Returns a byte array.

Returns null on failure

public string 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>

Returns a null on failure

public bool LoadOpenSslDer(byte[] data);

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

Returns true for success, false for failure.

public bool LoadOpenSslDerFile(string filename);

Loads a public key from an OpenSSL DER format file.

Returns true for success, false for failure.

public bool LoadOpenSslPem(string str);

Loads a public key from an OpenSSL PEM string.

Returns true for success, false for failure.

public bool LoadOpenSslPemFile(string filename);

Loads a public key from an OpenSSL PEM file.

Returns true for success, false for failure.

public bool LoadRsaDer(byte[] data);

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

Returns true for success, false for failure.

public bool LoadRsaDerFile(string filename);

Loads a public key from an RSA DER formatted file.

Returns true for success, false for failure.

public bool LoadXml(string xml);

Loads a public key from an XML string.

Returns true for success, false for failure.

public bool LoadXmlFile(string filename);

Loads a public key from an XML file.

Returns true for success, false for failure.

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public bool SaveOpenSslDerFile(string filename);

Saves the public key to an OpenSSL DER format file.

Returns true for success, false for failure.

public bool SaveOpenSslPemFile(string filename);

Saves the public key to an OpenSSL PEM format file.

Returns true for success, false for failure.

public bool SaveRsaDerFile(string filename);

Saves the public key to an RSA DER format file.

Returns true for success, false for failure.

public bool SaveXmlFile(string filename);

Saves the public key to an XML file.

Returns true for success, false for failure.