Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create / Verify Detached Digital Signature
Visual Basic example to create a detached digital signature, and also to verify text data against a detached digital signature.
Private Sub CreateSignature_Click()
' Load a certificate from a file.
' The private key associated with the certificate must be installed
' on the computer to create a digital signature.
' You will need to modify this example to use your own digital certificate.
Dim cert As New ChilkatCert
cert.LoadFromFile "matt.cer"
Dim crypt As New ChilkatCrypt2
' Anything begins the 30-day trial
crypt.UnlockComponent "30-day trial"
crypt.SetSigningCert cert
' Create a detached digital signature, and encode the binary data
' into Base64 for display in a text box.
crypt.EncodingMode = "Base64"
Text2.Text = crypt.SignStringENC(Text1.Text)
End Sub
Private Sub VerifySignature_Click()
' To verify the digital signature, only the public-key is required.
Dim crypt As New ChilkatCrypt2
' Anything begins the 30-day trial
crypt.UnlockComponent "30-day trial"
' Tell the encryption component that the signature is base-64 encoded.
crypt.EncodingMode = "Base64"
' Returns 1 for success, 0 for failure.
valid = crypt.VerifyStringENC(Text1.Text, Text2.Text)
If (valid = 0) Then
MsgBox crypt.LastErrorText
Else
MsgBox "Signature is valid!"
End If
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.