# Module signing tool problem

**URL:** <https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503>\
**Category:** Module Development\
**Created:** [July 8, 2020, 5:14pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503 "2020-07-08T17:14:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rshah18](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@rshah18](https://forum.inductiveautomation.com/u/rshah18)\
**Post date:** [July 8, 2020, 5:14pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503/1 "2020-07-08T17:14:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 8, 2020, 5:19pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503/2 "2020-07-08T17:19:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rshah18](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@rshah18](https://forum.inductiveautomation.com/u/rshah18)\
**Post date:** [July 8, 2020, 5:39pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503/3 "2020-07-08T17:39:50Z")

</div>

- 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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 8, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503/4 "2020-07-08T17:47:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rshah18](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@rshah18](https://forum.inductiveautomation.com/u/rshah18)\
**Post date:** [July 8, 2020, 5:55pm UTC](https://forum.inductiveautomation.com/t/module-signing-tool-problem/36503/5 "2020-07-08T17:55:31Z")

</div>

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