PublicKey ActiveX 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.

Object Creation

(Visual Basic 6.0)
Dim obj As New PublicKey
(ASP)
set obj = Server.CreateObject("Chilkat.PublicKey")
(VBScript)
set obj = CreateObject("Chilkat.PublicKey")
(Delphi)
obj := TPublicKey.Create(Self);
(FoxPro)
loObject = CreateObject('Chilkat.PublicKey')
(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.PublicKey', @obj OUT
(Javascript)
var obj = new ActiveXObject("Chilkat.PublicKey");

Properties

LastErrorHtml As String (read-only)

Error information in HTML format for the last method called.

LastErrorText As String (read-only)

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

LastErrorXml As String (read-only)

Error information in XML format for the last method called.

Methods

GetOpenSslDer() As Variant

Gets the public key in OpenSSL DER format.

Returns a Variant containing a byte array.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

GetOpenSslPem() As String

Gets the public key in OpenSSL PEM format.

Returns a null on failure

GetRsaDer() As Variant

Gets the public key in RSA DER format.

Returns a Variant containing a byte array.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

GetXml() As String

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

LoadOpenSslDer(derData As Variant) As Long

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

Returns 1 for success, 0 for failure.

LoadOpenSslDerFile(filename As String) As Long

Loads a public key from an OpenSSL DER format file.

Returns 1 for success, 0 for failure.

LoadOpenSslPem(pemStr As String) As Long

Loads a public key from an OpenSSL PEM string.

Returns 1 for success, 0 for failure.

LoadOpenSslPemFile(filename As String) As Long

Loads a public key from an OpenSSL PEM file.

Returns 1 for success, 0 for failure.

LoadPkcs1Pem(str As String) As Long

To be documented soon...

LoadRsaDer(derData As Variant) As Long

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

Returns 1 for success, 0 for failure.

LoadRsaDerFile(filename As String) As Long

Loads a public key from an RSA DER formatted file.

Returns 1 for success, 0 for failure.

LoadXml(xml As String) As Long

Loads a public key from an XML string.

Returns 1 for success, 0 for failure.

LoadXmlFile(filename As String) As Long

Loads a public key from an XML file.

Returns 1 for success, 0 for failure.

SaveLastError(filename As String) As Long

Saves the last error information to an XML formatted file.

SaveOpenSslDerFile(filename As String) As Long

Saves the public key to an OpenSSL DER format file.

Returns 1 for success, 0 for failure.

SaveOpenSslPemFile(filename As String) As Long

Saves the public key to an OpenSSL PEM format file.

Returns 1 for success, 0 for failure.

SaveRsaDerFile(filename As String) As Long

Saves the public key to an RSA DER format file.

Returns 1 for success, 0 for failure.

SaveXmlFile(filename As String) As Long

Saves the public key to an XML file.

Returns 1 for success, 0 for failure.