Jump to content
Sign in to follow this  

Encrypt file decrypt to string [SOLVED]

Recommended Posts


Is it posible to encrypt a txt file and open it in a other program to only read it to string without saving it first.

Everyting I tryd won't give me the data in the console.

#include <Crypt.au3>

$import_file = FileOpenDialog("Encrypt file", "", "TEXT (*.txt)")
If $import_file <> "" Then
    $dir = StringTrimRight($import_file, StringLen($import_file) - StringInStr($import_file, "\", 0, -1))
    $name = StringReplace(StringTrimLeft($import_file, StringInStr($import_file, "\", 0, -1)), ".txt", "")
    _Crypt_EncryptFile($import_file, $dir & "/" & $name & ".trs", "BLA", $CALG_AES_128)

$file_handle = FileOpen($dir & "/" & $name & ".trs", 0)
$file_to_string = FileRead($file_handle)
$return_string = _Crypt_DecryptData($file_to_string, "Bla", $CALG_AES_128)
ConsoleWrite(BinaryToString($return_string) & @CRLF)


Edited by nend

Share this post

Link to post
Share on other sites

Ok I've I all ready solved it.

I've used _Crypt_EncryptData -> output to a file and than it will work.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this