Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
Bzip2
PPMD
Deflate
LZW


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Load PEM Public/Private Key into RSA Object

Demonstrates how to load a PEM key into the Chilkat RSA object.

Download 32-bit Chilkat RSA ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

Dim rsa As New ChilkatRsa

Dim success As Long
success = rsa.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    Text1.Text = Text1.Text & rsa.LastErrorText & vbCrLf
    Exit Sub
End If

'  First demonstrate importing a PEM public key:
Dim publicKeyPem As String
publicKeyPem = "PEM public-key data goes here"
Dim pubkey As New PublicKey

success = pubkey.LoadOpenSslPem(publicKeyPem)
If (success <> 1) Then
    Text1.Text = Text1.Text & pubkey.LastErrorText & vbCrLf
    Exit Sub
End If

Dim publicKeyXml As String
publicKeyXml = pubkey.GetXml()

success = rsa.ImportPublicKey(publicKeyXml)
If (success <> 1) Then
    Text1.Text = Text1.Text & rsa.LastErrorText & vbCrLf
    Exit Sub
End If

'  Demonstrate importing a PEM private key:
Dim privateKeyPem As String
privateKeyPem = "PEM private-key data goes here"
Dim privkey As New PrivateKey

'  If the private key PEM is protected with a password, then
'  call LoadEncryptedPem.  Otherwise call LoadPem.
success = privkey.LoadPem(privateKeyPem)
If (success <> 1) Then
    Text1.Text = Text1.Text & privkey.LastErrorText & vbCrLf
    Exit Sub
End If

Dim privateKeyXml As String
privateKeyXml = privkey.GetXml()
success = rsa.ImportPrivateKey(privateKeyXml)
If (success <> 1) Then
    Text1.Text = Text1.Text & rsa.LastErrorText & vbCrLf
    Exit Sub
End If

MsgBox "OK!"

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.