Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Decryption


Message #1 by "Thea Burger" <theab@l...> on Tue, 23 Apr 2002 12:18:19 +0200
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1EAB1.DC7EE820
Content-Type: text/plain;
	charset="iso-8859-1"

I tried the code you mailed me. Works fine.
I would say the problem has to do with your datareader.

Have a second look at your query.

Regards

Armand

-----Original Message-----
From: Thea Burger [mailto:theab@l...]
Sent: 23 April 2002 12:18
To: ASPX_Professional
Subject: [aspx_professional] Decryption


Hi, all

I have an access database with a table that is encrypted with :
PC1 Cipher 128-bit key
(c) Alexander PUKALL 1991

This was previously used with ASP pages and a dll in vb 6 with the
encryption/decryption in.
I can't change the encryption to something else as these pages still use
this.

I took that code and put it in a class in asp.net.

There is a lot of variables that isn't valid now - tells me it isn't
declared.
I don't understand the code, so I don't know as what to declare it.

Here is one of the functions, just to give you an idea :

Private Function Decrypt80(ByVal EncryptedText, ByRef Key) As String
        Dim Plaintext As String
        Dim fois As Int32
        Dim champ1 As String
        Dim lngChamp1 As Int32
        Dim cfc As String
        Dim cfd As String
        Dim compte As Int32
        Dim d As String
        Dim e As String

        si = 0
        x1a2 = 0
        i = 0

        For fois = 1 To 10
            cle(fois) = 0
        Next fois

        champ1 = Key

        lngchamp1 = Len(champ1)

        For fois = 1 To lngchamp1
            cle(fois) = Asc(Mid(champ1, fois, 1))
        Next fois

        champ1 = EncryptedText
        lngchamp1 = Len(champ1)

        For fois = 1 To lngchamp1

            d = Asc(Mid(champ1, fois, 1))
            If (d - &H61) >= 0 Then
                d = d - &H61  ' to transform the letter to the 4 high bits
of c
                If (d >= 0) And (d <= 15) Then
                    d = d * 16
                End If
            End If
            If (fois <> lngchamp1) Then
                fois = fois + 1
            End If
            e = Asc(Mid(champ1, fois, 1))
            If (e - &H61) >= 0 Then
                e = e - &H61 ' to transform the letter to the 4 low bits of
c
                If (e >= 0) And (e <= 15) Then
                    c = d + e
                End If
            End If

            Assemble80()

            cfc = (((inter / 256) * 256) - (inter Mod 256)) / 256
            cfd = inter Mod 256

            c = c Xor (cfc Xor cfd)

            For compte = 1 To 10
                cle(compte) = cle(compte) Xor c
            Next compte

            'Was :Plaintext = Plaintext + Chr$(c)
            Plaintext = Plaintext + Chr(c)

        Next fois
        Decrypt80 = Plaintext
    End Function

c, d, e, compte, fois isn't declared.
With Chr$(c) I get : Type character '$' does not match declared data type
'Char'.
I declared most as strings just to see what happens and my code in my aspx
page looks like this:

Dim objDecrypt As New Powerweb2.Decrypt()

strBank = (objBankReader("BankName"))
txtBankName.Text = objDecrypt.Decrypt2(strBank)

The error I get : No data exists for the row/column.
On line	    : strBank = (objBankReader("BankName"))

Does anyone have any idea how I can solve this??

Thanks!!
Thea



Everything in this e-mail and any attachments relating to the official
business of Isonet ZA is proprietary to the company. It is confidential,
legally privileged and protected by law. Isonet ZA does not own and endorse
any other content. Views and opinions are those of the sender unless clearly
stated as being that of Isonet ZA. The person addressed in the e-mail is the
sole authorised recipient. Please notify the sender immediately if it has
unintentionally reached you and do not read, disclose or use the content in
any way. Isonet ZA cannot assure that the integrity of this communication
has been maintained nor that it is free of errors, virus, interception or
interference.


  Return to Index