Search in sources :

Example 16 with PolicyQualifierInfo

use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.

the class DPolicyInformationChooser method populate.

private void populate(PolicyInformation policyInformation) throws IOException {
    if (policyInformation != null) {
        joiPolicyIdentifier.setObjectId(policyInformation.getPolicyIdentifier());
        ASN1Sequence policyQualifierInfoSeq = policyInformation.getPolicyQualifiers();
        if (policyQualifierInfoSeq != null) {
            List<PolicyQualifierInfo> policyQualifierInfo = new ArrayList<PolicyQualifierInfo>();
            for (int i = 0; i < policyQualifierInfoSeq.size(); i++) {
                PolicyQualifierInfo policyQualInfo = PolicyQualifierInfo.getInstance(policyQualifierInfoSeq.getObjectAt(i));
                policyQualifierInfo.add(policyQualInfo);
            }
            jpqPolicyQualifiers.setPolicyQualifierInfo(policyQualifierInfo);
        }
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) ArrayList(java.util.ArrayList) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo)

Example 17 with PolicyQualifierInfo

use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.

the class DPolicyQualifierInfoChooser method okPressed.

private void okPressed() {
    PolicyQualifierInfo newPolicyQualifierInfo = null;
    try {
        if (jrbCps.isSelected()) {
            String cps = jtfCps.getText().trim();
            if (cps.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DPolicyQualifierInfoChooser.CpsValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newPolicyQualifierInfo = new PolicyQualifierInfo(new ASN1ObjectIdentifier(PKIX_CPS_POINTER_QUALIFIER.oid()), (new DERIA5String(cps)).toASN1Primitive());
        } else {
            UserNotice userNotice = junUserNotice.getUserNotice();
            if (userNotice == null) {
                JOptionPane.showMessageDialog(this, res.getString("DPolicyQualifierInfoChooser.UserNoticeValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newPolicyQualifierInfo = new PolicyQualifierInfo(new ASN1ObjectIdentifier(PKIX_USER_NOTICE_QUALIFIER.oid()), userNotice);
        }
    } catch (Exception ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    policyQualifierInfo = newPolicyQualifierInfo;
    closeDialog();
}
Also used : DERIA5String(org.bouncycastle.asn1.DERIA5String) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo) UserNotice(org.bouncycastle.asn1.x509.UserNotice) DERIA5String(org.bouncycastle.asn1.DERIA5String) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 18 with PolicyQualifierInfo

use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.

the class JPolicyQualifierInfo method addPressed.

private void addPressed() {
    Container container = getTopLevelAncestor();
    try {
        DPolicyQualifierInfoChooser dPolicyQualifierInfoChooser = null;
        if (container instanceof JDialog) {
            dPolicyQualifierInfoChooser = new DPolicyQualifierInfoChooser((JDialog) container, title, null);
            dPolicyQualifierInfoChooser.setLocationRelativeTo(container);
            dPolicyQualifierInfoChooser.setVisible(true);
        } else if (container instanceof JFrame) {
            dPolicyQualifierInfoChooser = new DPolicyQualifierInfoChooser((JFrame) container, title, null);
            dPolicyQualifierInfoChooser.setLocationRelativeTo(container);
            dPolicyQualifierInfoChooser.setVisible(true);
        }
        PolicyQualifierInfo newPolicyQualifierInfo = dPolicyQualifierInfoChooser.getPolicyQualifierInfo();
        if (newPolicyQualifierInfo == null) {
            return;
        }
        policyQualifierInfo.add(newPolicyQualifierInfo);
        populate();
        selectPolicyQualifierInfoInTable(newPolicyQualifierInfo);
    } catch (IOException ex) {
        DError dError = null;
        if (container instanceof JDialog) {
            dError = new DError((JDialog) container, ex);
        } else {
            dError = new DError((JFrame) container, ex);
        }
        dError.setLocationRelativeTo(container);
        dError.setVisible(true);
    }
}
Also used : Container(java.awt.Container) JFrame(javax.swing.JFrame) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo) IOException(java.io.IOException) JDialog(javax.swing.JDialog) DError(org.kse.gui.error.DError)

Example 19 with PolicyQualifierInfo

use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.

the class PolicyQualifierInfoTableModel method load.

/**
 * Load the PolicyQualifierInfoTableModel with policy qualifier info.
 *
 * @param policyQualifierInfo
 *            The policy qualifier info
 */
public void load(List<PolicyQualifierInfo> policyQualifierInfo) {
    PolicyQualifierInfo[] policyQualifierInfoArray = policyQualifierInfo.toArray(new PolicyQualifierInfo[policyQualifierInfo.size()]);
    Arrays.sort(policyQualifierInfoArray, new PolicyQualifierInfoComparator());
    data = new Object[policyQualifierInfoArray.length][1];
    int i = 0;
    for (PolicyQualifierInfo policyQualInfo : policyQualifierInfoArray) {
        data[i][0] = policyQualInfo;
        i++;
    }
    fireTableDataChanged();
}
Also used : PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo)

Aggregations

PolicyQualifierInfo (org.bouncycastle.asn1.x509.PolicyQualifierInfo)12 IOException (java.io.IOException)7 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)7 UserNotice (org.bouncycastle.asn1.x509.UserNotice)6 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)5 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)4 DERIA5String (org.bouncycastle.asn1.DERIA5String)4 DERSequence (org.bouncycastle.asn1.DERSequence)4 PolicyInformation (org.bouncycastle.asn1.x509.PolicyInformation)4 DError (org.kse.gui.error.DError)4 ArrayList (java.util.ArrayList)3 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)3 Container (java.awt.Container)2 Point (java.awt.Point)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 PolicyQualifierInfo (java.security.cert.PolicyQualifierInfo)2 Enumeration (java.util.Enumeration)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 JDialog (javax.swing.JDialog)2