From the RFC - https://www.ietf.org/rfc/rfc3447.txt

A.2.4 RSASSA-PKCS1-v1_5

For each OID, the parameters field associated with this OID in a value of type AlgorithmIdentifier shall have a value of type NULL. The OID should be chosen in accordance with the following table:

  Hash algorithm   OID
  MD2              md2WithRSAEncryption    ::= {pkcs-1 2}
  MD5              md5WithRSAEncryption    ::= {pkcs-1 4}
  SHA-1            sha1WithRSAEncryption   ::= {pkcs-1 5}
  SHA-256          sha256WithRSAEncryption ::= {pkcs-1 11}
  SHA-384          sha384WithRSAEncryption ::= {pkcs-1 12}
  SHA-512          sha512WithRSAEncryption ::= {pkcs-1 13}

When I run open asn1parse on a certificate, I can find this field

  984:d=2  hl=2 l=   9 prim: OBJECT            :sha256WithRSAEncryption
  995:d=2  hl=2 l=   0 prim: NULL              
  997:d=1  hl=4 l= 257 prim: BIT STRING        

However, there is also a DigestAlgorithm field in the RFC appendix

The EMSA-PKCS1-v1_5 encoding method includes an ASN.1 value of type DigestInfo, where the type DigestInfo has the syntax

  DigestInfo ::= SEQUENCE {
      digestAlgorithm DigestAlgorithm,
      digest OCTET STRING

digestAlgorithm identifies the hash function and shall be an algorithm ID with an OID in the set PKCS1-v1-5DigestAlgorithms. For a discussion of supported hash functions, see Appendix B.1.

  DigestAlgorithm ::=
      AlgorithmIdentifier { {PKCS1-v1-5DigestAlgorithms} }

  PKCS1-v1-5DigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
      { OID id-md2 PARAMETERS NULL    }|
      { OID id-md5 PARAMETERS NULL    }|
      { OID id-sha1 PARAMETERS NULL   }|
      { OID id-sha256 PARAMETERS NULL }|
      { OID id-sha384 PARAMETERS NULL }|
      { OID id-sha512 PARAMETERS NULL }

How do I locate this parameter using openssl asn1parse or any other tool or utility?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.