Skip to content

Commit

Permalink
Fixed the misnamed variables in the OpenSC code
Browse files Browse the repository at this point in the history
  • Loading branch information
ebourg committed Dec 7, 2023
1 parent 00f7a25 commit c009ea7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions jsign-core/src/main/java/net/jsign/OpenSC.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion jsign-core/src/test/java/net/jsign/OpenSCTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit c009ea7

Please sign in to comment.