Sample code for 30+ languages & platforms
Visual Basic 6.0

RSA Import Private Key

See more RSA Examples

Shows how to select/import a private key for RSA signing or decryption.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim privKey As New PrivateKey
Dim password As String
password = "secret"
' In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success = privKey.LoadAnyFormatFile("rsaKeys/myTestRsaPrivate.pem",password)
If (success = 0) Then
    Debug.Print privKey.LastErrorText
    Exit Sub
End If

Dim rsa As New ChilkatRsa

' Tell the RSA object to use the private key (i.e. import the private key)
success = rsa.UsePrivateKey(privKey)