Java Code Examples for java.security.UnrecoverableKeyException#printStackTrace()

The following examples show how to use java.security.UnrecoverableKeyException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectedRESTQA.java    From java-client-api with Apache License 2.0 6 votes vote down vote up
public static DatabaseClient getDatabaseClient(String user, String password, Authentication authType)
		throws KeyManagementException, NoSuchAlgorithmException, IOException {
	DatabaseClient client = null;
	try {
		SSLContext sslcontext = null;
		if (IsSecurityEnabled()) {
			sslcontext = getSslContext();
			client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), user, password,
					authType, sslcontext, SSLHostnameVerifier.ANY);
		} else
			client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), user, password,
					authType);
	} catch (CertificateException certEx) {
		// TODO Auto-generated catch block
		certEx.printStackTrace();
	} catch (KeyStoreException ksEx) {
		// TODO Auto-generated catch block
		ksEx.printStackTrace();
	} catch (UnrecoverableKeyException unReovkeyEx) {
		// TODO Auto-generated catch block
		unReovkeyEx.printStackTrace();
	}
	return client;
}
 
Example 2
Source File: HttpsUtils.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private static KeyManager[] prepareKeyManager(InputStream bksFile, String password) {
    KeyManager[] keyManagerArr = null;
    if (bksFile == null || password == null) {
        return keyManagerArr;
    }
    try {
        KeyStore clientKeyStore = KeyStore.getInstance("BKS");
        clientKeyStore.load(bksFile, password.toCharArray());
        KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
        keyManagerFactory.init(clientKeyStore, password.toCharArray());
        return keyManagerFactory.getKeyManagers();
    } catch (KeyStoreException e) {
        e.printStackTrace();
        return keyManagerArr;
    } catch (NoSuchAlgorithmException e2) {
        e2.printStackTrace();
        return keyManagerArr;
    } catch (UnrecoverableKeyException e3) {
        e3.printStackTrace();
        return keyManagerArr;
    } catch (CertificateException e4) {
        e4.printStackTrace();
        return keyManagerArr;
    } catch (IOException e5) {
        e5.printStackTrace();
        return keyManagerArr;
    } catch (Exception e6) {
        e6.printStackTrace();
        return keyManagerArr;
    }
}
 
Example 3
Source File: AliasKeyManager.java    From PADListener with GNU General Public License v2.0 5 votes vote down vote up
public PrivateKey getPrivateKey(String alias) {
    try {
        return (PrivateKey) _ks.getKey(alias, _keyPassword.toCharArray());
    } catch (KeyStoreException kse) {
        kse.printStackTrace();
        return null;
    } catch (NoSuchAlgorithmException nsao) {
        nsao.printStackTrace();
        return null;
    } catch (UnrecoverableKeyException uke) {
        uke.printStackTrace();
        return null;
    }
}