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)
I assume the variable secret() must be set to Nickname, but i get the mentioned error. Other ways to set the secret() var. is unknown to me. I hope that someone
in this forum can help.
thanks in advance
Arrie
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)
B4X:
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