Java 类org.bouncycastle.asn1.x509.NameConstraints 实例源码

项目:keystore-explorer    文件:DNameConstraints.java   
private void okPressed() {
    List<GeneralSubtree> permittedSubtrees = jgsPermittedSubtrees.getGeneralSubtrees().getGeneralSubtrees();
    List<GeneralSubtree> excludedSubtrees = jgsExcludedSubtrees.getGeneralSubtrees().getGeneralSubtrees();

    GeneralSubtree[] permittedSubtreesArray = permittedSubtrees.toArray(new GeneralSubtree[permittedSubtrees.size()]);
    GeneralSubtree[] excludedSubtreesArray = excludedSubtrees.toArray(new GeneralSubtree[excludedSubtrees.size()]);

    NameConstraints nameConstraints = new NameConstraints(permittedSubtreesArray, excludedSubtreesArray);

    try {
        value = nameConstraints.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }

    closeDialog();
}
项目:keystore-explorer    文件:DNameConstraints.java   
private void prepopulateWithValue(byte[] value) throws IOException {
    NameConstraints nameConstraints = NameConstraints.getInstance(value);

    if (nameConstraints.getPermittedSubtrees() != null) {
        jgsPermittedSubtrees.setGeneralSubtrees(new GeneralSubtrees(nameConstraints.getPermittedSubtrees()));
    }

    if (nameConstraints.getExcludedSubtrees() != null) {
        jgsExcludedSubtrees.setGeneralSubtrees(new GeneralSubtrees(nameConstraints.getExcludedSubtrees()));
    }
}
项目:xipki    文件:XmlX509CertprofileUtil.java   
public static NameConstraints buildNameConstrains(
        org.xipki.ca.certprofile.x509.jaxb.NameConstraints type)
        throws CertprofileException {
    ParamUtil.requireNonNull("type", type);
    GeneralSubtree[] permitted = buildGeneralSubtrees(type.getPermittedSubtrees());
    GeneralSubtree[] excluded = buildGeneralSubtrees(type.getExcludedSubtrees());
    return (permitted == null && excluded == null) ? null
            : new NameConstraints(permitted, excluded);
}