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(); }
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())); } }
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); }