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

KeyStoreSource doesn't use provided type #1679

Open
kingsfleet opened this issue Oct 26, 2021 · 0 comments
Open

KeyStoreSource doesn't use provided type #1679

kingsfleet opened this issue Oct 26, 2021 · 0 comments

Comments

@kingsfleet
Copy link

We are using to wiremock-standalone-8 version 2.31 to create a wire mock instance locally and found that we needed to override the keystore type but that the standard KeyStoreSource didn't use the provided type:

public KeyStore load() {
    InputStream instream = null;
    try {
        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
        instream = createInputStream();
        trustStore.load(instream, keyStorePassword);
        return trustStore;
    } catch (Exception e) {
        return throwUnchecked(e, KeyStore.class);
    } finally {
        if (instream != null) {
            try {
                instream.close();
            } catch (IOException ioe) {
                throwUnchecked(ioe);
            }
        }
    }
}

The line should be:

KeyStore trustStore = KeyStore.getInstance(keyStoreType);

This is a problem when working on a FIPS system because the default keystrokes have to be a particular BouncyCastle type.

kaarefc pushed a commit to kaarefc/wiremock that referenced this issue Oct 26, 2022
Use the provided keyStoreType when loading keystores.
Note that documentation in https://wiremock.org/docs/https/ doesn't actually work - keystores are always attempted to be loaded with the default keystore type.
This seems to be a regression. The type is respected in the Java 7 version of wiremock 2.27.2.
tomakehurst pushed a commit that referenced this issue Mar 28, 2023
Use the provided keyStoreType when loading keystores.
Note that documentation in https://wiremock.org/docs/https/ doesn't actually work - keystores are always attempted to be loaded with the default keystore type.
This seems to be a regression. The type is respected in the Java 7 version of wiremock 2.27.2.

Co-authored-by: Kåre Fiedler Christiansen <Kaare.Christiansen@cryptomathic.com>
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