Skip to content

Signature algorithm for signed JAR reported incorrectly #293

@pbeast

Description

@pbeast

The reported signature algorithm for JARs signed using KSE is inaccurate

To Reproduce

  1. Sign JAR file using KSE
  2. Verify the signature using jarsigner -verify target/test.jar -verbose:summary
  3. Check the output:

          0 Mon Aug 23 20:29:28 IDT 2021 META-INF/ (and 17 more)
sm     5871 Mon Aug 23 20:29:28 IDT 2021 org/springframework/boot/loader/ClassPathIndexFile.class (and 100 more)
s     14598 Mon Aug 23 20:29:28 IDT 2021 META-INF/MANIFEST.MF
      13290 Mon Aug 23 20:29:28 IDT 2021 META-INF/NCR_CORPORATION_S_DIGICERT_INC_ID.SF (and 1 more)

  s = signature was verified
  m = entry is listed in manifest
  k = at least one certificate was found in keystore

- Signed by "CN=NCR Corporation, OU=NCR, O=NCR Corporation, L=Atlanta, ST=Georgia, C=US"
    Digest algorithm: SHA-256
    Signature algorithm: SHA256withSHA256withRSA, 2048-bit key
  Timestamped by "CN=DigiCert Timestamp 2021, O="DigiCert, Inc.", C=US" on Mon Aug 23 17:29:29 UTC 2021
    Timestamp digest algorithm: SHA-256
    Timestamp signature algorithm: SHA256withRSA, 2048-bit key

jar verified.

The signer certificate will expire on 2022-04-14.
The timestamp will expire on 2031-01-06.

Expected behavior


          0 Mon Aug 23 20:29:28 IDT 2021 META-INF/ (and 17 more)
sm     5871 Mon Aug 23 20:29:28 IDT 2021 org/springframework/boot/loader/ClassPathIndexFile.class (and 100 more)
s     14598 Mon Aug 23 20:29:28 IDT 2021 META-INF/MANIFEST.MF
      13290 Mon Aug 23 20:29:28 IDT 2021 META-INF/NCR_CORPORATION_S_DIGICERT_INC_ID.SF (and 1 more)

  s = signature was verified
  m = entry is listed in manifest
  k = at least one certificate was found in keystore

- Signed by "CN=NCR Corporation, OU=NCR, O=NCR Corporation, L=Atlanta, ST=Georgia, C=US"
    Digest algorithm: SHA-256
    Signature algorithm: SHA256withRSA, 2048-bit key
  Timestamped by "CN=DigiCert Timestamp 2021, O="DigiCert, Inc.", C=US" on Mon Aug 23 17:29:29 UTC 2021
    Timestamp digest algorithm: SHA-256
    Timestamp signature algorithm: SHA256withRSA, 2048-bit key

jar verified.

The signer certificate will expire on 2022-04-14.
The timestamp will expire on 2031-01-06.

The signature algorithm reported as SHA256withSHA256withRSA instead of SHA256withRSA

Link to the sample JAR - https://drive.google.com/file/d/1ppfDbJwr0wZ7GFSScGRiT78DKsdQMAFi/view?usp=sharing

Environment

  • Version of KSE: 5.4.4 (built from sources including latest changes)

  • Version of Java:
    openjdk version "14.0.2" 2020-07-14
    OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)

  • Platform (OS): macOS Big Sur

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions