8268500: Better specified ParameterSpecs
Reviewed-by: weijun, ahgross, rhalade
This commit is contained in:
parent
790dcc667d
commit
20e1a273c2
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -515,6 +515,14 @@ public class SignerInfo implements DerEncoder {
|
||||
case "RSASSA-PSS":
|
||||
PSSParameterSpec spec = (PSSParameterSpec)
|
||||
SignatureUtil.getParamSpec(encAlg, encAlgId.getParameters());
|
||||
/*
|
||||
* RFC 4056 section 3 for Signed-data:
|
||||
* signatureAlgorithm MUST contain id-RSASSA-PSS. The algorithm
|
||||
* parameters field MUST contain RSASSA-PSS-params.
|
||||
*/
|
||||
if (spec == null) {
|
||||
throw new NoSuchAlgorithmException("Missing PSSParameterSpec for RSASSA-PSS algorithm");
|
||||
}
|
||||
if (!AlgorithmId.get(spec.getDigestAlgorithm()).equals(digAlgId)) {
|
||||
throw new NoSuchAlgorithmException("Incompatible digest algorithm");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user