At 06:31 AM 9/12/2012, Vincent Ryan wrote:

>>Also, instead of the function trimZeroes, how about instead a
>>"static byte getMagnitude (BigInteger val, int magSize)" method which is 
>>really what you're trying to do.  Still throw the RuntimeError, but do it 
>>inside that method.  This is a method I really wish were part of BigInteger.
>


Sorry - yes, byte[].   magSize is the size of the output byte array, in bytes.  
 In encodePoint its n - the curve field size in bytes.  Basically returns the 
magSize right justified bytes of the magnitude trimming or padding zeroes as 
needed.  Throws a runtime error if the specified size is too small to contain 
the result.

This functionality is used all over PKI in about 5 different implementation 
forms - it would be nice to just do one version and stick with it.

How hard would it be to add the method to BigInteger as part of this change?

Mike






Reply via email to