I have a provided a small example here. First I create a virtualfile to store the secret data and use that virtual file to create the encrypted zip file.
That works without creating a physical secretmessage.data file.
But when extracting the file it does not work to extract it into the virtualfile by using secretfile2$. When using the actual filename the physical file will be created and the secret data is exposed.
Is there a way to extract the encrypted file content into strings without creating an unencrypted file?
Code: Select all
@REQUIRE "zip"
secretfile$ = DefineVirtualFileFromString("This\nis\nthe\nvery\nsecret\nmessage", "secretmessage.data")
zip.OpenArchive(1, "secret.zip", #MODE_WRITE)
zip.AddFile(1, secretfile$, {Encryption = #ZIP_EM_AES_128, Password = "test1234"})
zip.CloseArchive(1)
UndefineVirtualStringFile(secretfile$)
NPrint("ZIP created")
secretfile2$ = DefineVirtualFileFromString("", "secretmessage2.data")
zip.OpenArchive(1, "secret.zip")
zip.ExtractFile(1, 0, "secretmessage2.data", {Password = "test1234"})
zip.CloseArchive(1)
NPrint("File extracted")
OpenFile(1, "secretmessage2.data")
While Not Eof(1) Do NPrint(ReadLine(1))
CloseFile(1)
UndefineVirtualStringFile(secretfile2$)
WaitLeftMouse