use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DAuthorityInformationAccess method okPressed.
private void okPressed() {
List<AccessDescription> accessDescriptions = jadAccessDescriptions.getAccessDescriptions();
if (accessDescriptions.size() == 0) {
JOptionPane.showMessageDialog(this, res.getString("DAuthorityInformationAccess.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
ASN1EncodableVector vec = new ASN1EncodableVector();
for (AccessDescription accessDescription : accessDescriptions) {
vec.add(accessDescription);
}
AuthorityInformationAccess authorityInformationAccess = AuthorityInformationAccess.getInstance(new DERSequence(vec));
try {
value = authorityInformationAccess.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 DAuthorityKeyIdentifier method prepopulateWithAuthorityCertDetails.
private void prepopulateWithAuthorityCertDetails(X500Name authorityCertName, BigInteger authorityCertSerialNumber) {
if (authorityCertName != null) {
try {
GeneralName generalName = new GeneralName(GeneralName.directoryName, authorityCertName);
GeneralNames generalNames = new GeneralNames(generalName);
jgnAuthorityCertIssuer.setGeneralNames(generalNames);
} catch (Exception ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
}
if (authorityCertSerialNumber != null) {
jtfAuthorityCertSerialNumber.setText("" + authorityCertSerialNumber.toString());
jtfAuthorityCertSerialNumber.setCaretPosition(0);
}
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DAuthorityKeyIdentifier method okPressed.
private void okPressed() {
byte[] keyIdentifier = jkiKeyIdentifier.getKeyIdentifier();
GeneralNames authorityCertIssuer = jgnAuthorityCertIssuer.getGeneralNames();
BigInteger authorityCertSerialNumber = null;
String authorityCertSerialNumberStr = jtfAuthorityCertSerialNumber.getText().trim();
if (authorityCertSerialNumberStr.length() != 0) {
try {
authorityCertSerialNumber = new BigInteger(authorityCertSerialNumberStr);
if (authorityCertSerialNumber.compareTo(BigInteger.ONE) < 0) {
JOptionPane.showMessageDialog(this, res.getString("DAuthorityKeyIdentifier.AuthorityCertSerialNumberNonZero.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(this, res.getString("DAuthorityKeyIdentifier.AuthorityCertSerialNumberNotInteger.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
}
// serial number are required
if ((keyIdentifier == null) && ((authorityCertIssuer.getNames().length == 0) || (authorityCertSerialNumber == null))) {
JOptionPane.showMessageDialog(this, res.getString("DAuthorityKeyIdentifier.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
AuthorityKeyIdentifier authorityKeyIdentifier;
if ((keyIdentifier != null) && (authorityCertSerialNumber == null)) {
// only key identifier
authorityKeyIdentifier = new AuthorityKeyIdentifier(keyIdentifier);
} else if (keyIdentifier == null) {
// only issuer / serial
authorityKeyIdentifier = new AuthorityKeyIdentifier(authorityCertIssuer, authorityCertSerialNumber);
} else {
// both
authorityKeyIdentifier = new AuthorityKeyIdentifier(keyIdentifier, authorityCertIssuer, authorityCertSerialNumber);
}
try {
value = authorityKeyIdentifier.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 DViewCertificate method pubKeyDetailsPressed.
private void pubKeyDetailsPressed() {
try {
X509Certificate cert = getSelectedCertificate();
DViewPublicKey dViewPublicKey = new DViewPublicKey(this, res.getString("DViewCertificate.PubKeyDetails.Title"), cert.getPublicKey());
dViewPublicKey.setLocationRelativeTo(this);
dViewPublicKey.setVisible(true);
} catch (CryptoException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
}
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DViewCrl method asn1DumpPressed.
private void asn1DumpPressed() {
try {
DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, crl);
dViewAsn1Dump.setLocationRelativeTo(this);
dViewAsn1Dump.setVisible(true);
} catch (Asn1Exception ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
}
}
Aggregations