Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
For reference, keytool performs this two-step configuration:
But apksigner assumes constructor initialization via the String parameter:
keytool and apksigner use different methods for obtaining the KeyStore Provider, but apksigner should be able to follow the same pattern as keytool after it constructs a new instance of the provider.
For reference, this is the Exception stacktrace I receive with apksigner from build-tools 28.0.2 (the code as linked above in apksig master is roughly the same, although it was moved to another file):
$ ./android-sdk-linux/build-tools/28.0.2/apksigner sign --provider-class sun.security.pkcs11.SunPKCS11 --provider-arg pkcs11_java.cfg --ks NONE --ks-type SunPKCS11-OpenSC-PKCS11 filename.apk
Exception in thread "main" java.lang.NoSuchMethodException: sun.security.pkcs11.SunPKCS11.<init>(java.lang.String)
at java.base/java.lang.Class.getConstructor0(Class.java:3350)
at java.base/java.lang.Class.getConstructor(Class.java:2152)
at com.android.apksigner.ApkSignerTool$ProviderInstallSpec.installProvider(ApkSignerTool.java:600)
at com.android.apksigner.ApkSignerTool$ProviderInstallSpec.access$400(ApkSignerTool.java:575)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:259)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:89)
$ ./android-sdk-linux/build-tools/28.0.2/apksigner --version
0.8
$ cat pkcs11_java.cfg
name = OpenSC-PKCS11
description = SunPKCS11 via OpenSC
library = /usr/lib64/opensc-pkcs11.so
slotListIndex = 0