### Question:
SecurityUtils { public static Key loadKey(HttpsConfig config) { if (config.getKeyStore() != null) { try { KeyStore ks = loadKeyStore(config); char[] keyPasswordInChars = config.getKeyPassword(); final Key key; if (config.getKeyAlias() != null) { key = ks.getKey(config.getKeyAlias(), keyPasswordInChars); } else { key = findFirstSecretKey(ks, keyPasswordInChars); } return key; } catch (NoSuchAlgorithmException | KeyStoreException | CertificateException | IOException | UnrecoverableKeyException e) { apimlLog.log("org.zowe.apiml.common.errorLoadingSecretKey", e.getMessage()); throw new HttpsConfigError(e.getMessage(), e, HttpsConfigError.ErrorCode.HTTP_CLIENT_INITIALIZATION_FAILED, config); } } return null; }  static String readSecret(HttpsConfig config); static Key loadKey(HttpsConfig config); static Certificate[] loadCertificateChain(HttpsConfig config); static Set<String> loadCertificateChainBase64(HttpsConfig config); static PublicKey loadPublicKey(HttpsConfig config); static Key findPrivateKeyByPublic(HttpsConfig config, byte[] publicKey); static KeyStore loadKeyStore(HttpsConfig config); static URL keyRingUrl(String uri, String trustStore); static String replaceFourSlashes(String storeUri); static KeyPair generateKeyPair(String algorithm, int keySize); static final String SAFKEYRING; }### Answer:
@Test public void testLoadKey() { HttpsConfig httpsConfig = httpsConfigBuilder.keyAlias(JWT_KEY_ALIAS).build(); Key secretKey = SecurityUtils.loadKey(httpsConfig); assertNotNull(secretKey); }
@Test(expected = HttpsConfigError.class) public void testLoadKeyWithIncorrectKeyPassword() { HttpsConfig httpsConfig = httpsConfigBuilder.keyAlias(JWT_KEY_ALIAS).keyPassword(WRONG_PARAMETER.toCharArray()).build(); Key secretKey = SecurityUtils.loadKey(httpsConfig); assertNull(secretKey); }