Module signing tool problem

C:\Users\rshah\Downloads\module-signer-master\module-signer-master\target>java -jar module-signer-1.0.0-SNAPSHOT.jar -keystore=“C:\keyToFile\KeyStore.jks” -alias=tutorialpedia -keystore-pwd=****** -chain=“C:\Users\rshah\Documents\c
ert\1.p7b” -module-in=“C:\Users\rshah\Documents\workbp\Projects\ignition-sdk-examples\opc-ua-device\opc-ua-device-build\target\OPC-UA-Device-Example-unsigned.modl” -module-out=“C:\Users\rshah\Documents\workbp\Projects\ignition-sdk-e
xamples\opc-ua-device\opc-ua-device-build\target\OPC-UA-Device-Example-signed.modl”
Error: Unable to initialize main class com.inductiveautomation.ignitionsdk.ModuleSigner$Main
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser

need some help with this. Not sure what is the problem

Run target/module-signer-1.0.0-SNAPSHOT-jar-with-dependencies.jar instead. This jar has the dependencies bundled.

1 Like
  • I created the keystore using keytool : keytool -genkey -alias tutorialpedia -keyalg RSA -keyStore "C:\keyToFile\KeyStore.jks
  • then open the keystore in keystore explorer and exported the chain by right clicking on alias
  • then used the following command.
    C:\Users\rshah\Downloads\module-signer-master\module-signer-master\target>java -jar module-signer-1.0.0-SNAPSHOT-jar-with-dependencies.jar -keystore=“C:\keyToFile\KeyStore.jks” -alias=tutorialpedia -keystore-pwd=ramram -chain=“tut
    orialpedia.p7b” -module-in=“C:\Users\rshah\Documents\workbp\Projects\ignition-sdk-examples\opc-ua-device\opc-ua-device-build\target\OPC-UA-Device-Example-unsigned.modl” -module-out=“C:\Users\rshah\Documents\workbp\Projects\ignition-
    sdk-examples\opc-ua-device\opc-ua-device-build\target\OPC-UA-Device-Example-signed.modl”
    Exception in thread “main” java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
    at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:462)
    at java.base/sun.security.util.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:90)
    at java.base/java.security.KeyStore.getKey(KeyStore.java:1057)
    at com.inductiveautomation.ignitionsdk.ModuleSigner$Main.main(ModuleSigner.java:138)
    Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
    at java.base/com.sun.crypto.provider.CipherCore.unpad(CipherCore.java:975)
    at java.base/com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1056)
    at java.base/com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853)
    at java.base/com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:408)
    at java.base/com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede.engineDoFinal(PKCS12PBECipherCore.java:440)
    at java.base/javax.crypto.Cipher.doFinal(Cipher.java:2202)
    at java.base/sun.security.pkcs12.PKCS12KeyStore.lambda$engineGetKey$0(PKCS12KeyStore.java:406)
    at java.base/sun.security.pkcs12.PKCS12KeyStore$RetryWithZero.run(PKCS12KeyStore.java:302)
    at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:400)
    … 3 more

Try renaming the KeyStore so it ends with “.pfx” instead of “.jks”. The tool naively uses the extension to determine the format. If you used a recent version of Java to generate the keystore the format was PKCS12 (".pfx") by default.

edit: also, looks like you aren’t specifying the -alias-pwd param, which would be the same as your keystore pwd by default.

thank you so much kevin. that really helped. Have a good day!