Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unsigned BigInteger

843810May 23 2002 — edited May 27 2002
I am loading a DH prime from a byte array. The first byte is 0xe5 which, of course, implies negative. Indeed BigInteger interprets the value as negative. When I go do a keyAgreement.generateSecret(), an exception is thrown saying that the modulus must be positive. How can I load BigInteger with the byte array values being assumed to be unsigned?

java.lang.ArithmeticException: BigInteger: modulus not positive
at java.math.BigInteger.modPow(BigInteger.java:1417)
...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 24 2002
Added on May 23 2002
1 comment
433 views