RSA Security 5 Projection Television User Manual


 
B_IntegerBits
324 RSA BSAFE Crypto-C Library Reference Manual
B_IntegerBits
Description
B_IntegerBits returns the number of significant bits in an arbitrary-length integer,
where
integer
points to an unsigned byte array, most significant byte, first and
integerLen
gives its length. Leading zeroes are ignored. The integer is considered
unsigned; that is, the most-significant bit is counted and is not considered a sign bit. If
integerLen
is zero,
integer
is ignored and B_IntegerBits returns zero. A typical
application uses
B_IntegerBits to determine the key size in bits of an RSA key by
passing in the modulus.
This routine can be used to examine the value of a large integer such as the ones
returned by
B_GetKeyInfo for KI's like KI_RSAPublic.
Return value
B_Integer Bits
returns the number of significant bits in
integer
.
unsigned int B_Integ erBit s (
unsigned char *integer, /* canonical integer */
unsigned int integerLen /* length in bytes */
);