Synopsis
enum xmlSecBnFormat;
xmlSecBnPtrxmlSecBnCreate (xmlSecSize size
);
voidxmlSecBnDestroy (xmlSecBnPtr bn
);
intxmlSecBnInitialize (xmlSecBnPtr bn
,
xmlSecSize size
);
voidxmlSecBnFinalize (xmlSecBnPtr bn
);
xmlSecByte* xmlSecBnGetData (xmlSecBnPtr bn
);
intxmlSecBnSetData (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize size
);
xmlSecSize xmlSecBnGetSize (xmlSecBnPtr bn
);
voidxmlSecBnZero (xmlSecBnPtr bn
);
intxmlSecBnFromString (xmlSecBnPtr bn
,
const xmlChar *str
,
xmlSecSize base
);
xmlChar* xmlSecBnToString (xmlSecBnPtr bn
,
xmlSecSize base
);
intxmlSecBnFromHexString (xmlSecBnPtr bn
,
const xmlChar *str
);
xmlChar* xmlSecBnToHexString (xmlSecBnPtr bn
);
intxmlSecBnFromDecString (xmlSecBnPtr bn
,
const xmlChar *str
);
xmlChar* xmlSecBnToDecString (xmlSecBnPtr bn
);
intxmlSecBnMul (xmlSecBnPtr bn
,
int multiplier
);
intxmlSecBnDiv (xmlSecBnPtr bn
,
int divider
,
int *mod
);
intxmlSecBnAdd (xmlSecBnPtr bn
,
int delta
);
intxmlSecBnReverse (xmlSecBnPtr bn
);
intxmlSecBnCompare (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize dataSize
);
intxmlSecBnCompareReverse (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize dataSize
);
intxmlSecBnGetNodeValue (xmlSecBnPtr bn
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
);
intxmlSecBnSetNodeValue (xmlSecBnPtr bn
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
,
int addLineBreaks
);
intxmlSecBnBlobSetNodeValue (const xmlSecByte *data
,
xmlSecSize dataSize
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
,
int addLineBreaks
);
Details
enum xmlSecBnFormat
typedef enum {
xmlSecBnBase64,
xmlSecBnHex,
xmlSecBnDec
} xmlSecBnFormat;
The big numbers formats.
xmlSecBnCreate ()
xmlSecBnPtr xmlSecBnCreate (xmlSecSize size
);
Creates a new BN object. Caller is responsible for destroying it
by calling xmlSecBnDestroy
function.
size : |
the initial allocated BN size. |
Returns : |
the newly BN or a NULL if an error occurs. |
xmlSecBnDestroy ()
void xmlSecBnDestroy (xmlSecBnPtr bn
);
Destroys bn
object created with xmlSecBnCreate
function.
xmlSecBnInitialize ()
int xmlSecBnInitialize (xmlSecBnPtr bn
,
xmlSecSize size
);
Initializes a BN object. Caller is responsible for destroying it
by calling xmlSecBnFinalize
function.
bn : |
the pointer to BN. |
size : |
the initial allocated BN size. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnFinalize ()
void xmlSecBnFinalize (xmlSecBnPtr bn
);
Destroys bn
object created with xmlSecBnInitialize
function.
xmlSecBnGetData ()
xmlSecByte* xmlSecBnGetData (xmlSecBnPtr bn
);
Gets pointer to the binary bn
representation.
bn : |
the pointer to BN. |
Returns : |
pointer to binary BN data or NULL if an error occurs. |
xmlSecBnSetData ()
int xmlSecBnSetData (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize size
);
Sets the value of bn
to data
.
bn : |
the pointer to BN. |
data : |
the pointer to new BN binary data. |
size : |
the size of new BN data. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnGetSize ()
xmlSecSize xmlSecBnGetSize (xmlSecBnPtr bn
);
Gets the size of binary data in bn
.
xmlSecBnZero ()
void xmlSecBnZero (xmlSecBnPtr bn
);
Sets the value of bn
to zero.
xmlSecBnFromString ()
int xmlSecBnFromString (xmlSecBnPtr bn
,
const xmlChar *str
,
xmlSecSize base
);
Reads bn
from string str
assuming it has base base
.
bn : |
the pointer to BN. |
str : |
the string with BN. |
base : |
the base for str . |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnToString ()
xmlChar* xmlSecBnToString (xmlSecBnPtr bn
,
xmlSecSize base
);
Writes bn
to string with base base
. Caller is responsible for
freeing returned string with xmlFree
.
bn : |
the pointer to BN. |
base : |
the base for returned string. |
Returns : |
the string represenataion if BN or a NULL if an error occurs. |
xmlSecBnFromHexString ()
int xmlSecBnFromHexString (xmlSecBnPtr bn
,
const xmlChar *str
);
Reads bn
from hex string str
.
bn : |
the pointer to BN. |
str : |
the string with BN. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnToHexString ()
xmlChar* xmlSecBnToHexString (xmlSecBnPtr bn
);
Writes bn
to hex string. Caller is responsible for
freeing returned string with xmlFree
.
bn : |
the pointer to BN. |
Returns : |
the string represenataion if BN or a NULL if an error occurs. |
xmlSecBnFromDecString ()
int xmlSecBnFromDecString (xmlSecBnPtr bn
,
const xmlChar *str
);
Reads bn
from decimal string str
.
bn : |
the pointer to BN. |
str : |
the string with BN. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnToDecString ()
xmlChar* xmlSecBnToDecString (xmlSecBnPtr bn
);
Writes bn
to decimal string. Caller is responsible for
freeing returned string with xmlFree
.
bn : |
the pointer to BN. |
Returns : |
the string represenataion if BN or a NULL if an error occurs. |
xmlSecBnMul ()
int xmlSecBnMul (xmlSecBnPtr bn
,
int multiplier
);
Multiplies bn
with multiplier
.
xmlSecBnDiv ()
int xmlSecBnDiv (xmlSecBnPtr bn
,
int divider
,
int *mod
);
Divides bn
by divider
and places modulus into mod
.
bn : |
the pointer to BN. |
divider : |
the divider |
mod : |
the pointer for modulus result. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnAdd ()
int xmlSecBnAdd (xmlSecBnPtr bn
,
int delta
);
Adds delta
to bn
.
bn : |
the pointer to BN. |
delta : |
the delta. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnReverse ()
int xmlSecBnReverse (xmlSecBnPtr bn
);
Reverses bytes order in bn
.
bn : |
the pointer to BN. |
Returns : |
0 on success or a negative value if an error occurs. |
xmlSecBnCompare ()
int xmlSecBnCompare (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize dataSize
);
Compares the bn
with data
.
bn : |
the pointer to BN. |
data : |
the data to compare BN to. |
dataSize : |
the data size. |
Returns : |
0 if data is equal, negative value if bn is less or positive value if bn
is greater than data . |
xmlSecBnCompareReverse ()
int xmlSecBnCompareReverse (xmlSecBnPtr bn
,
const xmlSecByte *data
,
xmlSecSize dataSize
);
Compares the bn
with reverse data
.
bn : |
the pointer to BN. |
data : |
the data to compare BN to. |
dataSize : |
the data size. |
Returns : |
0 if data is equal, negative value if bn is less or positive value if bn
is greater than data . |
xmlSecBnGetNodeValue ()
int xmlSecBnGetNodeValue (xmlSecBnPtr bn
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
);
Converts the node content from format
to bn
.
bn : |
the pointer to BN. |
cur : |
the poitner to an XML node. |
format : |
the BN format. |
reverse : |
if set then reverse read buffer after reading. |
Returns : |
0 on success and a negative values if an error occurs. |
xmlSecBnSetNodeValue ()
int xmlSecBnSetNodeValue (xmlSecBnPtr bn
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
,
int addLineBreaks
);
Converts the bn
and sets it to node content.
bn : |
the pointer to BN. |
cur : |
the poitner to an XML node. |
format : |
the BN format. |
reverse : |
the flag that indicates whether to reverse the buffer before writing. |
addLineBreaks : |
the flag; it is equal to 1 then linebreaks will be added before and after new buffer content. |
Returns : |
0 on success and a negative values if an error occurs. |
xmlSecBnBlobSetNodeValue ()
int xmlSecBnBlobSetNodeValue (const xmlSecByte *data
,
xmlSecSize dataSize
,
xmlNodePtr cur
,
xmlSecBnFormat format
,
int reverse
,
int addLineBreaks
);
Converts the blob
and sets it to node content.
data : |
the pointer to BN blob. |
dataSize : |
the size of BN blob. |
cur : |
the poitner to an XML node. |
format : |
the BN format. |
reverse : |
the flag that indicates whether to reverse the buffer before writing. |
addLineBreaks : |
if the flag is equal to 1 then
linebreaks will be added before and after
new buffer content. |
Returns : |
0 on success and a negative values if an error occurs. |