Skip to content

Commit

Permalink
Update Spanish Resources (Store Password Preferences, Digest Algorith…
Browse files Browse the repository at this point in the history
…ms and Nonce Extension for OCSP, Sign File, View Signature, Viewer PKCS12)
  • Loading branch information
jgrateron authored Feb 1, 2025
1 parent 1afbbfa commit 63417a5
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 49 deletions.
4 changes: 3 additions & 1 deletion kse/src/main/java/org/kse/gui/actions/SignFileAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ protected void doAction() {
try (OutputStream os = new FileOutputStream(outputFile)) {
os.write(encoded);
}

JOptionPane.showMessageDialog(frame, res.getString("SignFileAction.SignFileSuccessful.message"),
res.getString("SignFileAction.SignFile.Title"),
JOptionPane.INFORMATION_MESSAGE);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.File;
import java.security.KeyStore;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JFileChooser;
Expand All @@ -37,6 +38,8 @@
* Button to update the keystore file path of an associated text field.
*/
public class JChangeKeyStorePathButton extends JButton {
private static final long serialVersionUID = 1324616391135888291L;
private static final ResourceBundle res = ResourceBundle.getBundle("org/kse/gui/preferences/resources");
private final JTextField keystorePathField;
private final PasswordManager passwordManager;

Expand All @@ -47,7 +50,7 @@ public class JChangeKeyStorePathButton extends JButton {
* @param passwordManager The password manager to update the keystore file path with
*/
public JChangeKeyStorePathButton(JTextField keystorePathField, PasswordManager passwordManager) {
super("Change...");
super(res.getString("DPreferences.storedPasswords.changeKeyStore.button.text"));
this.keystorePathField = keystorePathField;
this.passwordManager = passwordManager;
this.addActionListener(e -> {
Expand All @@ -65,9 +68,9 @@ private void changeKeyStorePath() {

JFileChooser chooser = FileChooserFactory.getKeyStoreFileChooser();
chooser.setCurrentDirectory(oldPath.getParentFile());
chooser.setDialogTitle("Select KeyStore File");
chooser.setDialogTitle(res.getString("DPreferences.storedPasswords.changeKeyStore.chooser.title"));
chooser.setMultiSelectionEnabled(false);
chooser.setApproveButtonText("Select");
chooser.setApproveButtonText(res.getString("DPreferences.storedPasswords.changeKeyStore.chooser.button"));

int rtnValue = chooser.showOpenDialog(this.getParent());
if (rtnValue == JFileChooser.APPROVE_OPTION) {
Expand All @@ -77,32 +80,32 @@ private void changeKeyStorePath() {
return;
}

if (passwordManager.isKeyStorePasswordKnown(newPath)) {
JOptionPane.showMessageDialog(this.getParent(),
"The selected KeyStore file is already stored in the password manager.",
"KeyStore file already in password manager",
JOptionPane.ERROR_MESSAGE);
return;
}
if (passwordManager.isKeyStorePasswordKnown(newPath)) {
JOptionPane.showMessageDialog(this.getParent(),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksPwdKnown.msg"),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksPwdKnown.tit"),
JOptionPane.ERROR_MESSAGE);
return;
}

passwordManager.getKeyStorePassword(oldPath).ifPresent(password -> {
try {
KeyStore keyStore = KeyStoreUtil.load(newPath, new Password(password));

if (keyStore == null) {
JOptionPane.showMessageDialog(this.getParent(),
"File does not seem to be a keystore.",
"Error opening KeyStore",
JOptionPane.ERROR_MESSAGE);
}
if (keyStore == null) {
JOptionPane.showMessageDialog(this.getParent(),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksLoad.err.msg"),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksLoad.err.tit"),
JOptionPane.ERROR_MESSAGE);
}

keystorePathField.setText(newPath.getAbsolutePath());
passwordManager.updateKeyStoreFilePath(oldPath, newPath);
} catch (Exception e1) {
JOptionPane.showMessageDialog(this.getParent(),
"Cannot open keystore with the password stored for the old path.",
"Error opening KeyStore",
JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(this.getParent(),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksLoad.ex.msg"),
res.getString("DPreferences.storedPasswords.changeKeyStore.ksLoad.ex.tit"),
JOptionPane.ERROR_MESSAGE);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JPasswordField;
Expand All @@ -29,14 +30,16 @@
* Special JButton to copy the content of an associated password field.
*/
public class JCopyPasswordButton extends JButton {
private static final long serialVersionUID = 8233303153730253088L;
private static final ResourceBundle res = ResourceBundle.getBundle("org/kse/gui/preferences/resources");
private final JPasswordField passwordField;

/**
* Constructor.
* @param passwordField the associated password field for the copy operation
*/
public JCopyPasswordButton(JPasswordField passwordField) {
super("Copy");
super(res.getString("DPreferences.storedPasswords.jCopyPasswordButton.text"));
this.passwordField = passwordField;
initializeButtonBehavior();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static javax.swing.JOptionPane.showConfirmDialog;

import java.io.File;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JOptionPane;
Expand All @@ -34,6 +35,8 @@
* Button to remove the keystore file path of an associated text field from the password manager.
*/
public class JRemoveKeyStoreButton extends JButton {
private static final long serialVersionUID = -4827685790679405898L;
private static final ResourceBundle res = ResourceBundle.getBundle("org/kse/gui/preferences/resources");
private final JTextField keystorePathField;
private final PasswordManager passwordManager;
private final Callback updateFormFields;
Expand All @@ -47,23 +50,22 @@ public class JRemoveKeyStoreButton extends JButton {
*/
public JRemoveKeyStoreButton(JTextField keystorePathField, PasswordManager passwordManager,
Callback updateFormFields) {
super("Remove...");
super(res.getString("DPreferences.storedPasswords.removeKeyStore.button.text"));
this.keystorePathField = keystorePathField;
this.passwordManager = passwordManager;
this.updateFormFields = updateFormFields;
this.addActionListener(e -> removeKeyStoreFromPasswordManager());
}

private void removeKeyStoreFromPasswordManager() {
int selected = showConfirmDialog(this.getParent(),
"Do you really want to remove the passwords for this keystore from the " +
"password manager?",
"Remove KeyStore",
JOptionPane.YES_NO_OPTION);
int selected = showConfirmDialog(this.getParent(),
res.getString("DPreferences.storedPasswords.removeKeyStore.confirm.msg"),
res.getString("DPreferences.storedPasswords.removeKeyStore.confirm.title"),
JOptionPane.YES_NO_OPTION);

if (selected != JOptionPane.YES_OPTION) {
return;
}
if (selected != JOptionPane.YES_OPTION) {
return;
}

passwordManager.removeKeyStore(new File(keystorePathField.getText()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
*/
package org.kse.gui.preferences;

import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JPasswordField;

/**
* Button to toggle the visibility of an associated password field.
*/
public class JToggleDisplayPasswordButton extends JButton {
private static final long serialVersionUID = 3222235201966932207L;
private static final ResourceBundle res = ResourceBundle.getBundle("org/kse/gui/preferences/resources");
private final JPasswordField passwordField;
private boolean visible = false;

Expand All @@ -34,7 +38,7 @@ public class JToggleDisplayPasswordButton extends JButton {
* @param passwordField the password field to toggle the visibility of
*/
public JToggleDisplayPasswordButton(JPasswordField passwordField) {
super("Show");
super(res.getString("DPreferences.storedPasswords.jtdPasswordButton.show.text"));
this.passwordField = passwordField;
initializeButtonBehavior();
}
Expand All @@ -43,11 +47,11 @@ private void initializeButtonBehavior() {
this.addActionListener(e -> {
if (visible) {
passwordField.setEchoChar('•');
setText("Show");
setText(res.getString("DPreferences.storedPasswords.jtdPasswordButton.show.text"));
} else {
// show plain text
passwordField.setEchoChar((char) 0);
setText("Hide");
setText(res.getString("DPreferences.storedPasswords.jtdPasswordButton.hide.text"));
}
visible = !visible;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ SignatureType.Sha3_512WithRsaAndMGF1=SHA3-512 con RSA y MGF1

SignatureType.Ed25519=Ed25519
SignatureType.Ed448=Ed448

CmsSignatureStatus.NOT_VERIFIED.text = No verificado
CmsSignatureStatus.NOT_VERIFIED.tooltip = La firma no se pudo verificar
CmsSignatureStatus.INVALID.text = Inv\u00E1lido
CmsSignatureStatus.INVALID.tooltip = La firma es inv\u00E1lida
CmsSignatureStatus.VALID_NOT_TRUSTED.text = V\u00E1lido - No confiable
CmsSignatureStatus.VALID_NOT_TRUSTED.tooltip= La firma es v\u00E1lida, pero el certificado del firmante no es de confianza.
CmsSignatureStatus.VALID_TRUSTED.text = V\u00E1lido
CmsSignatureStatus.VALID_TRUSTED.tooltip = La firma es v\u00E1lida
18 changes: 10 additions & 8 deletions kse/src/main/resources/org/kse/gui/actions/resources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,16 @@ SignJarAction.statusbar = Sign a Java Archive (JAR) using the Ke
SignJarAction.text = Sign JAR
SignJarAction.tooltip = Sign a JAR

SignFileAction.ChooseContent.Title = Choose Content File for Counter Signature
SignFileAction.ChooseContent.button = Select
SignFileAction.CounterSign.Title = Counter Sign
SignFileAction.NoContent.message = Counter signing requires the original content. The original file could not be detect, and it was not provided. Counter signing ''{0}'' is not possible.
SignFileAction.NoSignatures.message = ''{0}'' does not have any signatures to counter sign
SignFileAction.statusbar = Sign a file or counter sign a PKCS#7 signature using the Key Pair entry
SignFileAction.text = Sign File
SignFileAction.tooltip = Sign a file or counter sign a PKCS#7 signature
SignFileAction.ChooseContent.Title = Choose Content File for Counter Signature
SignFileAction.ChooseContent.button = Select
SignFileAction.CounterSign.Title = Counter Sign
SignFileAction.NoContent.message = Counter signing requires the original content. The original file could not be detect, and it was not provided. Counter signing ''{0}'' is not possible.
SignFileAction.NoSignatures.message = ''{0}'' does not have any signatures to counter sign
SignFileAction.statusbar = Sign a file or counter sign a PKCS#7 signature using the Key Pair entry
SignFileAction.text = Sign File
SignFileAction.tooltip = Sign a file or counter sign a PKCS#7 signature
SignFileAction.SignFileSuccessful.message = File successfully signed.
SignFileAction.SignFile.Title = Sign File

SignMidletAction.ReqRsaKeyPairMidletSigning.message = Only RSA key pairs can be used for MIDlet signing.
SignMidletAction.SignMidlet.Title = Sign MIDlet
Expand Down
23 changes: 23 additions & 0 deletions kse/src/main/resources/org/kse/gui/actions/resources_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,17 @@ SignJarAction.statusbar = Firmar un Archivo Java (JAR) usando la
SignJarAction.text = Firmar JAR
SignJarAction.tooltip = Firmar un JAR

SignFileAction.ChooseContent.Title = Seleccionar archivo de contenido para contrafirma
SignFileAction.ChooseContent.button = Seleccionar
SignFileAction.CounterSign.Title = Contrafirmar
SignFileAction.NoContent.message = La contrafirma requiere el contenido original. El archivo original no se pudo detectar y no fue proporcionado. No es posible contrafirmar ''{0}''.
SignFileAction.NoSignatures.message = ''{0}'' no tiene firmas para contrafirmar
SignFileAction.statusbar = Firmar un archivo o contrafirmar una firma PKCS#7 usando la entrada de par de claves
SignFileAction.text = Firmar archivo
SignFileAction.tooltip = Firmar un archivo o contrafirmar una firma PKCS#7
SignFileAction.SignFileSuccessful.message = Archivo firmado correctamente.
SignFileAction.SignFile.Title = Firmar archivo

SignMidletAction.ReqRsaKeyPairMidletSigning.message = Solo se pueden usar pares de claves RSA para la firma de MIDlet.
SignMidletAction.SignMidlet.Title = Firmar MIDlet
SignMidletAction.SignMidletSuccessful.message = Firma de MIDlet Exitosa.
Expand Down Expand Up @@ -678,6 +689,18 @@ VerifyCertificateAction.tryLater.message = Int\u00E9ntelo de nuevo
VerifyCertificateAction.unauthorized.message = Solicitud no autorizada
VerifyCertificateAction.unknownStatus.message = Estado desconocido {0}

VerifySignatureAction.SignatureDetailsFile.Title = Detalles de la firma para el archivo ''{0}''
VerifySignatureAction.ChooseContent.Title = Seleccionar archivo de contenido
VerifySignatureAction.ChooseContent.button = Seleccionar
VerifySignatureAction.ChooseSignature.Title = Seleccionar archivo de firma
VerifySignatureAction.ChooseSignature.button = Verificar
VerifySignatureAction.NoExtractCertificates.message = No se pudieron extraer certificados del KeyStore.
VerifySignatureAction.NoSignatures.message = ''{0}'' no tiene firmas para verificar
VerifySignatureAction.VerifySignature.Title = Verificar firma PKCS#7/CMS
VerifySignatureAction.statusbar = Verificar una firma PKCS#7/CMS
VerifySignatureAction.text = Verificar firma PKCS#7/CMS
VerifySignatureAction.tooltip = Verificar firma PKCS#7/CMS

WebsiteAction.GitHubIssueTracker.statusbar = Crear un informe de error o una solicitud de caracter\u00EDstica
WebsiteAction.GitHubIssueTracker.text = Informes de errores / Solicitudes de caracter\u00EDsticas
WebsiteAction.GitHubIssueTracker.tooltip = Informes de errores / Solicitudes de caracter\u00EDsticas
Expand Down
Loading

0 comments on commit 63417a5

Please sign in to comment.