From c009ea7efae8132d9b385c075063df7e403e159b Mon Sep 17 00:00:00 2001 From: Emmanuel Bourg Date: Thu, 7 Dec 2023 16:30:53 +0100 Subject: [PATCH] Fixed the misnamed variables in the OpenSC code --- jsign-core/src/main/java/net/jsign/OpenSC.java | 16 ++++++++-------- .../src/test/java/net/jsign/OpenSCTest.java | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jsign-core/src/main/java/net/jsign/OpenSC.java b/jsign-core/src/main/java/net/jsign/OpenSC.java index 035707f8..17f508e3 100644 --- a/jsign-core/src/main/java/net/jsign/OpenSC.java +++ b/jsign-core/src/main/java/net/jsign/OpenSC.java @@ -53,17 +53,17 @@ static Provider getProvider(String name) { * @throws ProviderException thrown if the PKCS11 modules cannot be found */ static String getSunPKCS11Configuration(String name) { - File libpkcs11 = getOpenSCLibrary(); - if (!libpkcs11.exists()) { - throw new ProviderException("OpenSC PKCS11 module is not installed (" + libpkcs11 + " is missing)"); + File library = getOpenSCLibrary(); + if (!library.exists()) { + throw new ProviderException("OpenSC PKCS11 module is not installed (" + library + " is missing)"); } - String configuration = "--name=opensc\nlibrary = \"" + libpkcs11.getAbsolutePath().replace("\\", "\\\\") + "\"\n"; + String configuration = "--name=opensc\nlibrary = \"" + library.getAbsolutePath().replace("\\", "\\\\") + "\"\n"; try { long slot; try { slot = Integer.parseInt(name); } catch (Exception e) { - slot = getTokenSlot(libpkcs11, name); + slot = getTokenSlot(library, name); } if (slot >= 0) { configuration += "slot=" + slot; @@ -150,9 +150,9 @@ static File getOpenSCLibrary() { } for (String path : paths) { - File libpkcs11 = new File(path); - if (libpkcs11.exists()) { - return libpkcs11; + File library = new File(path); + if (library.exists()) { + return library; } } diff --git a/jsign-core/src/test/java/net/jsign/OpenSCTest.java b/jsign-core/src/test/java/net/jsign/OpenSCTest.java index 9bc24e0c..133b76ae 100644 --- a/jsign-core/src/test/java/net/jsign/OpenSCTest.java +++ b/jsign-core/src/test/java/net/jsign/OpenSCTest.java @@ -27,7 +27,7 @@ public class OpenSCTest { private void assumeOpenSC() { - Assume.assumeTrue("libykcs11 isn't installed", + Assume.assumeTrue("opensc-pkcs11 isn't installed", new File(System.getenv("ProgramFiles") + "/OpenSC Project/OpenSC/pkcs11/opensc-pkcs11.dll").exists() || new File("/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so").exists()); }