Hi Michael,
[X509 serial number; converting long decimals to hex]
> Yes, but (char *) can handle it now.
>
>> If we change RETVAL to char *, does it mean that we shouldn't use
>> sprintf in crypto-utils.lib?
>
> The "problem" is that OpenSSL returns decimal encoded serial numbers. I
> use sprintf %llX to convert decimal numbers to hexadecimal numbers. If
> you know how we can convert without %X then we can solve the complete
> issue. Actually I don't know a replacement for %X.
How about GMP (for C) or Math::Bigint::GMP (which uses GMP when
installed and falls back to pure Perl if it isn't):
C:
#include "gmp.h"
mpz_t t;
mpz_init (t);
mpz_set_str (t, "01234567890123456789", 0);
mpz_out_str (stdout, 16, t);
Perl:
use Math::BigInt lib => 'GMP';
$serial = Math::BigInt->new("01234567890123456789");
print $serial->as_hex();
Martin
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
OpenCA-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openca-devel