# Difference between “Signature Algorithm” and “Signature Hash Algorithm” in X.509

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"?

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:

-

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.

-
Thanks for your answer. I've edited my question. It really seems to be a Microsoft thing. – HomeCoder Mar 9 '12 at 15:35
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. – HomeCoder Mar 9 '12 at 15:40

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.

-
Thanks. I think there is only one SignatureHashAlgorithm (aka "digest algorithm") and one "public key algorithm" used in an X.509 certificate. – HomeCoder Mar 9 '12 at 15:45