本文整理汇总了Java中java.security.cert.X509CertSelector.setNameConstraints方法的典型用法代码示例。如果您正苦于以下问题:Java X509CertSelector.setNameConstraints方法的具体用法?Java X509CertSelector.setNameConstraints怎么用?Java X509CertSelector.setNameConstraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.cert.X509CertSelector
的用法示例。
在下文中一共展示了X509CertSelector.setNameConstraints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: X509CertSelector
import java.security.cert.X509CertSelector; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#setNameConstraints(byte[]
* bytes)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setNameConstraints",
args = {byte[].class}
)
public void test_setNameConstraintsLB$() throws IOException {
// GeneralName[] name_constraints = new GeneralName[] {
// new GeneralName(1, "822.Name"),
// new GeneralName(1, "[email protected]"),
// new GeneralName(2, "Name.org"),
// new GeneralName(2, "dNS.Name.org"),
//
// new GeneralName(6, "http://Resource.Id"),
// new GeneralName(6, "http://uniform.Resource.Id"),
// new GeneralName(7, "1.1.1.1"),
//
// new GeneralName(new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
// 1, 1, 1, 1, 1 }), };
//
// for (int i = 0; i < name_constraints.length; i++) {
// GeneralSubtree subtree = new GeneralSubtree(name_constraints[i]);
// GeneralSubtrees subtrees = new GeneralSubtrees();
// subtrees.addSubtree(subtree);
// NameConstraints constraints = new NameConstraints(subtrees,
// subtrees);
// }
X509CertSelector selector = new X509CertSelector();
for (int i = 0; i < constraintBytes.length; i++) {
selector.setNameConstraints(constraintBytes[i]);
assertTrue(Arrays.equals(constraintBytes[i], selector
.getNameConstraints()));
}
}
示例2: main
import java.security.cert.X509CertSelector; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
X509CertSelector certSel = new X509CertSelector();
byte[] data = {0x30, 0x00}; // An empty SEQUENCE
certSel.setNameConstraints(data);
}
示例3: test_getNameConstraints
import java.security.cert.X509CertSelector; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#getNameConstraints()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getNameConstraints",
args = {}
)
public void test_getNameConstraints() throws IOException {
// Used to generate following byte array
// GeneralName[] name_constraints = new GeneralName[] {
// new GeneralName(1, "822.Name"),
// new GeneralName(1, "[email protected]"),
// new GeneralName(2, "Name.org"),
// new GeneralName(2, "dNS.Name.org"),
//
// new GeneralName(6, "http://Resource.Id"),
// new GeneralName(6, "http://uniform.Resource.Id"),
// new GeneralName(7, "1.1.1.1"),
//
// new GeneralName(new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
// 1, 1, 1, 1, 1 }), };
//
// constraintBytes = new byte[name_constraints.length][];
//
// for (int i = 0; i < name_constraints.length; i++) {
// GeneralSubtree subtree = new GeneralSubtree(name_constraints[i]);
// GeneralSubtrees subtrees = new GeneralSubtrees();
// subtrees.addSubtree(subtree);
// NameConstraints constraints = new NameConstraints(subtrees,
// subtrees);
// constraintBytes[i] = constraints.getEncoded();
// }
// System.out.println("XXX"+Arrays.deepToString(constraintBytes)+"XXX");
X509CertSelector selector = new X509CertSelector();
for (int i = 0; i < constraintBytes.length; i++) {
selector.setNameConstraints(constraintBytes[i]);
assertTrue(Arrays.equals(constraintBytes[i], selector
.getNameConstraints()));
}
}