When developing for Android and trying to create a keystore and display the fingerprint using keytool
% keytool -list -v -keystore android/certs/app.jks
Enter keystore password:
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: key0
Creation date: Dec 26, 2021
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=....
Issuer: CN=....
Serial number: 37...
Valid from: Sun Dec 26 11:29:11 JST 2021 until: Thu Dec 20 11:29:11 JST 2046
Certificate fingerprints:
MD5: AA:5C:31:23:...
SHA1: B1:41:37:24:...
SHA256: SHA256withRSA
Signature algorithm name: 2048-bit RSA key
Subject public key algorithm: 3
Version: {10}
Extensions:
If the fingerprint that should be displayed under SHA256 is not shown, and instead "SHA256withRSA..." continues without a newline, it is because the language is set to Japanese.
According to a StackOverflow answer, if the language is set to French or German, setting the shell variable LANG=C
should fix it. However, that alone did not work in my environment.
Referring to another StackOverflow answer, I added the option -J-Duser.language=en
to keytool, and it worked.
% keytool -J-Duser.language=en -list -v -keystore android/certs/app.jks
Enter keystore password:
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: key0
Creation date: Dec 26, 2021
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=...
Issuer: CN=...
Serial number: 37....
Valid from: Sun Dec 26 11:29:11 JST 2021 until: Thu Dec 20 11:29:11 JST 2046
Certificate fingerprints:
SHA1: AA:5C:31:...
SHA256: B1:41:37:...
Signature algorithm name: SHA256withRSA
After writing this, I realized that when the language is set to Japanese, the SHA256 fingerprint appears as a SHA1 fingerprint.
Comments