I am writing a Java program which encrypts a given text using RSA, and saves the encrypted bytes(byte[] array) in a .txt file. There is a separate decryption program which reads these bytes. Now I want to read the same bytes into a byte[] in to the decryption program. How can this be done using Java?
BufferedReader brip = new BufferedReader(new FileReader("encrypted.txt"));
Strings CurrentLine = brip.readLine();
byte[] b = sCurrentLine.getBytes();
This is how I have been reading the data from the file. But it's wrong because it converts the bytes in sCurrentLine variable into again bytes.