提交 204b667d 编写于 作者: I igerasim

8175940: More certificate subject checking

Reviewed-by: ahgross, mullan
上级 fc62f404
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -194,13 +194,28 @@ public class DNSName implements GeneralNameInterface { ...@@ -194,13 +194,28 @@ public class DNSName implements GeneralNameInterface {
*/ */
public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException { public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException {
int constraintType; int constraintType;
if (inputName == null) if (inputName == null) {
constraintType = NAME_DIFF_TYPE; return NAME_DIFF_TYPE;
else if (inputName.getType() != NAME_DNS) }
constraintType = NAME_DIFF_TYPE; String inName;
else { switch (inputName.getType()) {
String inName = case NAME_DNS:
(((DNSName)inputName).getName()).toLowerCase(Locale.ENGLISH); inName = ((DNSName)inputName).getName();
break;
case NAME_DIRECTORY:
try {
inName = ((X500Name) inputName).getCommonName();
if (inName == null) {
return NAME_DIFF_TYPE;
}
} catch (IOException ioe) {
return NAME_DIFF_TYPE;
}
break;
default:
return NAME_DIFF_TYPE;
}
inName = inName.toLowerCase(Locale.ENGLISH);
String thisName = name.toLowerCase(Locale.ENGLISH); String thisName = name.toLowerCase(Locale.ENGLISH);
if (inName.equals(thisName)) if (inName.equals(thisName))
constraintType = NAME_MATCH; constraintType = NAME_MATCH;
...@@ -219,7 +234,6 @@ public class DNSName implements GeneralNameInterface { ...@@ -219,7 +234,6 @@ public class DNSName implements GeneralNameInterface {
} else { } else {
constraintType = NAME_SAME_TYPE; constraintType = NAME_SAME_TYPE;
} }
}
return constraintType; return constraintType;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册