2

For mostly learning purposes so far, I'm attempting to generate a SHA2 Certificate using Java's keytool. However, when I generate the keys, it says that Certificate Fingerprint is SHA1, not SHA2.

keytool -genkey -alias test_sha2_rsa_key -keyalg RSA -keysize 2048 -keystore .keystore -sigalg "SHA256withRSA" 

Here is the result when I list the keys.

keytool -list Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry test_sha2_rsa_key, Jul 6, 2016, PrivateKeyEntry, Certificate fingerprint (SHA1): DD:9E:55:B7:90:9F:91:6C:68:D3:5C:24:E7:D4:45:D1:7D:8C:3A:5A 

Am I reading this wrong, or doing this wrong?

2
  • 5
    The fingerprint has nothing to do with the signature. You can have MD5, SHA1, SHA256 and if you want Whirpool and/or Skein fingerprints of a certificate signed with SHA512, and so on for all combinations. Try -list -v to see (most) details of the cert, including the sigalg. Commented Jul 7, 2016 at 0:18
  • Thank you. I'll update the question. I was wrong. and you're right. Commented Jul 7, 2016 at 1:30

1 Answer 1

6

The SHA-1 fingerprint is calculated over the binary (DER) encoded certificate. It is not contained in the certificate and is - as Dave already stipulated - not related with the signature over the tbsCertificate (the part of the certificate "to be signed"). Actually, as it is over the entire certificate, the signature algorithm reference (OID) and signature itself is also included in the fingerprint data.


Beware that fingerprinting a certificate using SHA-1 is about as safe as signing a certificate with SHA-1. It depends on how the fingerprint is used, but in principle this could introduce a vulnerability if (or when) SHA-1 is broken.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.