diff --git a/README.md b/README.md index 192f0b57..87ee422b 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ See https://ebourg.github.io/jsign for more information. * The APPX/MSIX bundles are now signed with the correct Authenticode UUID * The error message displayed when the password of a PKCS#12 keystore is missing has been fixed * The log4j configuration warning displayed when signing a MSI file has been fixed (contributed by Pascal Davoust) +* The value of the `storetype` parameter is now case insensitive * API changes: * The PEFile class has been refactored to keep only the methods related to signing diff --git a/jsign-core/src/main/java/net/jsign/KeyStoreBuilder.java b/jsign-core/src/main/java/net/jsign/KeyStoreBuilder.java index d06e944a..5c47c2f6 100644 --- a/jsign-core/src/main/java/net/jsign/KeyStoreBuilder.java +++ b/jsign-core/src/main/java/net/jsign/KeyStoreBuilder.java @@ -119,7 +119,7 @@ public KeyStoreBuilder storetype(KeyStoreType storetype) { */ public KeyStoreBuilder storetype(String storetype) { try { - this.storetype = storetype != null ? KeyStoreType.valueOf(storetype) : null; + this.storetype = storetype != null ? KeyStoreType.valueOf(storetype.toUpperCase()) : null; } catch (IllegalArgumentException e) { String expectedTypes = Stream.of(KeyStoreType.values()) .filter(type -> type != NONE).map(KeyStoreType::name) diff --git a/jsign-core/src/test/java/net/jsign/KeyStoreBuilderTest.java b/jsign-core/src/test/java/net/jsign/KeyStoreBuilderTest.java index 6a155451..dd991f2d 100644 --- a/jsign-core/src/test/java/net/jsign/KeyStoreBuilderTest.java +++ b/jsign-core/src/test/java/net/jsign/KeyStoreBuilderTest.java @@ -423,4 +423,10 @@ public void testBuildPIV() throws Exception { KeyStore keystore = builder.build(); assertNotNull("keystore", keystore); } + + @Test + public void testLowerCaseStoreType() { + KeyStoreBuilder builder = new KeyStoreBuilder().storetype("pkcs12"); + assertEquals("storetype", PKCS12, builder.storetype()); + } }