As part of one of my university assignments I've been asked to code the RSA algorithm to encrypt a user message. My encryption code is here:
BigInteger byte_message = new BigInteger(user_message.getBytes());
BigInteger encrypted_message = byte_message.modPow(public_key, modulus);
Then for the decryption my code is currently:
BigInteger cipher = new BigInteger(encrypted_message);
BigInteger decrypted_message = cipher.modPow(private_key, modulus);
The error Java is throwing at me is:
**The constructor BigInteger(BigInteger) is undefined.
1 quick fix available: Change type of 'encrypted_message' to 'byte[]'**
How do I convert the encrypted_message from bytes to BigInteger so that I can then run the modPow section of my code?
Any help is much appreciated!