PrivateKey ActiveX Reference
PrivateKey
* This is a freeware class/component/library.
Represents an RSA private key. Provides methods for importing and exporting to/from PEM, DER, PKCS8, PVK, and XML formats. Private keys can be imported/exported to both memory and files.
Object Creation
(Visual Basic 6.0)
Dim obj As New PrivateKey
(ASP)
set obj = Server.CreateObject("Chilkat.PrivateKey")
(VBScript)
set obj = CreateObject("Chilkat.PrivateKey")
(Delphi)
obj := TPrivateKey.Create(Self);
(FoxPro)
loObject = CreateObject('Chilkat.PrivateKey')
(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.PrivateKey', @obj OUT
(Javascript)
var obj = new ActiveXObject("Chilkat.PrivateKey");
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
GetPkcs8() As Variant
Gets the private key in PKCS8 format. Returns a Variant containing a byte array. Returns a zero-length byte array (as a Variant) on failure
GetPkcs8Encrypted(password As String) As Variant
Writes the private key to password-protected PKCS8 format. Returns a zero-length byte array (as a Variant) on failure
GetPkcs8EncryptedPem(password As String) As String
Writes the private key to password-protected PKCS8 PEM format. Returns a null on failure
GetPkcs8Pem() As String
Gets the private key in PKCS8 PEM format. Returns a null on failure
GetRsaDer() As Variant
Gets the private key in RSA DER format. Returns a Variant containing a byte array. Returns a zero-length byte array (as a Variant) on failure
GetRsaPem() As String
Gets the private key in RSA PEM format. Returns a null on failure
GetXml() As String
Returns the private key in XML format. The private key is returned unencrypted and the parts are base64 encoded. The XML has this structure:
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>...</Exponent>
<P>...</P>
<Q>...</Q>
<DP>...</DP>
<DQ>...</DQ>
<InverseQ>...</InverseQ>
<D>...</D>
</RSAKeyValue>
Returns a null on failure
LoadEncryptedPem(pemStr As String, password As String) As Long
Loads the private key from an in-memory encrypted PEM string. Returns 1 for success, 0 for failure.
LoadEncryptedPemFile(filename As String, password As String) As Long
Loads a private key from an encrypted PEM file. Returns 1 for success, 0 for failure.
LoadPem(str As String) As Long
Loads the private key from an in-memory PEM string. Returns 1 for success, 0 for failure.
LoadPemFile(filename As String) As Long
Loads a private key from a PEM file. Returns 1 for success, 0 for failure.
LoadPkcs8(pkcs8Data As Variant) As Long
Loads a private key from in-memory PKCS8 byte data. Returns 1 for success, 0 for failure.
LoadPkcs8Encrypted(data As Variant, password As String) As Long
Loads a private key from in-memory password-protected PKCS8 byte data. Returns 1 for success, 0 for failure.
LoadPkcs8EncryptedFile(filename As String, password As String) As Long
Loads a private key from a password-protected PKCS8 file. Returns 1 for success, 0 for failure.
LoadPkcs8File(filename As String) As Long
Loads a private key from a PKCS8 file. Returns 1 for success, 0 for failure.
LoadPvk(pvkData As Variant, password As String) As Long
Loads a private key from in-memory PVK byte data. Returns 1 for success, 0 for failure.
LoadPvkFile(filename As String, password As String) As Long
Loads a private key from a PVK format file. Returns 1 for success, 0 for failure.
LoadRsaDer(derData As Variant) As Long
Loads a private key from in-memory RSA DER byte data. Returns 1 for success, 0 for failure.
LoadRsaDerFile(filename As String) As Long
Loads a private key from an RSA DER format file. Returns 1 for success, 0 for failure.
LoadXml(xmlDoc As String) As Long
Loads a private key from an in-memory XML string. Returns 1 for success, 0 for failure.
LoadXmlFile(filename As String) As Long
Loads a private 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.
SavePkcs8EncryptedFile(password As String, filename As String) As Long
Saves the private key to a password-protected PKCS8 format file. Returns 1 for success, 0 for failure.
SavePkcs8EncryptedPemFile(password As String, filename As String) As Long
Saves the private key to a password-protected PKCS8 PEM format file. Returns 1 for success, 0 for failure.
SavePkcs8File(filename As String) As Long
Saves the private key to a PKCS8 format file. Returns 1 for success, 0 for failure.
SavePkcs8PemFile(filename As String) As Long
Saves the private key to a PKCS8 PEM format file. Returns 1 for success, 0 for failure.
SaveRsaDerFile(filename As String) As Long
Saves the private key to a RSA DER format file. Returns 1 for success, 0 for failure.
SaveRsaPemFile(filename As String) As Long
Saves the private key to a RSA PEM format file. Returns 1 for success, 0 for failure.
SaveXmlFile(filename As String) As Long
Saves the private key to an XML file. Returns 1 for success, 0 for failure.
|