<refentry id="xmlsec-bn">
<refmeta>
<refentrytitle>bn.h</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>XMLSEC Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>bn.h</refname><refpurpose>The big numbers helper functions.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>



<link linkend="BIGNUM-CAPS">BIGNUM</link>*     <link linkend="xmlSecCryptoBinary2BN">xmlSecCryptoBinary2BN</link>           (const <link linkend="xmlChar">xmlChar</link> *str,
                                             <link linkend="BIGNUM-CAPS">BIGNUM</link> **a);
<link linkend="xmlChar">xmlChar</link>*    <link linkend="xmlSecBN2CryptoBinary">xmlSecBN2CryptoBinary</link>           (const <link linkend="BIGNUM-CAPS">BIGNUM</link> *a);
<link linkend="BIGNUM-CAPS">BIGNUM</link>*     <link linkend="xmlSecNodeGetBNValue">xmlSecNodeGetBNValue</link>            (const <link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             <link linkend="BIGNUM-CAPS">BIGNUM</link> **a);
int         <link linkend="xmlSecNodeSetBNValue">xmlSecNodeSetBNValue</link>            (<link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             const <link linkend="BIGNUM-CAPS">BIGNUM</link> *a,
                                             int addLineBreaks);
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="xmlSecCryptoBinary2BN">xmlSecCryptoBinary2BN ()</title>
<programlisting><link linkend="BIGNUM-CAPS">BIGNUM</link>*     xmlSecCryptoBinary2BN           (const <link linkend="xmlChar">xmlChar</link> *str,
                                             <link linkend="BIGNUM-CAPS">BIGNUM</link> **a);</programlisting>
<para>
Converts string from CryptoBinary format 
(http://www.w3.org/TR/xmldsig-core/<link linkend="sec-CryptoBinary">sec-CryptoBinary</link>) 
to a BIGNUM. If no BIGNUM buffer provided then a new
BIGNUM is created (caller is responsible for freeing it).</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>str</parameter>&nbsp;:</entry>
<entry> the CryptoBinary string.
</entry></row>
<row><entry align="right"><parameter>a</parameter>&nbsp;:</entry>
<entry> the buffer to store the result.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a pointer to BIGNUM produced from CryptoBinary string
or NULL if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecBN2CryptoBinary">xmlSecBN2CryptoBinary ()</title>
<programlisting><link linkend="xmlChar">xmlChar</link>*    xmlSecBN2CryptoBinary           (const <link linkend="BIGNUM-CAPS">BIGNUM</link> *a);</programlisting>
<para>
Converts BIGNUM to CryptoBinary string
(http://www.w3.org/TR/xmldsig-core/<link linkend="sec-CryptoBinary">sec-CryptoBinary</link>).</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>a</parameter>&nbsp;:</entry>
<entry> the pointer to BIGNUM.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>newly allocated string (caller is responsible for
freeing it using <link linkend="xmlFree">xmlFree</link>() function) or NULL if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeGetBNValue">xmlSecNodeGetBNValue ()</title>
<programlisting><link linkend="BIGNUM-CAPS">BIGNUM</link>*     xmlSecNodeGetBNValue            (const <link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             <link linkend="BIGNUM-CAPS">BIGNUM</link> **a);</programlisting>
<para>
Converts the node content from CryptoBinary format 
(http://www.w3.org/TR/xmldsig-core/<link linkend="sec-CryptoBinary">sec-CryptoBinary</link>) 
to a BIGNUM. If no BIGNUM buffer provided then a new
BIGNUM is created (caller is responsible for freeing it).</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cur</parameter>&nbsp;:</entry>
<entry> the poitner to an XML node.
</entry></row>
<row><entry align="right"><parameter>a</parameter>&nbsp;:</entry>
<entry> the BIGNUM buffer.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a pointer to BIGNUM produced from CryptoBinary string
or NULL if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetBNValue">xmlSecNodeSetBNValue ()</title>
<programlisting>int         xmlSecNodeSetBNValue            (<link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             const <link linkend="BIGNUM-CAPS">BIGNUM</link> *a,
                                             int addLineBreaks);</programlisting>
<para>
Converts BIGNUM to CryptoBinary string
(http://www.w3.org/TR/xmldsig-core/<link linkend="sec-CryptoBinary">sec-CryptoBinary</link>) 
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.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cur</parameter>&nbsp;:</entry>
<entry> the pointer to an XML node.
</entry></row>
<row><entry align="right"><parameter>a</parameter>&nbsp;:</entry>
<entry> the BIGNUM.
</entry></row>
<row><entry align="right"><parameter>addLineBreaks</parameter>&nbsp;:</entry>
<entry> if the flag is equal to 1 then 
	linebreaks will be added before and after
	new buffer content.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>0 on success or -1 otherwise.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
