![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all,
in the 1st application a textbox must be filled with a nickname this nickname is encrypted and stored in a .csv file, no problem with this part. in the 2nd application the .csv file is loaded in a table. The encrypted nickname must be decrypted but i get an error that the arraylen(secret()) is 0 (zero) Code:
Sub Globals '1st app
'Declare the global variables here.
..
..
bit.New1
crypto.New1
Dim string(0) As Byte, secret(0) As Byte
PassPhrase = "schoen"
..
End Sub
Sub Encrypt_Save
..
string() = Bit.StringToBytes(Nickname,0,StrLength(Nickname)) 'Convert the string to an array of bytes.
secret() = Crypto.Encrypt(PassPhrase, string()) 'Save the encrypted data.
For i = 0 To ArrayLen(secret())-1 'Show the encrypted data in the TextBox
s = s & bit.DecToHex(secret(i))
Next
Nickname = s
s = ""
..
end sub
Sub Globals '2nd application
'Declare the global variables here.
..
..
Dim string(0) As Byte
Dim secret(0) As Byte
Crypto.New1
Bit.New1
PassPhrase = "schoen"
..
End Sub
Sub Decrypt
..
Nickname = TabelDeelnemers.Cell("Nickname",2)
..
secret() = Nickname
..
If ArrayLen(secret()) = 0 Then Return
string() = Crypto.Decrypt(PassPhrase,secret()) 'Decrypt the data.
Nickname_Decrypted = Bit.BytesToString(string(),0,ArrayLen(string())) 'Convert the array to a string.
..
End sub
in this forum can help. thanks in advance Arrie |
|
|||
|
i'm using now :
Secret() = Bit.BytesToString(Nickname,0,ArrayLen(Nickname)) string() = Crypto.Decrypt(PassPhrase,Secret()) 'Decrypt the data. Nickname_2 = Bit.BytesToString(string(),0,ArrayLen(string())) 'Convert the array to a string. But still an error (in dutch) "de objectverwijzing is niet op een exemplaar van een object ingesteld", (in english it must be something like this) "The objectreference is not on a valid object" |
|
||||
|
Were those decryptions that I gave correct or not? They looked like they might be, especially test4 with an inital capital letter and what seems a sensible name. What are you doing that is different
Code:
Sub Button29_Click 'Printen gegevens deelnemers
Naam = Listbox38.Item(Listbox38.SelectedIndex)
Aantal = TabelDeelnemers.RowCount
For Teller = 1 To Aantal -1
If TabelDeelnemers.Cell("naam", Teller) = Naam Then
Nickname = TabelDeelnemers.Cell("Bijnaam",Teller) 'Bijnaam is dutch for Nickname
End If
Next
Dim Secret(StrLength(Nickname)/2) As byte
For i = 0 To ArrayLen(Secret()) - 1
Secret(i) = Bit.HexToDec(SubString(Nickname, i*2, 2))
Next
string() = Crypto.Decrypt(PassPhrase,secret()) 'Decrypt the data.
Nickname_2 = Bit.BytesToString(string(),0,ArrayLen(string())) 'Convert the array to a string.
Msgbox(Nickname_2)
End Sub
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Decrypt | Big JR | Questions & Help Needed | 8 | 06-30-2007 08:36 PM |
| Trying to encrypt a file transer | mwaite | Questions & Help Needed | 8 | 06-05-2007 06:02 PM |
| Encrypt / Decrypt a complete file | Erel | Code Samples & Tips | 3 | 06-05-2007 05:20 PM |