(vb.net)
Código:
Dim DATOS As New DESCryptoServiceProvider 'CREO EL OBJETO QUE ME PROPORCIONA UNA KEY Y UNA IV
Dim KEYSTRING As String
Dim Key As Byte() = DATOS.Key 'GUARDO EN UNA VARIABLE, LA KEY GENERADA AL AZAR
KEYSTRING = uni.GetString(Key)'TRANSFORMO ESA KEY A STRING
MsgBox(KEYSTRING) 'MUESTRO LA KEY, Y SON COMO SIMBOLOS CHINOS :P (TODO BIEN)
'AHORA GRABO LA KEY EN UN ARCHIVO
Dim FF% = FreeFile()
FileOpen(FF, "C:\prueba.kkk", OpenMode.Append)
PrintLine(FF, KEYSTRING)
FileClose(FF)
'AHORA LEO LA KEY DEL MISMO ARCHIVO
Dim FFa% = FreeFile()
FileOpen(FF, "C:\prueba.kkk", OpenMode.Input)
Dim keyleida$ = ""
Do While Not EOF(FF)
keyleida = LineInput(FF)
Loop
FileClose(FFa)
MsgBox(keyleida) 'AHORA MUESTRO LA KEY LEIDA Y LO QUE LEYÓ ES: "????"
' AHORA CHEQUEO SI SON IGUALES...
If KEYSTRING <> keyleida Then
MsgBox("Son Distintas")
Else
MsgBox("Son iguales")
End If
Obviamente que da error.. dice que son distintas...
Entro al archivo, y lo que grabó es: ????
en vez de grabar esas key rara..
Es como que al momento de grabar... esta grabando mal.....
Alguien me sugiere algo????
Algun otro metodo para grabar?