In: Statistics and Probability
Write a program in JAVA using the BigInteger library that can be used to check a RSA signature, based on the signer's RSA public key pair. To test your program, take the following information about a message Alice signed and use the verify signature to reproduce the message Alice signed and convert it back to String format.
n = 68236588817658935156357212288430888402056854883696767622850112840388111129987
e = 65537
signature = 46612763171375975923246342580942010388414761162366281695045830390867474569531
ANSWER::
JAVA language using the BigInteger library that can be used to check a RSA signature is as follows:--
import java.security.SecureRandom;
import java.util.Random;
import java.math.BigInteger;
int bit = 1024;
Random r = new SecureRandom();
BigInteger x = BigInteger.probablePrime(bit/ 2, r);
BigInteger y = BigInteger.probablePrime(bit/ 2, r);
BigInteger a = x.multiply(y);
BigInteger c = x.subtract(BigInteger.ONE)
.multiply(y.subtract(BigInteger.ONE));
BigInteger i;
do i = new BigInteger(c.bitLength(), r);
while (i.compareTo(BigInteger.ONE) <= 0
i.compareTo(c) >= 0
!i.gcd(c).equals(BigInteger.ONE));
BigInteger j = i.modInverse(c);
BigInteger m = (“write your message:”);
BigInteger encoding = m.modPow(i, a);
BigInteger decoding = encoding.modPow(j, a);
NOTE:: I HOPE THIS ANSWER IS HELPFULL TO YOU......**PLEASE SUPPORT ME WITH YOUR RATING......
**PLEASE GIVE ME "LIKE".....ITS VERY IMPORTANT FOR,ME......PLEASE SUPPORT ME .......THANK YOU