RSA Security 5 manual BIntegerBits

Models: 5

1 376
Download 376 pages 51.16 Kb
Page 334
Image 334

B_IntegerBits

B_IntegerBits

unsigned int B_IntegerBits (

 

unsigned char *integer,

/* canonical integer */

unsigned int

integerLen

/* length in bytes */

);

 

 

 

 

 

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_IntegerBits returns the number of significant bits in integer.

3 2 4

R S A B S A F E C r y p t o - C L i b r a r y R e f e r e n c e M a n u a l

Page 334
Image 334
RSA Security 5 manual BIntegerBits