Skip to content

Commit

Permalink
Fallback to BKS when JKS is not available
Browse files Browse the repository at this point in the history
This is the case on e.g. Android. BKS is BouncyCastles JKS-compatible implementation of a KeyStore
  • Loading branch information
LittleFox94 committed Jan 20, 2021
1 parent fbc53f8 commit dd0904a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion util/src/main/java/io/kubernetes/client/util/SSLUtils.java
Expand Up @@ -179,7 +179,17 @@ public static KeyStore createKeyStore(

PrivateKey privateKey = loadKey(keyInputStream, clientKeyAlgo);

KeyStore keyStore = KeyStore.getInstance("JKS");
KeyStore keyStore;
try {
keyStore = KeyStore.getInstance("JKS");
}
catch(KeyStoreException e) {
// Not having an instance of JKS happens on Android, for example.
// Since we rely on BouncyCastle anyway, let's try BKS instead
// (which is BouncyCastle's JKS compatible provider).
keyStore = KeyStore.getInstance("BKS");
}

if (keyStoreFile != null && keyStoreFile.length() > 0) {
keyStore.load(new FileInputStream(keyStoreFile), keyStorePassphrase);
} else {
Expand Down

0 comments on commit dd0904a

Please sign in to comment.