CryptoSys PKI Toolkit Manual

Example: Rsa.KeyBits  Rsa.ReadEncPrivateKey  Rsa.ToXMLString  Rsa.XmlOptions 

[VB6 equivalent: RSA_ToXMLString]

Dim strEPKFile As String
Dim strPassword As String
Dim strPrivateKey As String
Dim strXML As String

strEPKFile = "AlicePrivRSASign.epk"
strPassword = "password"

' Read in the deciphered private key string in our internal format
strPrivateKey = Rsa.ReadEncPrivateKey(strEPKFile, strPassword).ToString()
If strPrivateKey.Length = 0 Then
    Console.WriteLine("Unable to retrieve private key")
    Exit Sub
End If
Console.WriteLine("Key size=" & Rsa.KeyBits(strPrivateKey) & " bits")

' Convert to XML
strXML = Rsa.ToXMLString(strPrivateKey, Rsa.XmlOptions.ForceRSAKeyValue)
Console.WriteLine("XML=" & strXML)

See Also:
Rsa.ToXMLString Method

[Contents] [Index]

[HOME]   [NEXT: Example: Tdea.Decrypt ...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.