Quantcast

Convert cert serial number from decimal to hexadecimal

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Convert cert serial number from decimal to hexadecimal

milan tomic

I need to convert cert serial number from decimal format to hexadecimal format. I don't have access to whole certificate. I have only its serial number value in decimal representation (i.e. 1234544324). I need to convert it into representation that Firefox and IE browsers shows when you display cert details (i.e. 3A E4 B1 23). Those hex numbers should be hex dump of the DER encoding of the ASN.1 data structure that contains the
serial number, right? Does BouncyCastle library allows me to do this conversion? Which class/function should I use? In my databse I have about 70.000 serial numbers I need to convert, so algorithm should be fastest as possible.

Thank you in advance,
Milan




       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert cert serial number from decimal to hexadecimal

David Hook-4

BigInteger.toString(16) assuming they're all well formed (ie. positive).
If some of them are negative BigInteger.toByteArray() followed by
Hex.encode() taking into account the leading zero when it occurs.

Regards,

David

On Mon, 2007-06-18 at 02:12 -0700, Milan Tomic wrote:

> I need to convert cert serial number from decimal format to hexadecimal format. I don't have access to whole certificate. I have only its serial number value in decimal representation (i.e. 1234544324). I need to convert it into representation that Firefox and IE browsers shows when you display cert details (i.e. 3A E4 B1 23). Those hex numbers should be hex dump of the DER encoding of the ASN.1 data structure that contains the
> serial number, right? Does BouncyCastle library allows me to do this conversion? Which class/function should I use? In my databse I have about 70.000 serial numbers I need to convert, so algorithm should be fastest as possible.
>
> Thank you in advance,
> Milan
>
>
>
>
>        
> ____________________________________________________________________________________
> Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
> http://farechase.yahoo.com/
>
>


Loading...