bn.h

Name

bn.h -- The big numbers helper functions.

Synopsis



BIGNUM*     xmlSecCryptoBinary2BN           (const xmlChar *str,
                                             BIGNUM **a);
xmlChar*    xmlSecBN2CryptoBinary           (const BIGNUM *a);
BIGNUM*     xmlSecNodeGetBNValue            (const xmlNodePtr cur,
                                             BIGNUM **a);
int         xmlSecNodeSetBNValue            (xmlNodePtr cur,
                                             const BIGNUM *a,
                                             int addLineBreaks);

Description

Details

xmlSecCryptoBinary2BN ()

BIGNUM*     xmlSecCryptoBinary2BN           (const xmlChar *str,
                                             BIGNUM **a);

Converts string from CryptoBinary format (http://www.w3.org/TR/xmldsig-core/sec-CryptoBinary) to a BIGNUM. If no BIGNUM buffer provided then a new BIGNUM is created (caller is responsible for freeing it).

str : the CryptoBinary string.
a : the buffer to store the result.
Returns :a pointer to BIGNUM produced from CryptoBinary string or NULL if an error occurs.


xmlSecBN2CryptoBinary ()

xmlChar*    xmlSecBN2CryptoBinary           (const BIGNUM *a);

Converts BIGNUM to CryptoBinary string (http://www.w3.org/TR/xmldsig-core/sec-CryptoBinary).

a : the pointer to BIGNUM.
Returns :newly allocated string (caller is responsible for freeing it using xmlFree() function) or NULL if an error occurs.


xmlSecNodeGetBNValue ()

BIGNUM*     xmlSecNodeGetBNValue            (const xmlNodePtr cur,
                                             BIGNUM **a);

Converts the node content from CryptoBinary format (http://www.w3.org/TR/xmldsig-core/sec-CryptoBinary) to a BIGNUM. If no BIGNUM buffer provided then a new BIGNUM is created (caller is responsible for freeing it).

cur : the poitner to an XML node.
a : the BIGNUM buffer.
Returns :a pointer to BIGNUM produced from CryptoBinary string or NULL if an error occurs.


xmlSecNodeSetBNValue ()

int         xmlSecNodeSetBNValue            (xmlNodePtr cur,
                                             const BIGNUM *a,
                                             int addLineBreaks);

Converts BIGNUM to CryptoBinary string (http://www.w3.org/TR/xmldsig-core/sec-CryptoBinary) and sets it as the content of the given node. If the addLineBreaks is set then line breaks are added before and after the CryptoBinary string.

cur : the pointer to an XML node.
a : the BIGNUM.
addLineBreaks : if the flag is equal to 1 then linebreaks will be added before and after new buffer content.
Returns :0 on success or -1 otherwise.