20
$\begingroup$

What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"?

enter image description here

Edit:

I'm creating the X.509 cert with PHP 5.2. When I change the 'digest_alg' to 'md5', both properties of the Microsoft Cert Tool changes to md5. So, as mentioned in one answer below, it seems to be an issue/invention of the Microsoft Cert Tool.

Change to md5:

           $configs = array(
                            'config'             => 'test.cnf',
                            'digest_alg'         => 'md5',
                            'x509_extensions'    => 'v3_ca',
                            'req_extensions'     => 'v3_req',
                            'private_key_bits'   => 2048,
                            'private_key_type'   => OPENSSL_KEYTYPE_RSA,
                            'encrypt_key'        =>
                        );

Result:

enter image description here

$\endgroup$

2 Answers 2

12
$\begingroup$

This has more to do with how Microsoft decided to implemented their certificate inspection GUI, than about the actual fields of the certificate. Most signature algorithm identifiers present in contemporary certificates specify both the public key algorithm (RSA in this case) and the digest algorithm (SHA-1 in this case). The identifier "sha1RSA" is most likely inaccurate in so far that Microsoft has decided to use it for an identifier that is known as sha1WithRSAEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 5 } in the standard.

The only semi-common standard signature algorithm I am aware of that actually separates the public key algorithm identifier from the digest algorithm identifier in the signature algorithm identifier of certificates, is PKCS#1 v2 RSASSA-PSS.

Edit:

Consequently, Microsoft follows conventions and the X.509 specification by letting "signature algorithm" mean a combination of a signature public key algorithm and signature hash algorithm, but, firstly, the identifiers they use for these combinations are non standard, and, secondly, adding a signature hash algorithm field is in most cases superfluous and doesn't usually reflect the actual X.509 format.

$\endgroup$
4
  • 2
    $\begingroup$ Thanks for your answer. I've edited my question. It really seems to be a Microsoft thing. $\endgroup$
    – HomeCoder
    Mar 9, 2012 at 15:35
  • 3
    $\begingroup$ That means: In real world there is only a "digest algorithm" (which is used to create a hash of the cert) and a "public key algorithm" (which is used to create a signature out of the mentioned hash). Please correct if wrong. $\endgroup$
    – HomeCoder
    Mar 9, 2012 at 15:40
  • $\begingroup$ If you were to look at a certificate signed by a CA with AlternateSignatureAlgorithm enabled (Windows CA setting) you would see that the Signature hash algorithm would be sha1 or sha256 etc, while the Signature algorithm would be RSASSA-PSS. As @mfrankli states below, one is a hash used before signing. $\endgroup$ May 8, 2015 at 8:09
  • $\begingroup$ RSASSA-PSS is a completely different beast altogether. A correct representation would require not only Signature Algorithm and Signature Hash Algorithm, but also identifiers for MGF Algorithm and P Source. This is however beside the point. $\endgroup$ May 9, 2015 at 10:51
6
$\begingroup$

I believe the SignatureAlgorithm is the algorithm used to sign the content using the private key, while the SignatureHashAlgorithm is used to hash the content before signing (so as to not sign as much data, which is a relatively slow process). In this case, it's easy enough to figure out that the SignatureHashAlgorithm is SHA1 because it's in the name of the SignatureAlgorithm, but I imagine there are cases where that isn't true.

$\endgroup$
1
  • 2
    $\begingroup$ Thanks. I think there is only one SignatureHashAlgorithm (aka "digest algorithm") and one "public key algorithm" used in an X.509 certificate. $\endgroup$
    – HomeCoder
    Mar 9, 2012 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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