4

Serial numbers need to be unique for X.509 certs. But do they need to be strictly sequential or is making them equal to the time that the cert was generated sufficient?

4

They do not have to be sequential. Furthermore, there are some issues with using predictable serial numbers, as described in this post:

https://crypto.stackexchange.com/questions/257/unpredictability-of-x-509-serial-numbers

  • That kinda makes me wonder what the integer length should be. Normally integers are 32-bits but in the case of X.509 / ASN.1 the sky is the limit. Heck - you have the integer type used for RSA keys with 2048-bit "integers". – neubert Jul 16 '15 at 6:20
  • 1
    When using unpredictable serial number, there is a danger of collisions. The integers should be large enough to reduce the chance of collisions. One person in the post that I linked in my answer is suggesting 128 or 160 bits, but thatch just a suggestion. There is no official recommendation. It probably also depends on how many certificates you plan to generate. – stanko Jul 16 '15 at 6:51
  • 1
    There is an official recommendation: for backward compatibility with some deployed implementations, the serial number encoded value should fit in 20 bytes -- thus you can use integers up to 2^159 (DER encoding of an INTEGER is signed, so there must be room for a sign bit). – Tom Leek Jul 19 '15 at 11:19
3

Just look at CA/Browser Forum Baseline Requirements v1.3.0, 7.1. Certificate Profile:

CAs SHOULD generate non‐sequential Certificate serial numbers that exhibit at least 20 bits of entropy.

and you will know the answer.

2

I am looking at the specification and it states that it has to be UNIQUE. It doesn't state it should be sequential or otherwise. Also the value is an "integer".

4.1.2.2 Serial number

The serial number is an integer assigned by the CA to each
certificate. It MUST be unique for each certificate issued by a
given CA (i.e., the issuer name and serial number identify a unique
certificate).

Edit,

  • I agree with @pineappleman - while the specs don't spell it out - it makes sense to not have predictability in the serial numbers.
  • Also an issue with timestamp is you will have to somehow ensure that 2 Certs requested at the same time do not get the same serial number.

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.