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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations