use of org.kse.crypto.signing.SignatureType in project keystore-explorer by kaikramer.
the class X509CertUtil method getCertificateSignatureAlgorithm.
/**
* For a given X.509 certificate get the algorithm of its signature. Useful
* as the JCE may return an unfriendly name. This method converts known
* "unfriendly names" to friendly names.
*
* @param cert
* The certificate
* @return The algorithm
*/
public static String getCertificateSignatureAlgorithm(X509Certificate cert) {
// Unfriendly JCE sig names may be actual JCE names or OIDs
String algorithm = cert.getSigAlgName();
SignatureType type = SignatureType.resolveJce(algorithm);
if (type != null) {
algorithm = type.friendly();
} else {
type = SignatureType.resolveOid(algorithm);
if (type != null) {
algorithm = type.friendly();
}
}
return algorithm;
}
use of org.kse.crypto.signing.SignatureType in project keystore-explorer by kaikramer.
the class SignCsrAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
FileOutputStream fos = null;
File caReplyFile = null;
try {
KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();
KeyStoreState currentState = history.getCurrentState();
String alias = kseFrame.getSelectedEntryAlias();
Password password = getEntryPassword(alias, currentState);
if (password == null) {
return;
}
KeyStore keyStore = currentState.getKeyStore();
PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias, password.toCharArray());
Certificate[] certs = keyStore.getCertificateChain(alias);
KeyPairType keyPairType = KeyPairUtil.getKeyPairType(privateKey);
File csrFile = chooseCsrFile();
if (csrFile == null) {
return;
}
PKCS10CertificationRequest pkcs10Csr = null;
Spkac spkacCsr = null;
try {
CryptoFileType fileType = CryptoFileUtil.detectFileType(new FileInputStream(csrFile));
if (fileType == CryptoFileType.PKCS10_CSR) {
pkcs10Csr = Pkcs10Util.loadCsr(new FileInputStream(csrFile));
if (!Pkcs10Util.verifyCsr(pkcs10Csr)) {
JOptionPane.showMessageDialog(frame, res.getString("SignCsrAction.NoVerifyPkcs10Csr.message"), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
return;
}
} else if (fileType == CryptoFileType.SPKAC_CSR) {
spkacCsr = new Spkac(new FileInputStream(csrFile));
if (!spkacCsr.verify()) {
JOptionPane.showMessageDialog(frame, res.getString("SignCsrAction.NoVerifySpkacCsr.message"), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
return;
}
} else {
JOptionPane.showMessageDialog(frame, MessageFormat.format(res.getString("SignCsrAction.FileNotRecognisedType.message"), csrFile), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
return;
}
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(frame, MessageFormat.format(res.getString("SignCsrAction.NotFile.message"), csrFile), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
return;
} catch (Exception ex) {
String problemStr = MessageFormat.format(res.getString("SignCsrAction.NoOpenCsr.Problem"), csrFile.getName());
String[] causes = new String[] { res.getString("SignCsrAction.NotCsr.Cause"), res.getString("SignCsrAction.CorruptedCsr.Cause") };
Problem problem = new Problem(problemStr, causes, ex);
DProblem dProblem = new DProblem(frame, res.getString("SignCsrAction.ProblemOpeningCsr.Title"), problem);
dProblem.setLocationRelativeTo(frame);
dProblem.setVisible(true);
return;
}
X509Certificate[] signingChain = X509CertUtil.orderX509CertChain(X509CertUtil.convertCertificates(certs));
X509Certificate signingCert = signingChain[0];
PublicKey publicKey = null;
X500Name subject = null;
DSignCsr dSignCsr = null;
Provider provider = history.getExplicitProvider();
if (pkcs10Csr != null) {
publicKey = new JcaPKCS10CertificationRequest(pkcs10Csr).getPublicKey();
subject = pkcs10Csr.getSubject();
dSignCsr = new DSignCsr(frame, pkcs10Csr, csrFile, privateKey, keyPairType, signingCert, provider);
} else {
publicKey = spkacCsr.getPublicKey();
subject = spkacCsr.getSubject().getName();
dSignCsr = new DSignCsr(frame, spkacCsr, csrFile, privateKey, keyPairType, signingCert, provider);
}
dSignCsr.setLocationRelativeTo(frame);
dSignCsr.setVisible(true);
X509CertificateVersion version = dSignCsr.getVersion();
SignatureType signatureType = dSignCsr.getSignatureType();
Date validityStart = dSignCsr.getValidityStart();
Date validityEnd = dSignCsr.getValidityEnd();
BigInteger serialNumber = dSignCsr.getSerialNumber();
caReplyFile = dSignCsr.getCaReplyFile();
X509ExtensionSet extensions = dSignCsr.getExtensions();
if (version == null) {
return;
}
X500Name issuer = X500NameUtils.x500PrincipalToX500Name(signingCert.getSubjectX500Principal());
// CA Reply is a cert with subject from CSR and issuer from signing cert's subject
X509CertificateGenerator generator = new X509CertificateGenerator(version);
X509Certificate caReplyCert = generator.generate(subject, issuer, validityStart, validityEnd, publicKey, privateKey, signatureType, serialNumber, extensions, provider);
X509Certificate[] caReplyChain = new X509Certificate[signingChain.length + 1];
caReplyChain[0] = caReplyCert;
// Add all of the signing chain to the reply
System.arraycopy(signingChain, 0, caReplyChain, 1, signingChain.length);
byte[] caCertEncoded = X509CertUtil.getCertsEncodedPkcs7(caReplyChain);
fos = new FileOutputStream(caReplyFile);
fos.write(caCertEncoded);
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(frame, MessageFormat.format(res.getString("SignJarAction.NoWriteFile.message"), caReplyFile), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
return;
} catch (Exception ex) {
DError.displayError(frame, ex);
return;
} finally {
IOUtils.closeQuietly(fos);
}
JOptionPane.showMessageDialog(frame, res.getString("SignCsrAction.SignCsrSuccessful.message"), res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.INFORMATION_MESSAGE);
}
use of org.kse.crypto.signing.SignatureType in project keystore-explorer by kaikramer.
the class DSignCsr method initComponents.
private void initComponents() throws CryptoException {
jlCsrFormat = new JLabel(res.getString("DSignCsr.jlCsrFormat.text"));
jtfCsrFormat = new JTextField(15);
jtfCsrFormat.setEditable(false);
jtfCsrFormat.setToolTipText(res.getString("DSignCsr.jtfCsrFormat.tooltip"));
jlCsrSubject = new JLabel(res.getString("DSignCsr.jlCsrSubject.text"));
jdnCsrSubject = new JDistinguishedName(res.getString("DSignCsr.Subject.Title"), 30, false);
jdnCsrSubject.setToolTipText(res.getString("DSignCsr.jdnCsrSubject.tooltip"));
jlCsrPublicKey = new JLabel(res.getString("DSignCsr.jlCsrPublicKey.text"));
jtfCsrPublicKey = new JTextField(15);
jtfCsrPublicKey.setEditable(false);
jtfCsrPublicKey.setToolTipText(res.getString("DSignCsr.jtfCsrPublicKey.tooltip"));
jbViewCsrPublicKeyDetails = new JButton();
jbViewCsrPublicKeyDetails.setToolTipText(res.getString("DSignCsr.jbViewCsrPublicKeyDetails.tooltip"));
jbViewCsrPublicKeyDetails.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("DSignCsr.jbViewCsrPublicKeyDetails.image")))));
jlCsrSignatureAlgorithm = new JLabel(res.getString("DSignCsr.jlCsrSignatureAlgorithm.text"));
jtfCsrSignatureAlgorithm = new JTextField(15);
jtfCsrSignatureAlgorithm.setEditable(false);
jtfCsrSignatureAlgorithm.setToolTipText(res.getString("DSignCsr.jtfCsrSignatureAlgorithm.tooltip"));
jlCsrChallenge = new JLabel(res.getString("DSignCsr.jlCsrChallenge.text"));
jtfCsrChallenge = new JTextField(15);
jtfCsrChallenge.setEditable(false);
jtfCsrChallenge.setToolTipText(res.getString("DSignCsr.jtfCsrChallenge.tooltip"));
populateCsrDetails();
jlVersion = new JLabel(res.getString("DSignCsr.jlVersion.text"));
jrbVersion1 = new JRadioButton(res.getString("DSignCsr.jrbVersion1.text"));
jrbVersion1.setToolTipText(res.getString("DSignCsr.jrbVersion1.tooltip"));
jrbVersion3 = new JRadioButton(res.getString("DSignCsr.jrbVersion3.text"));
jrbVersion3.setToolTipText(res.getString("DSignCsr.jrbVersion3.tooltip"));
jlSignatureAlgorithm = new JLabel(res.getString("DSignCsr.jlSignatureAlgorithm.text"));
jcbSignatureAlgorithm = new JComboBox<SignatureType>();
jcbSignatureAlgorithm.setMaximumRowCount(10);
DialogHelper.populateSigAlgs(signKeyPairType, this.signPrivateKey, provider, jcbSignatureAlgorithm);
jcbSignatureAlgorithm.setToolTipText(res.getString("DSignCsr.jcbSignatureAlgorithm.tooltip"));
Date now = new Date();
jlValidityStart = new JLabel(res.getString("DSignCsr.jlValidityStart.text"));
jdtValidityStart = new JDateTime(res.getString("DSignCsr.jdtValidityStart.text"), false);
jdtValidityStart.setDateTime(now);
jdtValidityStart.setToolTipText(res.getString("DSignCsr.jdtValidityStart.tooltip"));
jlValidityEnd = new JLabel(res.getString("DSignCsr.jlValidityEnd.text"));
jdtValidityEnd = new JDateTime(res.getString("DSignCsr.jdtValidityEnd.text"), false);
jdtValidityEnd.setDateTime(new Date(now.getTime() + TimeUnit.DAYS.toMillis(365)));
jdtValidityEnd.setToolTipText(res.getString("DSignCsr.jdtValidityEnd.tooltip"));
jlValidityPeriod = new JLabel(res.getString("DSignCsr.jlValidityPeriod.text"));
jvpValidityPeriod = new JValidityPeriod(JValidityPeriod.YEARS);
jvpValidityPeriod.setToolTipText(res.getString("DSignCsr.jvpValidityPeriod.tooltip"));
jvpValidityPeriod.addApplyActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Date startDate = jdtValidityStart.getDateTime();
if (startDate == null) {
startDate = new Date();
jdtValidityStart.setDateTime(startDate);
}
Date validityEnd = jvpValidityPeriod.getValidityEnd(startDate);
jdtValidityEnd.setDateTime(validityEnd);
}
});
jlSerialNumber = new JLabel(res.getString("DSignCsr.jlSerialNumber.text"));
jtfSerialNumber = new JTextField("" + generateSerialNumber(), 15);
jtfSerialNumber.setToolTipText(res.getString("DSignCsr.jtfSerialNumber.tooltip"));
jlCaReplyFile = new JLabel(res.getString("DSignCsr.jlCaReplyFile.text"));
jtfCaReplyFile = new JTextField(30);
jtfCaReplyFile.setToolTipText(res.getString("DSignCsr.jtfCaReplyFile.tooltip"));
populateCaReplyFileName();
jbBrowse = new JButton(res.getString("DSignCsr.jbBrowse.text"));
jbBrowse.setToolTipText(res.getString("DSignCsr.jbBrowse.tooltip"));
PlatformUtil.setMnemonic(jbBrowse, res.getString("DSignCsr.jbBrowse.mnemonic").charAt(0));
jbBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DSignCsr.this);
browsePressed();
} finally {
CursorUtil.setCursorFree(DSignCsr.this);
}
}
});
jbAddExtensions = new JButton(res.getString("DSignCsr.jbAddExtensions.text"));
jbAddExtensions.setMnemonic(res.getString("DSignCsr.jbAddExtensions.mnemonic").charAt(0));
jbAddExtensions.setToolTipText(res.getString("DSignCsr.jbAddExtensions.tooltip"));
jbAddExtensions.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DSignCsr.this);
addExtensionsPressed();
} finally {
CursorUtil.setCursorFree(DSignCsr.this);
}
}
});
jrbVersion3.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
jbAddExtensions.setEnabled(jrbVersion3.isSelected());
}
});
jrbVersion3.setSelected(true);
jbOK = new JButton(res.getString("DSignCsr.jbOK.text"));
jbCancel = new JButton(res.getString("DSignCsr.jbCancel.text"));
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
JPanel buttons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
JPanel jpCsr = new JPanel();
jpCsr.setBorder(new TitledBorder(new EtchedBorder(), res.getString("DSignCsr.jpCsrDetails.text")));
JPanel jpSignOptions = new JPanel();
jpSignOptions.setBorder(new TitledBorder(new EtchedBorder(), res.getString("DSignCsr.jpSigningOptions.text")));
// layout
getContentPane().setLayout(new MigLayout("fill", "", ""));
getContentPane().add(jpCsr, "grow, wrap");
getContentPane().add(jpSignOptions, "wrap unrel");
getContentPane().add(buttons, "growx");
jpCsr.setLayout(new MigLayout("fill", "[right]unrel[]", "[]unrel[]"));
jpCsr.add(jlCsrFormat, "");
jpCsr.add(jtfCsrFormat, "wrap");
jpCsr.add(jlCsrSubject, "");
jpCsr.add(jdnCsrSubject, "wrap");
jpCsr.add(jlCsrPublicKey, "");
jpCsr.add(jtfCsrPublicKey, "split 2");
jpCsr.add(jbViewCsrPublicKeyDetails, "wrap");
jpCsr.add(jlCsrSignatureAlgorithm, "");
jpCsr.add(jtfCsrSignatureAlgorithm, "wrap");
jpCsr.add(jlCsrChallenge, "");
jpCsr.add(jtfCsrChallenge, "wrap");
jpSignOptions.setLayout(new MigLayout("fill", "[right]unrel[]", "[]unrel[]"));
jpSignOptions.add(jlVersion, "");
jpSignOptions.add(jrbVersion1, "split 2");
jpSignOptions.add(jrbVersion3, "wrap");
jpSignOptions.add(jlSignatureAlgorithm, "");
jpSignOptions.add(jcbSignatureAlgorithm, "wrap");
jpSignOptions.add(jlValidityStart, "");
jpSignOptions.add(jdtValidityStart, "wrap");
jpSignOptions.add(jlValidityPeriod, "");
jpSignOptions.add(jvpValidityPeriod, "wrap");
jpSignOptions.add(jlValidityEnd, "");
jpSignOptions.add(jdtValidityEnd, "wrap");
jpSignOptions.add(jlSerialNumber, "");
jpSignOptions.add(jtfSerialNumber, "wrap");
jpSignOptions.add(jlCaReplyFile, "");
jpSignOptions.add(jtfCaReplyFile, "split 2");
jpSignOptions.add(jbBrowse, "wrap");
jpSignOptions.add(jbAddExtensions, "spanx, wrap");
jbViewCsrPublicKeyDetails.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DSignCsr.this);
pubKeyDetailsPressed();
} finally {
CursorUtil.setCursorFree(DSignCsr.this);
}
}
});
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setResizable(false);
getRootPane().setDefaultButton(jbOK);
pack();
}
use of org.kse.crypto.signing.SignatureType in project keystore-explorer by kaikramer.
the class DSignJar method initComponents.
private void initComponents(String signatureName) throws CryptoException {
jlInputJar = new JLabel(res.getString("DSignJar.jlInputJar.text"));
jtfInputJar = new JTextField(30);
jtfInputJar.setCaretPosition(0);
jtfInputJar.setToolTipText(res.getString("DSignJar.jtfInputJar.tooltip"));
jbInputJarBrowse = new JButton(res.getString("DSignJar.jbInputJarBrowse.text"));
PlatformUtil.setMnemonic(jbInputJarBrowse, res.getString("DSignJar.jbInputJarBrowse.mnemonic").charAt(0));
jbInputJarBrowse.setToolTipText(res.getString("DSignJar.jbInputJarBrowse.tooltip"));
jlSignDirectly = new JLabel(res.getString("DSignJar.jlSignDirectly.text"));
jcbSignDirectly = new JCheckBox();
jcbSignDirectly.setSelected(true);
jcbSignDirectly.setToolTipText(res.getString("DSignJar.jcbSignDirectly.tooltip"));
jlOutputJar = new JLabel(res.getString("DSignJar.jlOutputJar.text"));
jtfOutputJar = new JTextField(30);
jtfOutputJar.setEnabled(false);
jtfOutputJar.setCaretPosition(0);
jtfOutputJar.setToolTipText(res.getString("DSignJar.jtfOutputJar.tooltip"));
jbOutputJarBrowse = new JButton(res.getString("DSignJar.jbOutputJarBrowse.text"));
PlatformUtil.setMnemonic(jbOutputJarBrowse, res.getString("DSignJar.jbOutputJarBrowse.mnemonic").charAt(0));
jbOutputJarBrowse.setToolTipText(res.getString("DSignJar.jbOutputJarBrowse.tooltip"));
jbOutputJarBrowse.setEnabled(false);
jlSignatureName = new JLabel(res.getString("DSignJar.jlSignatureName.text"));
jtfSignatureName = new JTextField(convertSignatureName(signatureName), 15);
jtfSignatureName.setCaretPosition(0);
jtfSignatureName.setToolTipText(res.getString("DSignJar.jtfSignatureName.tooltip"));
jlSignatureAlgorithm = new JLabel(res.getString("DSignJar.jlSignatureAlgorithm.text"));
jcbSignatureAlgorithm = new JComboBox<SignatureType>();
DialogHelper.populateSigAlgs(signKeyPairType, this.signPrivateKey, provider, jcbSignatureAlgorithm);
jcbSignatureAlgorithm.setToolTipText(res.getString("DSignJar.jcbSignatureAlgorithm.tooltip"));
jlDigestAlgorithm = new JLabel(res.getString("DSignJar.jlDigestAlgorithm.text"));
jcbDigestAlgorithm = new JComboBox<DigestType>();
populateDigestAlgs();
jcbDigestAlgorithm.setToolTipText(res.getString("DSignJar.jcbDigestAlgorithm.tooltip"));
jlAddTimestamp = new JLabel(res.getString("DSignJar.jlAddTimestamp.text"));
jcbAddTimestamp = new JCheckBox();
jcbAddTimestamp.setSelected(false);
jcbAddTimestamp.setToolTipText(res.getString("DSignJar.jcbAddTimestamp.tooltip"));
jlTimestampServerUrl = new JLabel(res.getString("DSignJar.jlTimestampServerUrl.text"));
jcbTimestampServerUrl = new JComboBox<String>();
jcbTimestampServerUrl.setEditable(true);
jcbTimestampServerUrl.setEnabled(false);
jcbTimestampServerUrl.setToolTipText(res.getString("DSignJar.jcbTimestampServerUrl.tooltip"));
jcbTimestampServerUrl.setModel(new DefaultComboBoxModel<String>(getTsaUrls()));
jbOK = new JButton(res.getString("DSignJar.jbOK.text"));
jbCancel = new JButton(res.getString("DSignJar.jbCancel.text"));
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
// layout
Container pane = getContentPane();
pane.setLayout(new MigLayout("insets dialog, fill", "[para]unrel[right]unrel[]", "[]unrel[]"));
MiGUtil.addSeparator(pane, res.getString("DSignJar.jlFiles.text"));
pane.add(jlInputJar, "skip");
pane.add(jtfInputJar, "sgx");
pane.add(jbInputJarBrowse, "wrap");
pane.add(jlSignDirectly, "skip");
pane.add(jcbSignDirectly, "wrap");
pane.add(jlOutputJar, "skip");
pane.add(jtfOutputJar, "sgx");
pane.add(jbOutputJarBrowse, "wrap para");
MiGUtil.addSeparator(pane, res.getString("DSignJar.jlSignature.text"));
pane.add(jlSignatureName, "skip");
pane.add(jtfSignatureName, "sgx, wrap");
pane.add(jlSignatureAlgorithm, "skip");
pane.add(jcbSignatureAlgorithm, "sgx, wrap");
pane.add(jlDigestAlgorithm, "skip");
pane.add(jcbDigestAlgorithm, "sgx, wrap para");
MiGUtil.addSeparator(pane, res.getString("DSignJar.jlTimestamp.text"));
pane.add(jlAddTimestamp, "skip");
pane.add(jcbAddTimestamp, "wrap");
pane.add(jlTimestampServerUrl, "skip");
pane.add(jcbTimestampServerUrl, "sgx, wrap para");
pane.add(new JSeparator(), "spanx, growx, wrap para");
pane.add(jpButtons, "right, spanx");
// actions
jbInputJarBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DSignJar.this);
inputJarBrowsePressed();
} finally {
CursorUtil.setCursorFree(DSignJar.this);
}
}
});
jcbSignDirectly.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
jtfOutputJar.setEnabled(!jcbSignDirectly.isSelected());
jbOutputJarBrowse.setEnabled(!jcbSignDirectly.isSelected());
}
});
jbOutputJarBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DSignJar.this);
outputJarBrowsePressed();
} finally {
CursorUtil.setCursorFree(DSignJar.this);
}
}
});
jcbAddTimestamp.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
jcbTimestampServerUrl.setEnabled(jcbAddTimestamp.isSelected());
}
});
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setResizable(false);
getRootPane().setDefaultButton(jbOK);
pack();
setLocationRelativeTo(null);
}
use of org.kse.crypto.signing.SignatureType in project keystore-explorer by kaikramer.
the class DViewCsr method populatePkcs10CsrDetails.
private void populatePkcs10CsrDetails() throws CryptoException {
jtfFormat.setText(res.getString("DViewCsr.jtfFormat.Pkcs10.text"));
jtfFormat.setCaretPosition(0);
jdnSubject.setDistinguishedName(pkcs10Csr.getSubject());
jbPem.setEnabled(true);
jbAsn1.setEnabled(true);
Attribute[] extReqAttr = pkcs10Csr.getAttributes(pkcs_9_at_extensionRequest);
if (extReqAttr != null && extReqAttr.length > 0) {
jbExtensions.setEnabled(true);
} else {
jbExtensions.setEnabled(false);
}
DialogHelper.populatePkcs10Challenge(pkcs10Csr.getAttributes(), jtfChallenge);
DialogHelper.populatePkcs10UnstructuredName(pkcs10Csr.getAttributes(), jtfUnstructuredName);
populatePublicKey(getPkcs10PublicKey());
String sigAlgId = pkcs10Csr.getSignatureAlgorithm().getAlgorithm().getId();
SignatureType sigAlg = SignatureType.resolveOid(sigAlgId);
if (sigAlg != null) {
jtfSignatureAlgorithm.setText(sigAlg.friendly());
} else {
jtfSignatureAlgorithm.setText(sigAlgId);
}
jtfSignatureAlgorithm.setCaretPosition(0);
}
Aggregations