Search in sources :

Example 11 with PolicyInformation

use of com.github.zhenwei.core.asn1.x509.PolicyInformation in project keystore-explorer by kaikramer.

the class DCertificatePolicies method prepopulateWithValue.

private void prepopulateWithValue(byte[] value) throws IOException {
    CertificatePolicies certificatePolicies = CertificatePolicies.getInstance(value);
    List<PolicyInformation> accessDescriptionList = new ArrayList<>(Arrays.asList(certificatePolicies.getPolicyInformation()));
    jpiCertificatePolicies.setPolicyInformation(accessDescriptionList);
}
Also used : CertificatePolicies(org.bouncycastle.asn1.x509.CertificatePolicies) PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation) JPolicyInformation(org.kse.gui.crypto.policyinformation.JPolicyInformation) ArrayList(java.util.ArrayList)

Example 12 with PolicyInformation

use of com.github.zhenwei.core.asn1.x509.PolicyInformation in project keystore-explorer by kaikramer.

the class DCertificatePolicies method okPressed.

private void okPressed() {
    List<PolicyInformation> policyInformation = jpiCertificatePolicies.getPolicyInformation();
    if (policyInformation.isEmpty()) {
        JOptionPane.showMessageDialog(this, res.getString("DCertificatePolicies.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    CertificatePolicies certificatePolicies = new CertificatePolicies(policyInformation.toArray(new PolicyInformation[policyInformation.size()]));
    try {
        value = certificatePolicies.getEncoded(ASN1Encoding.DER);
    } catch (IOException e) {
        DError.displayError(this, e);
        return;
    }
    closeDialog();
}
Also used : PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation) JPolicyInformation(org.kse.gui.crypto.policyinformation.JPolicyInformation) CertificatePolicies(org.bouncycastle.asn1.x509.CertificatePolicies) IOException(java.io.IOException)

Example 13 with PolicyInformation

use of com.github.zhenwei.core.asn1.x509.PolicyInformation in project keystore-explorer by kaikramer.

the class JPolicyInformation method removeSelectedPolicyInformation.

private void removeSelectedPolicyInformation() {
    int selectedRow = jtPolicyInformation.getSelectedRow();
    if (selectedRow != -1) {
        PolicyInformation policyInfo = (PolicyInformation) jtPolicyInformation.getValueAt(selectedRow, 0);
        policyInformation.remove(policyInfo);
        reloadPolicyInformationTable();
        selectFirstPolicyInformationInTable();
        updateButtonControls();
    }
}
Also used : PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation) Point(java.awt.Point)

Example 14 with PolicyInformation

use of com.github.zhenwei.core.asn1.x509.PolicyInformation in project keystore-explorer by kaikramer.

the class PolicyInformationTableModel method load.

/**
 * Load the PolicyInformationTableModel with policy information.
 *
 * @param policyInformation The policy information
 */
public void load(List<PolicyInformation> policyInformation) {
    PolicyInformation[] policyInformationArray = policyInformation.toArray(new PolicyInformation[policyInformation.size()]);
    Arrays.sort(policyInformationArray, new PolicyInformationComparator());
    data = new Object[policyInformation.size()][1];
    int i = 0;
    for (PolicyInformation policyInfo : policyInformationArray) {
        data[i][0] = policyInfo;
        i++;
    }
    fireTableDataChanged();
}
Also used : PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation)

Example 15 with PolicyInformation

use of com.github.zhenwei.core.asn1.x509.PolicyInformation in project keystore-explorer by kaikramer.

the class DPolicyInformationChooser method okPressed.

private void okPressed() {
    ASN1ObjectIdentifier policyIdentifer = joiPolicyIdentifier.getObjectId();
    if (policyIdentifer == null) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyInformationChooser.PolicyIdentifierValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    List<PolicyQualifierInfo> policyQualifierInfo = jpqPolicyQualifiers.getPolicyQualifierInfo();
    if (!policyQualifierInfo.isEmpty()) {
        ASN1EncodableVector policyQualifiersVec = new ASN1EncodableVector();
        for (PolicyQualifierInfo policyQualInfo : policyQualifierInfo) {
            try {
                policyQualifiersVec.add(policyQualInfo);
            } catch (Exception e) {
                DError.displayError(this, e);
                return;
            }
        }
        DERSequence policyQualifiersSeq = new DERSequence(policyQualifiersVec);
        policyInformation = new PolicyInformation(policyIdentifer, policyQualifiersSeq);
    } else {
        policyInformation = new PolicyInformation(policyIdentifer);
    }
    closeDialog();
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)24 PolicyInformation (org.bouncycastle.asn1.x509.PolicyInformation)23 ArrayList (java.util.ArrayList)19 CertPathValidatorException (java.security.cert.CertPathValidatorException)17 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)14 HashSet (java.util.HashSet)12 Enumeration (java.util.Enumeration)11 Iterator (java.util.Iterator)11 Set (java.util.Set)11 X509Certificate (java.security.cert.X509Certificate)9 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)9 List (java.util.List)8 GeneralSecurityException (java.security.GeneralSecurityException)7 CRLDistPoint (org.bouncycastle.asn1.x509.CRLDistPoint)7 DistributionPoint (org.bouncycastle.asn1.x509.DistributionPoint)7 PolicyInformation (sun.security.x509.PolicyInformation)7 ExtCertPathValidatorException (org.bouncycastle.jce.exception.ExtCertPathValidatorException)6 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)5 PolicyInformation (com.github.zhenwei.core.asn1.x509.PolicyInformation)5 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)4