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

 

 

 

 

 

 

 

Create / Verify Digital Signature for a PDF

Download Chilkat Crypt ActiveX

Demonstrates how to create a detached digital signature for a PDF or any type of file.

' Creates a signature file for a PDF, and then loads the signature
' and verifies that the PDF has not been altered.
' Uses: ChilkatCrypt.dll, ChilkatCert.dll, ChilkatUtil.dll
Private Sub Command1_Click()

    Dim crypt As New ChilkatCrypt
    crypt.UnlockComponent "UnlockCode"
    
    ' Specify a string for locating the digital certificate within
    ' the well-known certificate stores.
    ' Chilkat Crypt will automatically find the certificate that
    ' matches.
    crypt.SigningCertSubject = "matt@chilkatsoft.com"
    
    ' Another way of telling Chilkat Crypt which certificate to use
    ' is to load a .cer or .p7b file...
    'Dim cert As New ChilkatCert
    'cert.LoadFromFile "myCert.cer"
    'crypt.SetSigningCertificate cert
    
    ' Create a digital signature for a PDF, and save it to a file.
    Dim sigData As CkData
    Set sigData = crypt.CreateSigFile2Obj("sample.pdf")
    fileSaved = sigData.SaveToFile("sig.dat")
    If (fileSaved = 0) Then
        MsgBox sigData.ErrorLogText
    End If
    
    ' Load the digital signature and verify that the PDF has not changed.
    Set sigData = New CkData
    fileLoaded = sigData.LoadFile("sig.dat")
    If (fileLoaded = 0) Then
        MsgBox sigData.ErrorLogText
    End If
    
    sigValid = crypt.VerifySigFile2Obj("sample.pdf", sigData)
    If (sigValid = 1) Then
        MsgBox "PDF is unaltered!" & vbCrLf & crypt.LastCertSubject
    Else
        MsgBox "PDF has been altered!"
    End If
    
End Sub

 

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