RFR: 8278851: Correct signer logic for jars signed with multiple digestalgs [v2]

Sean Mullan mullan at openjdk.java.net
Fri Jan 14 15:16:28 UTC 2022


On Thu, 13 Jan 2022 21:57:57 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> If a JAR is signed with multiple digest algorithms and one of the digest algorithms is disabled, `ManifestEntryVerifier.verify()` was incorrectly returning null indicating that the jar entry has no signers. 
>> 
>> This fixes the issue such that an entry is considered signed if at least one of the digest algorithms is not disabled and the digest match passes. This makes the fix consistent with how multiple digest algorithms are handled in the Signature File. This also fixes an issue in the `ManifestEntryVerifier.getParams()` method in which it was incorrectly checking the algorithm constraints against all signers of a JAR when it should check them only against the signers of the entry that is being verified. 
>> 
>> An additional cache has also been added to avoid checking if the digest algorithm is disabled more than once for entries signed by the same set of signers.
>
> Sean Mullan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change permittedAlgs variable name.
>   Move put methods out of checkConstraints().

Each `CodeSigner[]` reference uniquely represents the signers of an entry. Multiple entries can map to the same `CodeSigner[]` reference. We only need reference equality for the keys as each JAR entry is already mapped to an array of `CodeSigner`. It's basically an `IdentityHashMap` but we don't need to specifically use that.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7056


More information about the core-libs-dev mailing list