Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I have problems to understand what the difference between the Serial Number of a certificate and its SHA1 Hash is.

the MSDN says:

Serial number A number that uniquely identifies the certificate and is issued by the certification authority.

so i can identify a certificate by its serial number right?

Wikipedia says for the Hash:

Thumbprint: The hash itself, used as an abbreviated form of the public key certificate.

So the Hash identifies the (e.g. RSA) key.

I currently do some research on Android App-Certificates and I found some interessting certificates:

[Issuer][Serial][SHA1 Hash][Valid From]
[C=US, L=Mountain View, S=California, O=Android, OU=Android, CN=Android, E=android@android.com][00936EACBE07F201DF][BB84DE3EC423DDDE90C08AB3C5A828692089493C][Sun, 29 Feb 2008 01:33:46 GMT]
[C=US, L=Mountain View, S=California, O=Android, OU=Android, CN=Android, E=android@android.com][00936EACBE07F201DF][6B44B6CC0B66A28AE444DA37E3DFC1E70A462EFA][Sun, 29 Feb 2008 01:33:46 GMT]
[C=US, L=Mountain View, S=California, O=Android, OU=Android, CN=Android, E=android@android.com][00936EACBE07F201DF][0B4BE1DB3AB39C9C3E861AEC1348110062D3BC1B][Sun, 29 

and there are a lot more which share the same serial but have different hashes.

So there can be a certificate with different key? Who is actually creating the serial number when creating a certificate for an android app? For the Hash its clear, but can i create a new certificate with the same serial number as another cert?

or: can i be sure that a certificate with the same serial number was created by the same person?

share|improve this question

1 Answer 1

up vote 16 down vote accepted

In a certificate, the serial number is chosen by the CA which issued the certificate. It is just written in the certificate. The CA can choose the serial number in any way as it sees fit, not necessarily randomly (and it has to fit in 20 bytes). A CA is supposed to choose unique serial numbers, that is, unique for the CA. You cannot count on a serial number being unique worldwide; in the dream world of X.509, it is the pair issuerDN+serial which is unique worldwide (each CA having its own unique distinguished name, and taking care not to reuse serial numbers).

The thumbprint is a hash value computed over the complete certificate, which includes all its fields, including the signature. That one is unique worldwide, for a given certificate, up to the inherent collision resistance of the used hash function. Microsoft software tends to use SHA-1, for which some theoretical weaknesses are known, but no actual collision has been produced (yet).

(The thumbprints you show appear to consist of 40 hexadecimal characters, i.e. 160 bits, which again points at SHA-1 as the plausibly used hash function.)

share|improve this answer
    
Do you know is max length of thumbprint determined by any standard? Is 40 chars enough to allocate in database column? –  Michael Freidgeim Jun 21 '13 at 22:38
    
@MichaelFreidgeim The maximum length depends on the hashing algorithm. Each hash has a different length output. Look at the Output Size in the table here. Bear in mind that if you text-encode your hash output, you'll have to accommodate the encoding overhead in your database field. –  tylerl Jun 22 '13 at 7:31
    
When you say the thumbprint includes the complete certificate, does that include the serial number too? Or just the public key portion? –  Brain2000 Oct 24 '13 at 20:23
    
Complete means complete. The whole certificate, from the first to the last bit. This includes everything: public key, name, serial, extensions, signature... –  Thomas Pornin Oct 25 '13 at 0:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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