How to pass BigInteger to a Signature function

2019-04-17 10:09发布

问题:

Here I'm implementing digital signature using RSA. I read a plain text from a file and get MD5 i.e instance of a MessageDigest of the plain text and converting that plain text to BigInteger here this bigInteger should be signed.

MessageDigest m1 = MessageDigest.getInstance("MD5");

m1.update(bFile);

byte [] digest1 = m1.digest();

for(int i=0; i < digest1.length ; i++){
    System.out.println("b["+i+"]="+digest1[i]);
}

BigInteger bi = new BigInteger(digest1);

//here I dont know how to pass BigInteger to Signature function.

Could someone please help me with it.

回答1:

You don't. You get the bytes out of the BigInteger and you pass those.