Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ public synchronized PrivateKey getPrivateKey(PublicKey publicKey) {
if (this.keyStore.isKeyEntry(alias)) {
X509Certificate cert = (X509Certificate) this.keyStore.getCertificate(alias);
if (cert.getPublicKey().equals(publicKey)) {
String _alias = this.keyStore.getCertificateAlias(cert);
return (PrivateKey) this.keyStore.getKey(_alias, PASSPHRASE);
// Use the alias we just matched. Re-deriving it with
// getCertificateAlias() returns the *first* alias holding
// this certificate, which need not be this one, and can
// also resolve to a trustedCertEntry that has no key.
return (PrivateKey) this.keyStore.getKey(alias, PASSPHRASE);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/uk/ngs/certwizard/gui/MainWindowPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,12 @@ private void updateGUIPanel() {
}

Format formatter;
formatter = new SimpleDateFormat("EEE MMM dd HH:mm yyyy");
// Display only - never parsed, stored or sent, so British rendering
// is deliberate even though it writes "Sept" where the certificate
// itself says "Sep". Do not "correct" this to Locale.US. Pinned
// rather than left to the default so the panel reads the same on a
// machine configured for, say, th-TH (Buddhist calendar) or ar-SA.
formatter = new SimpleDateFormat("EEE MMM dd HH:mm yyyy", Locale.UK);
if (selectedKeyStoreEntry.getNotBefore() != null) {
this.vFromTo.setText(formatter.format(selectedKeyStoreEntry.getNotBefore())
+ " / "
Expand Down
Loading