org.bouncycastle.asn1.x509.GeneralSubtree Java Examples
The following examples show how to use
org.bouncycastle.asn1.x509.GeneralSubtree.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeneralSubtreesTableModel.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
/** * Load the GeneralSubtreesTableModel with general subtrees. * * @param generalSubtrees * The general subtrees */ public void load(GeneralSubtrees generalSubtrees) { List<GeneralSubtree> generalSubtreesList = generalSubtrees.getGeneralSubtrees(); Collections.sort(generalSubtreesList, new GeneralSubtreeBaseComparator()); data = new Object[generalSubtreesList.size()][3]; int i = 0; for (GeneralSubtree generalSubtree : generalSubtreesList) { data[i][0] = generalSubtree; data[i][1] = generalSubtree; data[i][2] = generalSubtree; i++; } fireTableDataChanged(); }
Example #2
Source File: GeneralSubtreesTableModel.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
@Override public int compare(GeneralSubtree subtree1, GeneralSubtree subtree2) { // Maximum may be null; BigInteger maximum1 = BigInteger.valueOf(-1); BigInteger maximum2 = BigInteger.valueOf(-1); if (subtree1.getMaximum() != null) { maximum1 = subtree1.getMaximum(); } if (subtree2.getMaximum() != null) { maximum2 = subtree2.getMaximum(); } return maximum1.compareTo(maximum2); }
Example #3
Source File: DNameConstraints.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
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 e) { DError.displayError(this, e); return; } closeDialog(); }
Example #4
Source File: JGeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private void addPressed() { Container container = getTopLevelAncestor(); DGeneralSubtreeChooser dGeneralSubtreeChooser = null; if (container instanceof JDialog) { dGeneralSubtreeChooser = new DGeneralSubtreeChooser((JDialog) container, title, null); } else { dGeneralSubtreeChooser = new DGeneralSubtreeChooser((JFrame) container, title, null); } dGeneralSubtreeChooser.setLocationRelativeTo(container); dGeneralSubtreeChooser.setVisible(true); GeneralSubtree newGeneralSubtree = dGeneralSubtreeChooser.getGeneralSubtree(); if (newGeneralSubtree == null) { return; } generalSubtrees.getGeneralSubtrees().add(newGeneralSubtree); populate(); selectGeneralSubtreeInTable(newGeneralSubtree); }
Example #5
Source File: ExtensionType.java From xipki with Apache License 2.0 | 5 votes |
private static GeneralSubtree[] buildGeneralSubtrees(List<GeneralSubtreeType> subtrees) throws CertprofileException { if (CollectionUtil.isEmpty(subtrees)) { return null; } final int n = subtrees.size(); GeneralSubtree[] ret = new GeneralSubtree[n]; for (int i = 0; i < n; i++) { ret[i] = buildGeneralSubtree(subtrees.get(i)); } return ret; }
Example #6
Source File: DGeneralSubtreeChooser.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void populate(GeneralSubtree generalSubtree) { if (generalSubtree != null) { jgnBase.setGeneralName(generalSubtree.getBase()); if (generalSubtree.getMinimum() != null) { jtfMinimum.setText("" + generalSubtree.getMinimum().intValue()); jtfMinimum.setCaretPosition(0); } if (generalSubtree.getMaximum() != null) { jtfMaximum.setText("" + generalSubtree.getMaximum().intValue()); jtfMaximum.setCaretPosition(0); } } }
Example #7
Source File: GeneralSubtreesTableCellRend.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
/** * Returns the rendered cell. * * @param jtGeneralSubtrees * The JTable * @param value * The value to assign to the cell * @param isSelected * True if cell is selected * @param row * The row of the cell to render * @param col * The column of the cell to render * @param hasFocus * If true, render cell appropriately * @return The renderered cell */ @Override public Component getTableCellRendererComponent(JTable jtGeneralSubtrees, Object value, boolean isSelected, boolean hasFocus, int row, int col) { JLabel cell = (JLabel) super.getTableCellRendererComponent(jtGeneralSubtrees, value, isSelected, hasFocus, row, col); GeneralSubtree generalSubtree = (GeneralSubtree) value; if (col == 0) { cell.setText(GeneralNameUtil.safeToString(generalSubtree.getBase(), false)); } else if (col == 1) { if (generalSubtree.getMinimum() != null) { String minimumStr = "" + generalSubtree.getMinimum().intValue(); cell.setText(minimumStr); cell.setToolTipText(minimumStr); } else { cell.setText("-"); } } else { if (generalSubtree.getMaximum() != null) { String maximumStr = "" + generalSubtree.getMaximum().intValue(); cell.setText(maximumStr); cell.setToolTipText(maximumStr); } else { cell.setText("-"); } } cell.setBorder(new EmptyBorder(0, 5, 0, 5)); return cell; }
Example #8
Source File: ExtensionType.java From xipki with Apache License 2.0 | 5 votes |
public org.bouncycastle.asn1.x509.NameConstraints toXiNameConstrains() throws CertprofileException { GeneralSubtree[] permitted = buildGeneralSubtrees(getPermittedSubtrees()); GeneralSubtree[] excluded = buildGeneralSubtrees(getExcludedSubtrees()); return (permitted == null && excluded == null) ? null : new org.bouncycastle.asn1.x509.NameConstraints(permitted, excluded); }
Example #9
Source File: JGeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void selectGeneralSubtreeInTable(GeneralSubtree generalSubtree) { for (int i = 0; i < jtGeneralSubtrees.getRowCount(); i++) { if (generalSubtree.equals(jtGeneralSubtrees.getValueAt(i, 0))) { jtGeneralSubtrees.changeSelection(i, 0, false, false); return; } } }
Example #10
Source File: JGeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void editSelectedGeneralSubtree() { int selectedRow = jtGeneralSubtrees.getSelectedRow(); if (selectedRow != -1) { GeneralSubtree generalSubtree = (GeneralSubtree) jtGeneralSubtrees.getValueAt(selectedRow, 0); Container container = getTopLevelAncestor(); DGeneralSubtreeChooser dGeneralSubtreeChooser = null; if (container instanceof JDialog) { dGeneralSubtreeChooser = new DGeneralSubtreeChooser((JDialog) container, title, generalSubtree); } else { dGeneralSubtreeChooser = new DGeneralSubtreeChooser((JFrame) container, title, generalSubtree); } dGeneralSubtreeChooser.setLocationRelativeTo(container); dGeneralSubtreeChooser.setVisible(true); GeneralSubtree newGeneralSubtree = dGeneralSubtreeChooser.getGeneralSubtree(); if (newGeneralSubtree == null) { return; } generalSubtrees.getGeneralSubtrees().remove(generalSubtree); generalSubtrees.getGeneralSubtrees().add(newGeneralSubtree); populate(); selectGeneralSubtreeInTable(newGeneralSubtree); } }
Example #11
Source File: JGeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void removeSelectedGeneralSubtree() { int selectedRow = jtGeneralSubtrees.getSelectedRow(); if (selectedRow != -1) { GeneralSubtree generalSubtree = (GeneralSubtree) jtGeneralSubtrees.getValueAt(selectedRow, 0); generalSubtrees.getGeneralSubtrees().remove(generalSubtree); reloadGeneralSubtreesTable(); selectFirstGeneralSubtreeInTable(); updateButtonControls(); } }
Example #12
Source File: JGeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private void populate() { if (generalSubtrees == null) { generalSubtrees = new GeneralSubtrees(new ArrayList<GeneralSubtree>()); } reloadGeneralSubtreesTable(); selectFirstGeneralSubtreeInTable(); updateButtonControls(); }
Example #13
Source File: GeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 4 votes |
public List<GeneralSubtree> getGeneralSubtrees() { return subtrees; }
Example #14
Source File: GeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 4 votes |
private GeneralSubtrees(ASN1Sequence seq) { subtrees = new ArrayList<>(); for (int i = 0; i < seq.size(); i++) { subtrees.add(GeneralSubtree.getInstance(seq.getObjectAt(i))); } }
Example #15
Source File: GeneralSubtreesTableModel.java From keystore-explorer with GNU General Public License v3.0 | 4 votes |
@Override public int compare(GeneralSubtree subtree1, GeneralSubtree subtree2) { return subtree1.getMinimum().compareTo(subtree2.getMinimum()); }
Example #16
Source File: GeneralSubtreesTableModel.java From keystore-explorer with GNU General Public License v3.0 | 4 votes |
@Override public int compare(GeneralSubtree subtree1, GeneralSubtree subtree2) { return GeneralNameUtil.safeToString(subtree1.getBase(), false).compareToIgnoreCase( GeneralNameUtil.safeToString(subtree2.getBase(), false)); }
Example #17
Source File: DGeneralSubtreeChooser.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Constructs a new DGeneralSubtreeChooser dialog. * * @param parent * The parent dialog * @param title * The dialog title * @param generalSubtree * General subtree */ public DGeneralSubtreeChooser(JDialog parent, String title, GeneralSubtree generalSubtree) { super(parent, title, Dialog.ModalityType.DOCUMENT_MODAL); initComponents(generalSubtree); }
Example #18
Source File: GeneralSubtreesTableModel.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Get the class at of the cells at the given column position. * * @param col * The column position * @return The column cells' class */ @Override public Class<?> getColumnClass(int col) { return GeneralSubtree.class; }
Example #19
Source File: DGeneralSubtreeChooser.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Get selected general subtree. * * @return General subtree, or null if none */ public GeneralSubtree getGeneralSubtree() { return generalSubtree; }
Example #20
Source File: GeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Create <code>GeneralSubtrees</code> from list of <code>GeneralSubtree</code> * objects. * * @param subtrees */ public GeneralSubtrees(List<GeneralSubtree> subtrees) { this.subtrees = subtrees; }
Example #21
Source File: DGeneralSubtreeChooser.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Constructs a new DGeneralSubtreeChooser dialog. * * @param parent * The parent frame * @param title * The dialog title * @param generalSubtree * General subtree */ public DGeneralSubtreeChooser(JFrame parent, String title, GeneralSubtree generalSubtree) { super(parent, title, ModalityType.DOCUMENT_MODAL); initComponents(generalSubtree); }
Example #22
Source File: GeneralSubtrees.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Create <code>GeneralSubtrees</code> from array of <code>GeneralSubtree</code> * objects. * * @param subtrees */ public GeneralSubtrees(GeneralSubtree[] subtrees) { this.subtrees = new ArrayList<>(Arrays.asList(subtrees)); }