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?


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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.