当前位置: 首页>>代码示例>>Java>>正文


Java X509CertSelector.setNameConstraints方法代码示例

本文整理汇总了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()));
        }
    }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:40,代码来源:X509CertSelectorTest.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:SetNameConstraintsEmptySequence.java

示例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()));
        }
    }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:46,代码来源:X509CertSelectorTest.java


注:本文中的java.security.cert.X509CertSelector.setNameConstraints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。