I found an answer that almost solves my problem: stack overflow
This answer demonstrates how to encode BigInteger to String and then back to BigInteger using Base64 encodings, which uses the Apache codec.
Is there any coding method / method method for String for BigInteger and then back to String? if so is anyone please explain how to use it?
String s = "hello world"; System.out.println(s); BigInteger encoded = new BigInteger( SOME ENCODING.(s)); System.out.println(encoded); String decoded = new String(SOME DECODING.(encoded)); System.out.println(decoded);
Print
hello world 830750578058989483904581244 hello world
(The result is just an example, and the hi world does not need to be decrypted for this BigInteger)
EDIT
More specific:
I am writing an RSA algorithm, and I need to convert the message to BigInteger so that I can then encrypt the message with the public key (send the message), and then decrypt the message with the private key, and then convert the number back to string.
I need a conversion method that could create the smallest BigInteger, since I planned to use the binary until I realized how ridiculous the number would be.
source share