Search in sources :

Example 16 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DNetscapeCertificateRenewalUrl method okPressed.

private void okPressed() {
    String netscapeCertificateRenewalUrlStr = jtfNetscapeCertificateRenewalUrl.getText().trim();
    if (netscapeCertificateRenewalUrlStr.length() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DNetscapeCertificateRenewalUrl.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    DERIA5String netscapeCertificateRenewalUrl = new DERIA5String(netscapeCertificateRenewalUrlStr);
    try {
        value = netscapeCertificateRenewalUrl.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : DERIA5String(org.bouncycastle.asn1.DERIA5String) DERIA5String(org.bouncycastle.asn1.DERIA5String) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 17 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DNetscapeRevocationUrl method okPressed.

private void okPressed() {
    String netscapeRevocationUrlStr = jtfNetscapeRevocationUrl.getText().trim();
    if (netscapeRevocationUrlStr.length() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DNetscapeRevocationUrl.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    DERIA5String netscapeRevocationUrl = new DERIA5String(netscapeRevocationUrlStr);
    try {
        value = netscapeRevocationUrl.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : DERIA5String(org.bouncycastle.asn1.DERIA5String) DERIA5String(org.bouncycastle.asn1.DERIA5String) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 18 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DPolicyConstraints method okPressed.

private void okPressed() {
    int requireExplicitPolicy = -1;
    String requireExplicitPolicyStr = jtfRequireExplicitPolicy.getText().trim();
    if (requireExplicitPolicyStr.length() != 0) {
        try {
            requireExplicitPolicy = Integer.parseInt(requireExplicitPolicyStr);
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(this, res.getString("DPolicyConstraints.InvalidRequireExplicitPolicyValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
            return;
        }
        if (requireExplicitPolicy < 0) {
            JOptionPane.showMessageDialog(this, res.getString("DPolicyConstraints.InvalidRequireExplicitPolicyValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
            return;
        }
    }
    int inhibitPolicyMapping = -1;
    String inhibitPolicyMappingStr = jtfInhibitPolicyMapping.getText().trim();
    if (inhibitPolicyMappingStr.length() != 0) {
        try {
            inhibitPolicyMapping = Integer.parseInt(inhibitPolicyMappingStr);
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(this, res.getString("DPolicyConstraints.InvalidInhibitPolicyMappingValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
            return;
        }
        if (inhibitPolicyMapping < 0) {
            JOptionPane.showMessageDialog(this, res.getString("DPolicyConstraints.InvalidInhibitPolicyMappingValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
            return;
        }
    }
    if ((requireExplicitPolicy == -1) && (inhibitPolicyMapping == -1)) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyConstraints.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    PolicyConstraints policyConstraints = new PolicyConstraints(requireExplicitPolicy, inhibitPolicyMapping);
    try {
        value = policyConstraints.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : PolicyConstraints(org.kse.crypto.x509.PolicyConstraints) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 19 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DPrivateKeyUsagePeriod method okPressed.

private void okPressed() {
    Date notBefore = jdtNotBefore.getDateTime();
    Date notAfter = jdtNotAfter.getDateTime();
    if ((notBefore == null) && (notAfter == null)) {
        JOptionPane.showMessageDialog(this, res.getString("DPrivateKeyUsagePeriod.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    // BC forgot the value constructor for PrivateKeyUsagePeriod...
    ASN1EncodableVector v = new ASN1EncodableVector();
    if (notBefore != null) {
        DERGeneralizedTime notBeforeGenTime = new DERGeneralizedTime(notBefore);
        v.add(new DERTaggedObject(false, 0, notBeforeGenTime));
    }
    if (notAfter != null) {
        DERGeneralizedTime notAfterGenTime = new DERGeneralizedTime(notAfter);
        v.add(new DERTaggedObject(false, 1, notAfterGenTime));
    }
    PrivateKeyUsagePeriod privateKeyUsagePeriod = PrivateKeyUsagePeriod.getInstance(new DERSequence(v));
    try {
        value = privateKeyUsagePeriod.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) DERGeneralizedTime(org.bouncycastle.asn1.DERGeneralizedTime) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) IOException(java.io.IOException) Date(java.util.Date) PrivateKeyUsagePeriod(org.bouncycastle.asn1.x509.PrivateKeyUsagePeriod) DError(org.kse.gui.error.DError)

Example 20 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DSubjectAlternativeName method okPressed.

private void okPressed() {
    GeneralNames alternativeName = jgnAlternativeName.getGeneralNames();
    if (alternativeName.getNames().length == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DSubjectAlternativeName.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    try {
        value = alternativeName.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : JGeneralNames(org.kse.gui.crypto.generalname.JGeneralNames) GeneralNames(org.bouncycastle.asn1.x509.GeneralNames) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Aggregations

DError (org.kse.gui.error.DError)52 IOException (java.io.IOException)38 CryptoException (org.kse.crypto.CryptoException)11 DERIA5String (org.bouncycastle.asn1.DERIA5String)9 JFrame (javax.swing.JFrame)8 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)8 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)7 Container (java.awt.Container)6 JDialog (javax.swing.JDialog)6 X509Certificate (java.security.cert.X509Certificate)4 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)4 DERSequence (org.bouncycastle.asn1.DERSequence)4 GeneralNames (org.bouncycastle.asn1.x509.GeneralNames)4 PolicyInformation (org.bouncycastle.asn1.x509.PolicyInformation)4 PolicyQualifierInfo (org.bouncycastle.asn1.x509.PolicyQualifierInfo)4 JGeneralNames (org.kse.gui.crypto.generalname.JGeneralNames)4 Point (java.awt.Point)3 BigInteger (java.math.BigInteger)3 Date (java.util.Date)3 ArrayList (java.util.ArrayList)2