All wodCrypt (12) wodSSH (10) wodSFTP (23) wodSSHServer (1) wodSSHTunnel (11) wodSSHpackage wodSFTPdll wodSSH.NET (10) wodSFTP.NET (24) wodFtpDLX.NET (22) wodWebServer.NET (10) wodAppUpdate (13) wodHttpDLX (8) wodFtpDLX (22) wodTelnetDLX wodFTPServer (3) wodWebServer (10) wodVPN wodXMPP (13) | All ** [Visual Basic] ** [C#] ** [VB.NET] ** Verify a string
VB code
Dim wodCrypt1 As wodCryptCom Set wodCrypt1 = New wodCryptCom Dim OriginalBlob As MemBlob Dim SignatureBlob As MemBlob Set OriginalBlob = New MemBlob Set SignatureBlob = New MemBlob 'Insert original data that we want to verify in memory blob. OriginalBlob.Text = "This is text that we want to sign" Dim pubkeyblob As New MemBlob 'Load public key in MemBlob 'You should receive the PublicKey from the owner. You cannot generate one by yourself. 'This is because the public key is derived from the owner's private key. Which only the real owner possesses. pubkeyblob.FromFile "c:\RSApublic.txt" 'Insert signed data in MemBlob. SignatureBlob.FromHex "3ef0eab202e1eb63d06499a958a1b42f22f5dbad" & _ "5cf631506628fc6e3a4ef94e9f8944fcc06933206fc99774087aa0cb62584ee286709447" & _ "a5bdf88e45f2bfcf1d7e9e5d9ad6c7c666a98a5f9f312beb8316b19c68e07bb65f40a9f2" & _ "d996a2e695ee979123494d244778fd952c5112c711ab5fe10cadfdeaa2e64b8b5dc0a4f7" 'Choice RSA or DSA key type. wodCrypt1.Type = RSA 'Use some padding for input blocks with incorrect size. wodCrypt1.Padding = PadPKCS7 'Load public key from MemBlob in wodCrypt object. wodCrypt1.SecretKey = pubkeyblob If wodCrypt1.Verify(OriginalBlob, SignatureBlob) = True Then 'If signature in correct Verify should return True. MsgBox "Signature ok!" Else MsgBox "ERROR: signature is invalid!" End If VB.NET code
Dim wodCrypt1 As WODCRYPTCOMLib.wodCryptCom wodCrypt1 = New WODCRYPTCOMLib.wodCryptCom Dim OriginalBlob As WODCRYPTCOMLib.MemBlob Dim SignatureBlob As WODCRYPTCOMLib.MemBlob OriginalBlob = New WODCRYPTCOMLib.MemBlob SignatureBlob = New WODCRYPTCOMLib.MemBlob 'Insert original data that we want to verify in memory blob. OriginalBlob.Text = "This is text that we want to sign" Dim pubkeyblob As New WODCRYPTCOMLib.MemBlob 'Load public key in MemBlob 'You should receive the PublicKey from the owner. You cannot generate one by yourself. 'This is because the public key is derived from the owner's private key. Which only the real owner possesses. pubkeyblob.FromFile("c:\RSApublic.txt") 'Insert signed data in MemBlob. SignatureBlob.FromHex("3ef0eab202e1eb63d06499a958a1b42f22f5dbad" & _ "5cf631506628fc6e3a4ef94e9f8944fcc06933206fc99774087aa0cb62584ee286709447" & _ "a5bdf88e45f2bfcf1d7e9e5d9ad6c7c666a98a5f9f312beb8316b19c68e07bb65f40a9f2" & _ "d996a2e695ee979123494d244778fd952c5112c711ab5fe10cadfdeaa2e64b8b5dc0a4f7") 'Choice RSA or DSA key type. wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.RSA 'Use some padding for input blocks with incorrect size. wodCrypt1.Padding = WODCRYPTCOMLib.CryptoPadding.PadPKCS7 'Load public key from MemBlob in wodCrypt object. wodCrypt1.SecretKey = pubkeyblob If wodCrypt1.Verify(OriginalBlob, SignatureBlob) = True Then 'If signature in correct Verify should return True. MsgBox("Signature ok!") Else MsgBox("ERROR: signature is invalid!") End If C# code
WODCRYPTCOMLib.wodCryptCom wodCrypt1; wodCrypt1 = new WODCRYPTCOMLib.wodCryptCom(); WODCRYPTCOMLib.MemBlob OriginalBlob; WODCRYPTCOMLib.MemBlob SignatureBlob; OriginalBlob = new WODCRYPTCOMLib.MemBlob(); SignatureBlob = new WODCRYPTCOMLib.MemBlob(); //Insert original data that we want to verify in memory blob. OriginalBlob.Text = "This is text that we want to sign"; WODCRYPTCOMLib.MemBlob pubkeyblob = new WODCRYPTCOMLib.MemBlob(); //Load public key in MemBlob //You should receive the PublicKey from the owner. You cannot generate one by yourself. //This is because the public key is derived from the owner's private key. Which only the real owner possesses. pubkeyblob.FromFile("c:\\RSApublic.txt"); //Insert signed data in MemBlob. SignatureBlob.FromHex("3ef0eab202e1eb63d06499a958a1b42f22f5dbad" + "5cf631506628fc6e3a4ef94e9f8944fcc06933206fc99774087aa0cb62584ee286709447" + "a5bdf88e45f2bfcf1d7e9e5d9ad6c7c666a98a5f9f312beb8316b19c68e07bb65f40a9f2" + "d996a2e695ee979123494d244778fd952c5112c711ab5fe10cadfdeaa2e64b8b5dc0a4f7"); //Choice RSA or DSA key type. wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.RSA; //Use some padding for input blocks with incorrect size. wodCrypt1.Padding = WODCRYPTCOMLib.CryptoPadding.PadPKCS7; //Load public key from MemBlob in wodCrypt object. wodCrypt1.SecretKey = pubkeyblob; if (wodCrypt1.Verify((WODCRYPTCOMLib.Blob)OriginalBlob, (WODCRYPTCOMLib.Blob)SignatureBlob) == true) { //If signature in correct Verify should return True. MessageBox.Show("Signature ok!"); } else { MessageBox.Show("ERROR: signature is invalid!"); } |