CkPublicKey Java Programming
Reference Documentation

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.

Object Creation

CkPublicKey obj = new CkPublicKey();

Properties

// str is a CkString object (output)
LastErrorHtml( str )

Error information in HTML format for the last method called.

// str is a CkString object (output)
LastErrorText( str )

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

// str is a CkString object (output)
LastErrorXml( str )

Error information in XML format for the last method called.

Methods

// data is a CkByteData object (output)
// Returns a boolean value
GetOpenSslDer( data )

Gets the public key in OpenSSL DER format.

// str is a CkString object (output)
// Returns a boolean value
GetOpenSslPem( str )

Gets the public key in OpenSSL PEM format.

Returns true for success, false for failure.

// data is a CkByteData object (output)
// Returns a boolean value
GetRsaDer( data )

Gets the public key in RSA DER format.

// str is a CkString object (output)
// Returns a boolean value
GetXml( 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.

// data is a CkByteData object (output)
// Returns a boolean value
LoadOpenSslDer( data )

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

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadOpenSslDerFile( filename )

Loads a public key from an OpenSSL DER format file.

Returns true for success, false for failure.

// str is a string (input)
// Returns a boolean value
LoadOpenSslPem( str )

Loads a public key from an OpenSSL PEM string.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadOpenSslPemFile( filename )

Loads a public key from an OpenSSL PEM file.

Returns true for success, false for failure.

// str is a string (input)
// Returns a boolean value
LoadPkcs1Pem( str )

To be documented soon...

// data is a CkByteData object (output)
// Returns a boolean value
LoadRsaDer( data )

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

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadRsaDerFile( filename )

Loads a public key from an RSA DER formatted file.

Returns true for success, false for failure.

// xml is a string (input)
// Returns a boolean value
LoadXml( xml )

Loads a public key from an XML string.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadXmlFile( filename )

Loads a public key from an XML file.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
SaveLastError( filename )

Saves the last error information to an XML formatted file.

// filename is a string (input)
// Returns a boolean value
SaveOpenSslDerFile( filename )

Saves the public key to an OpenSSL DER format file.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
SaveOpenSslPemFile( filename )

Saves the public key to an OpenSSL PEM format file.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
SaveRsaDerFile( filename )

Saves the public key to an RSA DER format file.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
SaveXmlFile( filename )

Saves the public key to an XML file.

Returns true for success, false for failure.

// Returns a string
getOpenSslPem( )

Gets the public key in OpenSSL PEM format.

Returns a null on failure

// Returns a 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

// Returns a string
lastErrorHtml( )

Error information in HTML format for the last method called.

Returns a null on failure

// Returns a string
lastErrorText( )

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

Returns a null on failure

// Returns a string
lastErrorXml( )

Error information in XML format for the last method called.

Returns a null on failure