When I run the openssl command

openssl x509 -noout -text -in certname

on different certs, on some I get a serial number which looks like this.

Serial Number: 256 (0x100)

On others, I get one which looks like this

Serial Number:

The certificates I create using openssl command line always look like the first one. What do I need to do to create a cert using openssl command line where the serial number looks like the second?

1 Answer 1


This is just a representation choice for presentation purposes. If it's short enough, it will be displayed both in decimal and in hexadecimal. You just need to use a longer serial number for it to appear in the second format (0x100 would be equivalent to 01:00).

The length threshold to switch to the second representation seems to be size(long) (usually 4 bytes).

  • stupid openssl has no notion of consistency
    – wick
    Commented Oct 17, 2022 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .