Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
Verify Java SignatureDemonstrates how to verify a digital signature produced by Java.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% set pubKey = Server.CreateObject("Chilkat_9_5_0.PublicKey") ' Load an RSA public key from an ASN.1 DER file success = pubKey.LoadRsaDerFile("pubKey.der") If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( pubKey.LastErrorText) & "</pre>" End If ' Get the public key in XML format: pkeyXml = pubKey.GetXml() set rsa = Server.CreateObject("Chilkat_9_5_0.Rsa") ' Any string argument automatically begins the 30-day trial. success = rsa.UnlockComponent("30-day trial") If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( rsa.LastErrorText) & "</pre>" End If ' Import the public key into the RSA component: success = rsa.ImportPublicKey(pkeyXml) If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( rsa.LastErrorText) & "</pre>" End If rsa.EncodingMode = "base64" strData = "The quick brown fox jumps over the lazy dog" ' IMPORTANT: This Base64 signature will have to be updated ' with the digital signature produced by the Java code at: ' http://www.cknotes.com/?p=283 base64Sig = "VGV5A+bodHBpBwwJZdf17Bv+lkBTm/gteOf8iCgEEfNzBosZLaAB8X55BIZIkE2zKRXoMcJT+iCxsj+1hnlwJeKZ+Gya58lrHw6NWm2N0O/KyfnuEzADOM86X0xrkgdFT6SYpbZ9dWPC59NiHeEdVyjOXNJ3fBpUSQ5/5pvVWm0=" ' Verify the signature produced by the Java code at: ' http://www.cknotes.com/?p=283 ' The VerifyStringENC method hashes the input data and verifies ' the hash against the signature. success = rsa.VerifyStringENC(strData,"sha-1",base64Sig) ' Is the signature verified? If (success = 1) Then Response.Write "<pre>" & Server.HTMLEncode( "Signature Verified!") & "</pre>" Else Response.Write "<pre>" & Server.HTMLEncode( "Signature not verified!") & "</pre>" End If %> </body> </html> |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.