mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8268506: More Manifest Digests
Reviewed-by: xuelei, ahgross, weijun, rhalade
This commit is contained in:
parent
ab9170957f
commit
790dcc667d
3 changed files with 21 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -331,8 +331,12 @@ public class ManifestDigester {
|
|||
* @see #MF_MAIN_ATTRS
|
||||
*/
|
||||
public Entry getMainAttsEntry(boolean oldStyle) {
|
||||
mainAttsEntry.oldStyle = oldStyle;
|
||||
return mainAttsEntry;
|
||||
if (mainAttsEntry != null) {
|
||||
mainAttsEntry.oldStyle = oldStyle;
|
||||
return mainAttsEntry;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Entry get(String name) {
|
||||
|
|
|
@ -543,6 +543,10 @@ public class SignatureFileVerifier {
|
|||
MessageDigest digest = getDigest(algorithm);
|
||||
if (digest != null) {
|
||||
ManifestDigester.Entry mde = md.getMainAttsEntry(false);
|
||||
if (mde == null) {
|
||||
throw new SignatureException("Manifest Main Attribute check " +
|
||||
"failed due to missing main attributes entry");
|
||||
}
|
||||
byte[] computedHash = mde.digest(digest);
|
||||
byte[] expectedHash =
|
||||
Base64.getMimeDecoder().decode((String)se.getValue());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue