List of usage examples for org.bouncycastle.asn1.x509 BasicConstraints getEncoded
public byte[] getEncoded(String encoding) throws IOException
From source file:net.sf.keystore_explorer.gui.dialogs.extensions.DBasicConstraints.java
License:Open Source License
private void okPressed() { boolean ca = jcbSubjectIsCa.isSelected(); int pathLengthConstraint = -1; String pathLengthConstraintStr = jtfPathLengthConstraint.getText().trim(); if (pathLengthConstraintStr.length() > 0) { try {/*w ww. ja v a 2s. com*/ pathLengthConstraint = Integer.parseInt(pathLengthConstraintStr); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(this, res.getString("DBasicConstraints.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE); return; } if (pathLengthConstraint < 0) { JOptionPane.showMessageDialog(this, res.getString("DBasicConstraints.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE); return; } } BasicConstraints basicConstraints; if (pathLengthConstraint != -1) { // pathLengthConstraint set automatically means ca=true basicConstraints = new BasicConstraints(pathLengthConstraint); } else { basicConstraints = new BasicConstraints(ca); } try { value = basicConstraints.getEncoded(ASN1Encoding.DER); } catch (IOException ex) { DError dError = new DError(this, ex); dError.setLocationRelativeTo(this); dError.setVisible(true); return; } closeDialog(); }