You may use NIO2 for random access files. This will represent the file data with a ByteBuffer
. This is generally more efficient than using streams. The Java encryption classes happily accommodate you by supplying encryption methods on ByteBuffer
- update
and doFinal
specifically.
How to Read File and Convert to Byte
-
24-06-2023 - |
Domanda
I am currently study on AES, There are several good site explaining and giving example about AES Encryption in java such as this. Example show AES encrypt String into byte.
My question is how to convert application such as exe, txt and mp3? I understand i have to convert the application into byte before encryption can be implement but how do you achieve that?
The SO here and here explain about encrypt executable file but does not answer my question.
Soluzione 3
Altri suggerimenti
You should look into https://community.oracle.com/thread/2152253 link
Also refer How to read content of .EXE file in Java
FileInputStream reads files into byte arrays.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow