File tree 1 file changed +8
-2
lines changed
jsign-core/src/main/java/net/jsign 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 24
24
import java .util .List ;
25
25
26
26
import sun .security .pkcs11 .wrapper .CK_SLOT_INFO ;
27
+ import sun .security .pkcs11 .wrapper .CK_TOKEN_INFO ;
27
28
import sun .security .pkcs11 .wrapper .PKCS11 ;
28
29
import sun .security .pkcs11 .wrapper .PKCS11Exception ;
29
30
@@ -48,7 +49,7 @@ static Provider getProvider(String name) {
48
49
/**
49
50
* Returns the SunPKCS11 configuration for OpenSC.
50
51
*
51
- * @param name the name of the token
52
+ * @param name the name or the slot id of the token
52
53
* @throws ProviderException thrown if the PKCS11 modules cannot be found
53
54
*/
54
55
static String getSunPKCS11Configuration (String name ) {
@@ -58,7 +59,12 @@ static String getSunPKCS11Configuration(String name) {
58
59
}
59
60
String configuration = "--name=opensc\n library = \" " + libpkcs11 .getAbsolutePath ().replace ("\\ " , "\\ \\ " ) + "\" \n " ;
60
61
try {
61
- long slot = getTokenSlot (libpkcs11 , name );
62
+ long slot ;
63
+ try {
64
+ slot = Integer .parseInt (name );
65
+ } catch (Exception e ) {
66
+ slot = getTokenSlot (libpkcs11 , name );
67
+ }
62
68
if (slot >= 0 ) {
63
69
configuration += "slot=" + slot ;
64
70
}
You can’t perform that action at this time.
0 commit comments