DES.DESEncrypt and DES.DESDecrypt

Oct 25, 2009 at 5:16 AM

See by experimenting with the DES.DESEncrypt and DES.DESDecrypt, and could not get the expected result, which may be wrong,

as code below:

Imports System
Imports System.Text
Imports System.Collections.Generic
Imports ThalesSim.Core.Cryptography
Public Class Form1
   Private Sub btnProcessa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcessa.Click
      Dim sResult As String = DES.DESEncrypt(txtKey.Text, txtPassWord.Text)
      TextBox1.Text = sResult
      Dim sResult2 As String = DES.DESDecrypt(txtKey.Text, sResult)
      TextBox2.Text = sResult2
   End Sub
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      txtPassWord.Text = "5537"
      txtKey.Text = "C44CEF2502C475E5"
   End Sub
End Class

Password = 5537 = FIELD txtPassword.Text
Key = C44CEF2502C475E5 = FIELD txtKey.Text

Result Program = 72269DA743B42C3B

But should have the result: 57DB18B4AFDE4855

  Even with the above error this Encrypt and Decrypt, but the outcome is appearing like this:

  5537000000000000, how to remove the zeros from the right.

 

Coordinator
Oct 25, 2009 at 5:07 PM

The DESEncrypt and DESDecrypt methods use hex key inputs for both the key and the data. That means that using "5537" as a password is incorrect - you need to use an 8-byte (16-hex) key.

Oct 26, 2009 at 12:40 AM

nickntg

     The password 5537 she is right, because the client uses the FK - Form from Key Components - command, and the password crypto 57DB18B4AFDE4855 would be that he used the key to the cryptographic C44C EF25 02C4 75E5 where even went to check the Key check value 90 B3 4B.
     And to perform the above process he used
  
Key Length = 1 - Single length
Key Type = 001
Key Scheme = Z - Single Length key encrypted using Ansi x9.17 methods
Key Component Type = X - Clear XOR
Key Number of Components 3
               
    If you have any error in this process please let me know what is the password for the cryptographic information below:

Key Length = 1 - Single length
Key Type = 001
Key Scheme = Z - Single Length key encrypted using Ansi x9.17 methods
Key Component Type = X - Clear XOR
Key Number of Components 3

Password Original 5537 with no cryptographic key used 57DB18B4AFDE4855 crypto C44C EF25 02C4 75E5, see what would be the correct password crypto.
  If you can send me an example so you can test would be ideal because on that basis could see where I'm missing, or how to do it correctly.

Coordinator
Oct 26, 2009 at 10:57 PM

Let's continue this discussion on the other thread only.