Skip to content

Determining the digest algorithm used by a PKCS#7 object #474

Open
@gettalong

Description

@gettalong

I'm working on adding digital signature support to HexaPDF, using OpenSSL for the cryptographic needs.

One type of signature is a DER encoded PKCS#7 object. I can successfully extract the signing time, validity periods and other stuff. However, I didn't find any method that returns the message digest algorithm used during signing.

For example, when extracting the PKCS#7 object and looking at it with OpenSSL command line tools, I find that the algorithm is SHA1:

$ openssl pkcs7 -in /tmp/sig.pkcs7 -inform DER -print | head -n 7
PKCS7:
  type: pkcs7-signedData (1.2.840.113549.1.7.2)
  d.sign:
    version: 1
    md_algs:
        algorithm: sha1 (1.3.14.3.2.26)
        parameter: NULL

How can I retrieve this information using Ruby?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions