Skip to content

Commit

Permalink
Fixed problems when entry name column is not displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikramer committed Sep 17, 2018
1 parent fe1942d commit d642771
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 43 deletions.
48 changes: 24 additions & 24 deletions kse/src/org/kse/gui/KeyStoreTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt
}
}

if (iNameColumn>0) {
if (iNameColumn > 0) {
// Alias column
data[i][iNameColumn] = alias;
if (alias.length()> iColWidth[iNameColumn]) {
if (alias.length() > iColWidth[iNameColumn]) {
iColWidth[iNameColumn] = alias.length();
}
}
Expand All @@ -205,26 +205,26 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt

if (keyInfo != null) {
// Algorithm column
if (iAlgorithmColumn>0) {
if (iAlgorithmColumn > 0) {
data[i][iAlgorithmColumn] = getAlgorithmName(keyInfo);
if (iColWidth[iAlgorithmColumn] < data[i][iAlgorithmColumn].toString().length() ) {
if (iColWidth[iAlgorithmColumn] < data[i][iAlgorithmColumn].toString().length()) {
iColWidth[iAlgorithmColumn] = data[i][iAlgorithmColumn].toString().length();
}
}

// Key Size column
if (iKeySizeColumn>0) {
if (iKeySizeColumn > 0) {
data[i][iKeySizeColumn] = keyInfo.getSize();
}
// Key Size column
if (keyStoreTableColumns.getEnableCurve()) {
data[i][iCurveColumn] = keyInfo.getDetailedAlgorithm();
if (iColWidth[iCurveColumn] < data[i][iCurveColumn].toString().length() ) {
if (iColWidth[iCurveColumn] < data[i][iCurveColumn].toString().length()) {
iColWidth[iCurveColumn] = data[i][iCurveColumn].toString().length();
}
}
}
if (iCertExpiryColumn>0) {
if (iCertExpiryColumn > 0) {
// Expiry date column
if (expiry != null) {

Expand All @@ -234,7 +234,7 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt
// be a key entry
}
}
if (iLastModifiedColumn>0) {
if (iLastModifiedColumn > 0) {
// Modified date column - only applies to non-PKCS #11/#12
// KeyStores
if (!keyStore.getType().equals(KeyStoreType.PKCS12.jce())
Expand All @@ -244,59 +244,59 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt
data[i][iLastModifiedColumn] = null;
}
}
if (iSubjectDNColumn>0) {
if (iSubjectDNColumn > 0) {
if (entryType != KEY_ENTRY) {
data[i][iSubjectDNColumn] = getCertificateSubjectDN( alias, keyStore) ;
data[i][iSubjectDNColumn] = getCertificateSubjectDN(alias, keyStore);
if (iColWidth[iSubjectDNColumn] < data[i][iSubjectDNColumn].toString().length()) {
iColWidth[iSubjectDNColumn] = data[i][iSubjectDNColumn].toString().length();
}
} else {
data[i][iSubjectDNColumn] = null;
}
}
if (iIssuerDNColumn>0) {
if (iIssuerDNColumn > 0) {
if (entryType != KEY_ENTRY) {
data[i][iIssuerDNColumn] = getCertificateIssuerDN( alias, keyStore) ;
data[i][iIssuerDNColumn] = getCertificateIssuerDN(alias, keyStore);
if (iColWidth[iIssuerDNColumn] < data[i][iIssuerDNColumn].toString().length()) {
iColWidth[iIssuerDNColumn] = data[i][iIssuerDNColumn].toString().length();
}
} else {
data[i][iIssuerDNColumn] = null;
}
}
if (iSubjectCNColumn>0) {
if (iSubjectCNColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iSubjectCNColumn] = getCertificateSubjectCN( alias, keyStore) ;
data[i][iSubjectCNColumn] = getCertificateSubjectCN(alias, keyStore);
if (iColWidth[iSubjectCNColumn] < data[i][iSubjectCNColumn].toString().length()) {
iColWidth[iSubjectCNColumn] = data[i][iSubjectCNColumn].toString().length();
}
} else {
data[i][iSubjectCNColumn] = null;
}
}
if (iIssuerCNColumn>0) {
if (iIssuerCNColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iIssuerCNColumn] = getCertificateIssuerCN( alias, keyStore) ;
data[i][iIssuerCNColumn] = getCertificateIssuerCN(alias, keyStore);
if (iColWidth[iIssuerCNColumn] < data[i][iIssuerCNColumn].toString().length()) {
iColWidth[iIssuerCNColumn] = data[i][iIssuerCNColumn].toString().length();
}
} else {
data[i][iIssuerCNColumn] = null;
}
}
if (iSubjectOColumn>0) {
if (iSubjectOColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iSubjectOColumn] = getCertificateSubjectO( alias, keyStore) ;
data[i][iSubjectOColumn] = getCertificateSubjectO(alias, keyStore);
if (iColWidth[iSubjectOColumn] < data[i][iSubjectOColumn].toString().length()) {
iColWidth[iSubjectOColumn] = data[i][iSubjectOColumn].toString().length();
}
} else {
data[i][iSubjectOColumn] = null;
}
}
if (iIssuerOColumn>0) {
if (iIssuerOColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iIssuerOColumn] = getCertificateIssuerO( alias, keyStore) ;
data[i][iIssuerOColumn] = getCertificateIssuerO(alias, keyStore);
if (iColWidth[iIssuerOColumn] < data[i][iIssuerOColumn].toString().length()) {
iColWidth[iIssuerOColumn] = data[i][iIssuerOColumn].toString().length();
}
Expand All @@ -305,9 +305,9 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt
data[i][iIssuerOColumn] = null;
}
}
if (iAKIColumn>0) {
if (iAKIColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iAKIColumn] = getCertificateAKI( alias, keyStore) ;
data[i][iAKIColumn] = getCertificateAKI(alias, keyStore);
if (iColWidth[iAKIColumn] < data[i][iAKIColumn].toString().length()) {
iColWidth[iAKIColumn] = data[i][iAKIColumn].toString().length();
}
Expand All @@ -316,9 +316,9 @@ public void load(KeyStoreHistory history) throws GeneralSecurityException, Crypt
data[i][iAKIColumn] = null;
}
}
if (iSKIColumn>0) {
if (iSKIColumn > 0) {
if (entryType != KEY_ENTRY) { // assume a certificate
data[i][iSKIColumn] = getCertificateSKI( alias, keyStore) ;
data[i][iSKIColumn] = getCertificateSKI(alias, keyStore);
if (iColWidth[iSKIColumn] < data[i][iSKIColumn].toString().length()) {
iColWidth[iSKIColumn] = data[i][iSKIColumn].toString().length();
}
Expand Down
4 changes: 3 additions & 1 deletion kse/src/org/kse/gui/dialogs/DPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,9 @@ private void initDisplayColumnsTab() {

bEnableEntryName = kstColumns.getEnableEntryName();
jcbEnableEntryName = new JCheckBox(res.getString("DPreferences.jcbEnableEntryName.text"), bEnableEntryName);
jcbEnableEntryName.setSelected(bEnableEntryName);
// fix for problem that without entry name a lot of things do not work
jcbEnableEntryName.setSelected(true);
jcbEnableEntryName.setEnabled(false);

bEnableAlgorithm = kstColumns.getEnableAlgorithm();
jcbEnableAlgorithm = new JCheckBox(res.getString("DPreferences.jcbEnableAlgorithm.text"), bEnableAlgorithm);
Expand Down
2 changes: 1 addition & 1 deletion kse/src/org/kse/gui/dialogs/extensions/DAddExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private void updateButtonControls() {
}

private void selectStandardTemplatePressed() {
DSelectStdCertTemplate dSelectStdCertTemplate = new DSelectStdCertTemplate(this, authorityPublicKey,
DSelectStandardExtensionTemplate dSelectStdCertTemplate = new DSelectStandardExtensionTemplate(this, authorityPublicKey,
subjectPublicKey);
dSelectStdCertTemplate.setLocationRelativeTo(this);
dSelectStdCertTemplate.setVisible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* Allows selection of X.509 Extensions to add to a certificate.
*
*/
public class DSelectStdCertTemplate extends JEscDialog {
public class DSelectStandardExtensionTemplate extends JEscDialog {
private static final long serialVersionUID = 1L;

private static ResourceBundle res = ResourceBundle.getBundle("org/kse/gui/dialogs/extensions/resources");
Expand All @@ -90,39 +90,39 @@ public class DSelectStdCertTemplate extends JEscDialog {
private PublicKey subjectPublicKey;

/**
* Creates a new DSelectStdCertTemplate dialog.
* Creates a new DSelectStandardExtensionTemplate dialog.
*
* @param parent
* Parent frame
* @param title
* The dialog title
*/
public DSelectStdCertTemplate(JDialog parent, PublicKey authorityPublicKey, PublicKey subjectPublicKey) {
public DSelectStandardExtensionTemplate(JDialog parent, PublicKey authorityPublicKey, PublicKey subjectPublicKey) {
super(parent, Dialog.ModalityType.DOCUMENT_MODAL);
this.authorityPublicKey = authorityPublicKey;
this.subjectPublicKey = subjectPublicKey;
setTitle(res.getString("DSelectStdCertTemplate.Title"));
setTitle(res.getString("DSelectStandardExtensionTemplate.Title"));
initComponents();
}

private void initComponents() {

jrbCA = new JRadioButton(res.getString("DSelectStdCertTemplate.jrbCA.text"), false);
PlatformUtil.setMnemonic(jrbCA, res.getString("DSelectStdCertTemplate.jrbCA.mnemonic").charAt(0));
jrbCA.setToolTipText(res.getString("DSelectStdCertTemplate.jrbCA.tooltip"));
jrbCA = new JRadioButton(res.getString("DSelectStandardExtensionTemplate.jrbCA.text"), false);
PlatformUtil.setMnemonic(jrbCA, res.getString("DSelectStandardExtensionTemplate.jrbCA.mnemonic").charAt(0));
jrbCA.setToolTipText(res.getString("DSelectStandardExtensionTemplate.jrbCA.tooltip"));
jrbCA.setSelected(true);

jrbSslServer = new JRadioButton(res.getString("DSelectStdCertTemplate.jrbSslServer.text"), false);
PlatformUtil.setMnemonic(jrbSslServer, res.getString("DSelectStdCertTemplate.jrbSslServer.mnemonic").charAt(0));
jrbSslServer.setToolTipText(res.getString("DSelectStdCertTemplate.jrbSslServer.tooltip"));
jrbSslServer = new JRadioButton(res.getString("DSelectStandardExtensionTemplate.jrbSslServer.text"), false);
PlatformUtil.setMnemonic(jrbSslServer, res.getString("DSelectStandardExtensionTemplate.jrbSslServer.mnemonic").charAt(0));
jrbSslServer.setToolTipText(res.getString("DSelectStandardExtensionTemplate.jrbSslServer.tooltip"));

jrbSslClient = new JRadioButton(res.getString("DSelectStdCertTemplate.jrbSslClient.text"), false);
PlatformUtil.setMnemonic(jrbSslClient, res.getString("DSelectStdCertTemplate.jrbSslClient.mnemonic").charAt(0));
jrbSslClient.setToolTipText(res.getString("DSelectStdCertTemplate.jrbSslClient.tooltip"));
jrbSslClient = new JRadioButton(res.getString("DSelectStandardExtensionTemplate.jrbSslClient.text"), false);
PlatformUtil.setMnemonic(jrbSslClient, res.getString("DSelectStandardExtensionTemplate.jrbSslClient.mnemonic").charAt(0));
jrbSslClient.setToolTipText(res.getString("DSelectStandardExtensionTemplate.jrbSslClient.tooltip"));

jrbCodeSigning = new JRadioButton(res.getString("DSelectStdCertTemplate.jrbCodeSigning.text"), false);
PlatformUtil.setMnemonic(jrbCodeSigning, res.getString("DSelectStdCertTemplate.jrbCodeSigning.mnemonic").charAt(0));
jrbCodeSigning.setToolTipText(res.getString("DSelectStdCertTemplate.jrbCodeSigning.tooltip"));
jrbCodeSigning = new JRadioButton(res.getString("DSelectStandardExtensionTemplate.jrbCodeSigning.text"), false);
PlatformUtil.setMnemonic(jrbCodeSigning, res.getString("DSelectStandardExtensionTemplate.jrbCodeSigning.mnemonic").charAt(0));
jrbCodeSigning.setToolTipText(res.getString("DSelectStandardExtensionTemplate.jrbCodeSigning.tooltip"));

ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(jrbCA);
Expand Down Expand Up @@ -281,7 +281,7 @@ public static void main(String[] args) throws Exception {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
DSelectStdCertTemplate dialog = new DSelectStdCertTemplate(new JDialog(),
DSelectStandardExtensionTemplate dialog = new DSelectStandardExtensionTemplate(new JDialog(),
issuerKP.getPublic(), subjectKP.getPublic());
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
Expand Down

0 comments on commit d642771

Please sign in to comment.