Example usage for org.bouncycastle.asn1.x509 NameConstraints getEncoded

List of usage examples for org.bouncycastle.asn1.x509 NameConstraints getEncoded

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 NameConstraints getEncoded.

Prototype

public byte[] getEncoded(String encoding) throws IOException 

Source Link

Document

Return either the default for "BER" or a DER encoding if "DER" is specified.

Usage

From source file:net.sf.keystore_explorer.gui.dialogs.extensions.DNameConstraints.java

License:Open Source License

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 {//w  w  w . j  a  va  2  s  . c o  m
        value = nameConstraints.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }

    closeDialog();
}