2

it's my first post here. I would like to ask for help.

I have a problem with signing .jar application. I don't know how to specify alias in jarsigner command, which contains diacritic sign. I have a Code Signing certificate. My alias (Pa Zówka) contains ó letter - Latin Small Letter O with Acute. I'm using JDK 8u121. I've tried many combinantions, but every time I'm getting an error saying:

jarsigner: key associated with <my alias>. not a private key

I've tried to convert my alias to Unicode:

\u0050\u0061 \u007a\u00f3\u0077\u006b\u0061

or replace only this problematic letter:

Pa Z\u00f3wka

I've changed code page for Windows Command Line between 65001, 852 and 1252. Still the same error. This is my command:

jarsigner -keystore NONE -certchain subca.pem -tsa "http://server.time.pl" -storetype PKCS11 -providerClass sun.security.pkcs11.SunPKCS11 -providerArg "provider.cfg" "fileToSign.jar" "Pa Z\u00f3wka"

Certificate is stored on smart card, that's why I'm using PKCS11 and -keystore NONE. Provider.cfg contains slot settings for smart card.

I have also the same certificate whitout any diacritic signs, stored on another card and it works correctly.

Any suggestions greatly appreciated.

Paula
  • 21
  • 2
  • Can you try setting the charset using the Java command line? E.g. using `-Dfile.encoding=UTF-8`? You may have to play around with the `-Jjavaoption` of `jarsigner` to do so. – Maarten Bodewes Mar 26 '17 at 13:37
  • Possible duplicate of https://stackoverflow.com/questions/7660651/passing-command-line-unicode-argument-to-java-code. – VGR Apr 16 '18 at 15:27

1 Answers1

0

It won't work. You need to edit the CKA_LABEL field in the certificate so that it contains only ASCII characters. On Windows you can use the PKCS11Admin utility for this and on Linux you can use pkcs11-tool. Only then will it work. Instructions on how to do this with PKCS11Admin are here (starting on page 11-12): https://www.files.certum.eu/documents/manual_en/Code-Signing-signing-the-code-using-tools-like-Singtool-and-Jarsigner_v2.3.pdf

luka zaur
  • 1
  • 1
  • 1
    Thank you, this is actually my instruction I’ve made with my workmates after many tries. I confirm, it works, however it’s not easy… – Paula Aug 24 '23 at 19:10