解密加密文件并在Java中执行 [英] Decrypting an encrypted file and executing in Java
问题描述
这是它的工作原理(简化):
- 首先,我读取文件并将其转换为字节数组
- 然后我加密字节数组并将其写回文件
当我想要运行加密文件时,我做的相反,就像这样:
- 我读取加密文件并将其转换为字节数组
- 然后我解密字节数组并将其写回文件。
所以文件被转换回原来的形式。
我的问题是,我不想将解密的字节数组作为文件写入磁盘。
通过运行它,我的意思是执行它,因为它是一个Win32可执行命令。
提前感谢
Onur
我会说你的选择在这里是有限的,因为你依赖Windows开始这个过程。 Java是跨平台的,可能无法以您想要的方式挂接到Windows中。
在纯Java领域之外,您可以创建一个ramdisk,并将EXE写入Ramdisk,或者跨桥到.NET,如这个答案(和答案内的问题链接)。
I am currently working on a project where i can encrypt and decrypt files. I am developing it in Java.
This is how it works (simplified):
- First I read the file and convert it to a byte array
- Then I encrypt the byte array and write it back to a file
When I want to run the encrypted file, I do the opposite, so like this:
- I read encrypted file and convert it to byte array
- Then I decrypt the byte array and write it back to a file.
So the file is converted back to its original form.
My problem is, I do not want to write the decrypted byte array as a file to the disk.
Is there a way to do this? I want to run the decrypted byte array directly in memory. By "running" it, I mean executing it, because it is a Win32 executable crypter.
Thanks in advance, Onur
I'd say that your options are limited here, because you are dependent on Windows starting the process. Java, being cross-platform, probably doesn't have the ability to hook into Windows in the way you want.
Straying outside the realms of pure Java, you could create a ramdisk and write the EXE to the Ramdisk, or perhaps bridge across to .NET, as described in this answer (and question links inside that answer).
这篇关于解密加密文件并在Java中执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!