VB.NET Examples

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

VB.NET Examples

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

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

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

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.

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

Dim bNeedPfxImport As Boolean
bNeedPfxImport = True

Dim cert As New Chilkat.Cert()
Dim hasPrivKey As Boolean

'  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 Boolean
success = cert.LoadByCommonName("Chilkat Software, Inc.")
If (success = true) Then
    hasPrivKey = cert.HasPrivateKey()
    If (hasPrivKey = true) 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 = true) Then

    Dim pfx As New Chilkat.Pfx()

    Dim bMachineKeyset As Boolean
    bMachineKeyset = true
    Dim bLocalMachineCertStore As Boolean
    bLocalMachineCertStore = true
    Dim bExportable As Boolean
    bExportable = true
    Dim bUseWarningDialog As Boolean
    bUseWarningDialog = false

    success = pfx.ImportPfxFile("c:/pfxFiles/myPfx.pfx","myPassword",bMachineKeyset,bLocalMachineCertStore,bExportable,bUseWarningDialog)
    If (success = false) 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 = true) 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.

Mail Component · XML Parser