提交 127bf70f 编写于 作者: I igerasim

8179101: Improve algorithm constraints implementation

Reviewed-by: mullan, ahgross, rhalade, igerasim
上级 6de8daee
...@@ -703,7 +703,6 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { ...@@ -703,7 +703,6 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
private int minSize; // the minimal available key size private int minSize; // the minimal available key size
private int maxSize; // the maximal available key size private int maxSize; // the maximal available key size
private int prohibitedSize = -1; // unavailable key sizes private int prohibitedSize = -1; // unavailable key sizes
private int size;
public KeySizeConstraint(String algo, Operator operator, int length) { public KeySizeConstraint(String algo, Operator operator, int length) {
algorithm = algo; algorithm = algo;
...@@ -761,8 +760,9 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { ...@@ -761,8 +760,9 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
return; return;
} }
throw new CertPathValidatorException( throw new CertPathValidatorException(
"Algorithm constraints check failed on keysize limits. " "Algorithm constraints check failed on keysize limits. " +
+ algorithm + " " + size + "bit key" + extendedMsg(cp), algorithm + " " + KeyUtil.getKeySize(key) + "bit key" +
extendedMsg(cp),
null, null, -1, BasicReason.ALGORITHM_CONSTRAINED); null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
} }
} }
...@@ -789,7 +789,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { ...@@ -789,7 +789,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
return true; return true;
} }
size = KeyUtil.getKeySize(key); int size = KeyUtil.getKeySize(key);
if (size == 0) { if (size == 0) {
return false; // we don't allow any key of size 0. return false; // we don't allow any key of size 0.
} else if (size > 0) { } else if (size > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册