Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getlist only works if the default language is English #6

Open
sboekhoff opened this issue Sep 13, 2016 · 0 comments
Open

getlist only works if the default language is English #6

sboekhoff opened this issue Sep 13, 2016 · 0 comments

Comments

@sboekhoff
Copy link
Contributor

Running e.g. keytool -list -keystore your-keystore.jks returns:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 11 entries

keypair9, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 8C:1D:A8:8B:F1:AA:7E:69:9E:81:E7:C4:0E:ED:0C:A9:9B:AE:BA:7A
keypair8, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): E9:D3:51:4C:2E:5B:49:EE:78:FA:12:1A:18:9E:5F:31:6E:91:18:EF
keypair7, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): B7:C9:3B:2E:77:8B:C1:99:6C:61:64:54:90:08:1A:9E:5F:65:B2:BF
keypair6, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 75:4C:06:AA:8D:AF:69:35:7D:AF:75:5C:B5:74:55:E2:70:A9:A6:02
keypair5, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 37:03:0E:7E:BD:B2:9D:26:DB:22:88:8C:57:95:E4:F4:44:24:DB:09
keypair4, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 11:36:F6:53:DC:3F:AC:C9:79:2D:BF:0A:90:BC:B8:D8:20:EA:BD:54
keypair3, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 75:CC:17:40:1A:B0:24:B8:19:B7:71:12:E8:ED:B8:35:FC:10:93:06
keypair2, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 5E:B5:75:F6:2D:C9:D0:E2:AC:48:5A:47:F4:C3:38:6C:16:BD:54:52
keypair1, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 84:DF:D9:88:BE:DB:E7:0C:54:F3:0F:5C:83:C9:10:75:DE:CF:4E:79
keypair0, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): BD:12:7B:B4:A6:00:37:E5:79:43:43:A9:D3:D3:9E:2F:F5:51:A4:29
keypair10, Sep 7, 2016, PrivateKeyEntry, 
Certificate fingerprint (SHA1): 06:8F:74:37:68:B4:75:AF:B2:81:F2:23:B2:7E:31:90:E2:AE:7C:52

If the default langue on the users system is e.g. German (export JAVA_TOOL_OPTIONS=-Duser.language=de) the output is:

Picked up JAVA_TOOL_OPTIONS: -Duser.language=de
Keystore-Kennwort eingeben:  

Keystore-Typ: JKS
Keystore-Provider: SUN

Keystore enthält 11 Einträge

keypair9, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 8C:1D:A8:8B:F1:AA:7E:69:9E:81:E7:C4:0E:ED:0C:A9:9B:AE:BA:7A
keypair8, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): E9:D3:51:4C:2E:5B:49:EE:78:FA:12:1A:18:9E:5F:31:6E:91:18:EF
keypair7, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): B7:C9:3B:2E:77:8B:C1:99:6C:61:64:54:90:08:1A:9E:5F:65:B2:BF
keypair6, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 75:4C:06:AA:8D:AF:69:35:7D:AF:75:5C:B5:74:55:E2:70:A9:A6:02
keypair5, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 37:03:0E:7E:BD:B2:9D:26:DB:22:88:8C:57:95:E4:F4:44:24:DB:09
keypair4, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 11:36:F6:53:DC:3F:AC:C9:79:2D:BF:0A:90:BC:B8:D8:20:EA:BD:54
keypair3, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 75:CC:17:40:1A:B0:24:B8:19:B7:71:12:E8:ED:B8:35:FC:10:93:06
keypair2, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 5E:B5:75:F6:2D:C9:D0:E2:AC:48:5A:47:F4:C3:38:6C:16:BD:54:52
keypair1, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 84:DF:D9:88:BE:DB:E7:0C:54:F3:0F:5C:83:C9:10:75:DE:CF:4E:79
keypair0, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): BD:12:7B:B4:A6:00:37:E5:79:43:43:A9:D3:D3:9E:2F:F5:51:A4:29
keypair10, 07.09.2016, PrivateKeyEntry, 
Zertifikat-Fingerprint (SHA1): 06:8F:74:37:68:B4:75:AF:B2:81:F2:23:B2:7E:31:90:E2:AE:7C:52

The parser of the -list-output in node-keytool (https://github.com/FrankGrimm/node-keytool/blob/master/lib/keytool.js#L176) uses language specific strings. See e.g.:

var PRE_STORETYPE = 'Keystore type: ';
var PRE_PROVIDER = 'Keystore provider: ';
var PRE_FINGERPRINT = 'Certificate fingerprint (';

Thus, parsing might not work on systems using a default language that is different from English.

A simple workaround is instantiating Keytool using extraargs:
For example use:

var store = Keytool(file, pass, {debug: false, storetype: 'JKS', extraargs: '-J-Duser.language=en'});

instead of:

var store = Keytool(file, pass, {debug: false, storetype: 'JKS'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant