CryptoSys API Library Manual

Example: Tdea.Decrypt  Tdea.Encrypt  (4)

[VB6 equivalent: TDEA_HexMode]

Dim strOutput As String
Dim strInput As String
Dim strKey As String
Dim strIV As String
Dim sCorrect As String

strInput = "5468697320736F6D652073616D706520636F6E74656E742E0808080808080808"
strKey = "737C791F25EAD0E04629254352F7DC6291E5CB26917ADA32"
strIV = "B36B6BFB6231084E"
sCorrect = "d76fd1178fbd02f84231f5c1d2a2f74a4159482964f675248254223daf9af8e4"
' Set strOutput to be same length as strInput

Console.WriteLine("KY=" & " " & strKey)
Console.WriteLine("PT=" & " " & strInput)
strOutput = Tdea.Encrypt(strInput, strKey, Mode.CBC, strIV)
Console.WriteLine("CT=" & " " & strOutput)
Console.WriteLine("OK=" & " " & sCorrect)

strInput = strOutput
strOutput = Tdea.Decrypt(strInput, strKey, Mode.CBC, strIV)
Console.WriteLine("P'=" & " " & strOutput)

See Also:
Tdea.Decrypt Method (String, String, Mode, String)
Tdea.Encrypt Method (String, String, Mode, String)

[Contents] [Index]

[PREV: Example: Tdea.FileDecrypt ...]   [Contents]   [Index]   
   [NEXT: Example: Tdea.Dispose ...]

Copyright © 2001-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-05-20T13:01:10Z.