Search in sources :

Example 1 with PolicyMapping

use of org.kse.crypto.x509.PolicyMapping in project keystore-explorer by kaikramer.

the class DPolicyMappingChooser method okPressed.

private void okPressed() {
    ASN1ObjectIdentifier issuerDomainPolicy = joiIssuerDomainPolicy.getObjectId();
    if (issuerDomainPolicy == null) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyMappingChooser.IssuerDomainPolicyValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    ASN1ObjectIdentifier subjectDomainPolicy = joiSubjectDomainPolicy.getObjectId();
    if (subjectDomainPolicy == null) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyMappingChooser.SubjectDomainPolicyValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    policyMapping = new PolicyMapping(issuerDomainPolicy, subjectDomainPolicy);
    closeDialog();
}
Also used : PolicyMapping(org.kse.crypto.x509.PolicyMapping) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 2 with PolicyMapping

use of org.kse.crypto.x509.PolicyMapping in project keystore-explorer by kaikramer.

the class JPolicyMappings method removeSelectedPolicyMapping.

private void removeSelectedPolicyMapping() {
    int selectedRow = jtPolicyMappings.getSelectedRow();
    if (selectedRow != -1) {
        PolicyMapping policyMapping = (PolicyMapping) jtPolicyMappings.getValueAt(selectedRow, 0);
        policyMappings = PolicyMappingsUtil.remove(policyMapping, policyMappings);
        reloadPolicyMappingsTable();
        selectFirstPolicyMappingInTable();
        updateButtonControls();
    }
}
Also used : PolicyMapping(org.kse.crypto.x509.PolicyMapping) Point(java.awt.Point)

Example 3 with PolicyMapping

use of org.kse.crypto.x509.PolicyMapping in project keystore-explorer by kaikramer.

the class PolicyMappingsTableModel method load.

/**
 * Load the PolicyMappingsTableModel with policy mappings.
 *
 * @param policyMappings
 *            The policy mappings
 */
public void load(PolicyMappings policyMappings) {
    ASN1Sequence policyMappingsSeq = (ASN1Sequence) policyMappings.toASN1Primitive();
    // convert and sort
    ASN1Encodable[] asn1EncArray = policyMappingsSeq.toArray();
    PolicyMapping[] policyMappingsArray = new PolicyMapping[asn1EncArray.length];
    for (int i = 0; i < asn1EncArray.length; i++) {
        policyMappingsArray[i] = PolicyMapping.getInstance(asn1EncArray[i]);
    }
    Arrays.sort(policyMappingsArray, new IssuerDomainPolicyComparator());
    data = new Object[policyMappingsArray.length][2];
    int i = 0;
    for (PolicyMapping policyMapping : policyMappingsArray) {
        data[i][0] = policyMapping;
        data[i][1] = policyMapping;
        i++;
    }
    fireTableDataChanged();
}
Also used : PolicyMapping(org.kse.crypto.x509.PolicyMapping) ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable)

Example 4 with PolicyMapping

use of org.kse.crypto.x509.PolicyMapping in project keystore-explorer by kaikramer.

the class JPolicyMappings method addPressed.

private void addPressed() {
    Container container = getTopLevelAncestor();
    DPolicyMappingChooser dPolicyMappingChooser = null;
    if (container instanceof JDialog) {
        dPolicyMappingChooser = new DPolicyMappingChooser((JDialog) container, title, null);
        dPolicyMappingChooser.setLocationRelativeTo(container);
        dPolicyMappingChooser.setVisible(true);
    } else if (container instanceof JFrame) {
        dPolicyMappingChooser = new DPolicyMappingChooser((JFrame) container, title, null);
        dPolicyMappingChooser.setLocationRelativeTo(container);
        dPolicyMappingChooser.setVisible(true);
    }
    PolicyMapping newPolicyMapping = dPolicyMappingChooser.getPolicyMapping();
    if (newPolicyMapping == null) {
        return;
    }
    policyMappings = PolicyMappingsUtil.add(newPolicyMapping, policyMappings);
    populate();
    selectPolicyMappingInTable(newPolicyMapping);
}
Also used : PolicyMapping(org.kse.crypto.x509.PolicyMapping) Container(java.awt.Container) JFrame(javax.swing.JFrame) JDialog(javax.swing.JDialog)

Example 5 with PolicyMapping

use of org.kse.crypto.x509.PolicyMapping in project keystore-explorer by kaikramer.

the class JPolicyMappings method editSelectedPolicyMapping.

private void editSelectedPolicyMapping() {
    int selectedRow = jtPolicyMappings.getSelectedRow();
    if (selectedRow != -1) {
        PolicyMapping policyMapping = (PolicyMapping) jtPolicyMappings.getValueAt(selectedRow, 0);
        Container container = getTopLevelAncestor();
        DPolicyMappingChooser dPolicyMappingChooser = null;
        if (container instanceof JDialog) {
            dPolicyMappingChooser = new DPolicyMappingChooser((JDialog) container, title, policyMapping);
            dPolicyMappingChooser.setLocationRelativeTo(container);
            dPolicyMappingChooser.setVisible(true);
        } else if (container instanceof JFrame) {
            dPolicyMappingChooser = new DPolicyMappingChooser((JFrame) container, title, policyMapping);
            dPolicyMappingChooser.setLocationRelativeTo(container);
            dPolicyMappingChooser.setVisible(true);
        }
        PolicyMapping newPolicyMapping = dPolicyMappingChooser.getPolicyMapping();
        if (newPolicyMapping == null) {
            return;
        }
        policyMappings = PolicyMappingsUtil.remove(policyMapping, policyMappings);
        policyMappings = PolicyMappingsUtil.add(newPolicyMapping, policyMappings);
        populate();
        selectPolicyMappingInTable(newPolicyMapping);
    }
}
Also used : PolicyMapping(org.kse.crypto.x509.PolicyMapping) Container(java.awt.Container) JFrame(javax.swing.JFrame) Point(java.awt.Point) JDialog(javax.swing.JDialog)

Aggregations

PolicyMapping (org.kse.crypto.x509.PolicyMapping)6 Container (java.awt.Container)2 Point (java.awt.Point)2 JDialog (javax.swing.JDialog)2 JFrame (javax.swing.JFrame)2 JLabel (javax.swing.JLabel)1 EmptyBorder (javax.swing.border.EmptyBorder)1 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)1 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)1