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

 

 

 

 

 

 

 

Auto-Install PFX within Windows Service

Demonstrates how to load a PFX from a Windows Service so that the private key is available for signing and decrypting. The certificate is loaded into the Local Machine Certificate Store once. After that, it should always be available.

Dim bNeedPfxImport As Long
bNeedPfxImport = True

Dim cert As New ChilkatCert
Dim hasPrivKey As Long

'  The LoadByCommonName method searches the registry-based
'  Windows Current User Certificate Store and Local Machine Certificate
'  Store for a certificate whose common name (CN) matches
'  the argument:
Dim success As Long
success = cert.LoadByCommonName("Chilkat Software, Inc.")
If (success = 1) Then
    hasPrivKey = cert.HasPrivateKey()
    If (hasPrivKey = 1) Then
        '  Certificate is available and has a private key that is accessible.
        bNeedPfxImport = False
    End If

End If

'  Do we need to load the PFX and import?
If (bNeedPfxImport = 1) Then

    Dim pfx As New ChilkatPfx

    Dim bMachineKeyset As Long
    bMachineKeyset = 1
    Dim bLocalMachineCertStore As Long
    bLocalMachineCertStore = 1
    Dim bExportable As Long
    bExportable = 1
    Dim bUseWarningDialog As Long
    bUseWarningDialog = 0

    success = pfx.ImportPfxFile("c:/pfxFiles/myPfx.pfx","myPassword",bMachineKeyset,bLocalMachineCertStore,bExportable,bUseWarningDialog)
    If (success = 0) Then
        '  Failed to import the PFX.

    Else

        '  The certificate(s) within the PFX have been installed.
        '  Now try loading again...
        success = cert.LoadByCommonName("Chilkat Software, Inc.")
        If (success = 1) Then

            hasPrivKey = cert.HasPrivateKey()
            '  We should have access to the private key now...

        End If

    End If

End If

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