@Test
public void testLoadPrivateEncryptedKeyInvalidPassword() {

    // first try with no password
    try {
        Crypto.loadPrivateKey(privateEncryptedKey, null);
        fail();
    } catch (CryptoException ex) {
        assertTrue(ex.getMessage().contains("No password specified"));
    }
    // now let's try with invalid password
    try {
        Crypto.loadPrivateKey(privateEncryptedKey, "InvalidPassword");
        fail();
    } catch (CryptoException ex) {
        assertTrue(true, "Invalid password specified");
    }
}