Skip to content

Commit

Permalink
Case insensitive storetype (Fixes #115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebourg committed Mar 22, 2024
1 parent 6ed7a44 commit 9c4b37e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion jsign-core/src/main/java/net/jsign/KeyStoreBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions jsign-core/src/test/java/net/jsign/KeyStoreBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 9c4b37e

Please sign in to comment.