Java Code Examples for java.security.InvalidKeyException.printStackTrace()

The following are Jave code examples for showing how to use printStackTrace() of the java.security.InvalidKeyException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 2
Project: DecompiledMinecraft   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 3
Project: BaseClient   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 4
Project: BaseClient   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 5
Project: Backmemed   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 6
Project: CustomWorldGen   File: CryptManager.java   View Source Code Vote up 6 votes
/**
 * Creates the Cipher Instance.
 */
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key)
{
    try
    {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    }
    catch (InvalidKeyException invalidkeyexception)
    {
        invalidkeyexception.printStackTrace();
    }
    catch (NoSuchAlgorithmException nosuchalgorithmexception)
    {
        nosuchalgorithmexception.printStackTrace();
    }
    catch (NoSuchPaddingException nosuchpaddingexception)
    {
        nosuchpaddingexception.printStackTrace();
    }

    LOGGER.error("Cipher creation failed!");
    return null;
}
 
Example 7
Project: mDL-ILP   File: ECCUtils.java   View Source Code Vote up 5 votes
/**
 * Implement the ECKA algorithm (EG variant) in order to calculate the ShS (shared secret) from the provided
 * static and ephemeral keys from the same curve.
 * @param privateKey the private key to use for the ShS calculation.
 * @param publicKey the public key to use for the ShS calculation.
 * @return the calculated shared secret.
 */
public static byte[] calculateECKAShS(PrivateKey privateKey, PublicKey publicKey) {

    try {
        ECKABasicAgreement basicAgreement = new ECKABasicAgreement();
        basicAgreement.init(ECUtil.generatePrivateKeyParameter(privateKey));

        return basicAgreement.calculatePoint(ECUtil.generatePublicKeyParameter(publicKey)).getEncoded();
    } catch (InvalidKeyException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 8
Project: mDL-ILP   File: ECCUtils.java   View Source Code Vote up 5 votes
/**
 * Implement the ECKA algorithm (EG variant) in order to calculate the ShS (shared secret) from the provided
 * static and ephemeral keys from the same curve.
 * @param privateKey the private key to use for the ShS calculation.
 * @param publicKey the public key to use for the ShS calculation.
 * @return the calculated shared secret.
 */
public static byte[] calculateECKAShS(PrivateKey privateKey, PublicKey publicKey) {

    try {
        ECKABasicAgreement basicAgreement = new ECKABasicAgreement();
        basicAgreement.init(ECUtil.generatePrivateKeyParameter(privateKey));

        return basicAgreement.calculatePoint(ECUtil.generatePublicKeyParameter(publicKey)).getEncoded();
    } catch (InvalidKeyException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 9
Project: api-aws-signature   File: AwsHelper.java   View Source Code Vote up 5 votes
/**
 * Mac the passed string using the provided key
 *
 * @param key
 * @param stringToMac
 * @return
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeyException
 */
private byte[] mac(byte[] key, String stringToMac) throws NoSuchAlgorithmException, InvalidKeyException {
    try {
        Mac m = Mac.getInstance("HmacSHA256");
        m.init(new SecretKeySpec(key, "HmacSHA256"));
        return m.doFinal(stringToMac.getBytes());
    } catch (NoSuchAlgorithmException ex) {
        ex.printStackTrace();
        throw new NoSuchAlgorithmException(ex.getMessage());
    } catch (InvalidKeyException ikx) {
        ikx.printStackTrace();
        throw new InvalidKeyException(ikx.getMessage());
    }
}
 
Example 10
Project: SayNoToMcLeaks   File: CryptManager.java   View Source Code Vote up 5 votes
private static Cipher createTheCipherInstance(int opMode, String transformation, Key key) {
    try {
        Cipher cipher = Cipher.getInstance(transformation);
        cipher.init(opMode, key);
        return cipher;
    } catch (InvalidKeyException invalidkeyexception) {
        invalidkeyexception.printStackTrace();
    } catch (NoSuchAlgorithmException nosuchalgorithmexception) {
        nosuchalgorithmexception.printStackTrace();
    } catch (NoSuchPaddingException nosuchpaddingexception) {
        nosuchpaddingexception.printStackTrace();
    }
    return null;
}
 
Example 11
Project: encdroidMC   File: EncFSCrypto.java   View Source Code Vote up 5 votes
static synchronized void cipherInit(Key key, Mac mac, int opMode, Cipher cipher,
		byte[] iv, byte[] ivSeed) throws InvalidAlgorithmParameterException {
	try {
		cipher.init(opMode, key, newIvSpec(mac, iv, ivSeed));
	} catch (InvalidKeyException e) {
		e.printStackTrace();
	}
}
 
Example 12
Project: OpenJSharp   File: X509Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... X.509 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject(ObjectInputStream stream) throws IOException {
    try {
        decode(stream);
    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}
 
Example 13
Project: OpenJSharp   File: PKCS8Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... PKCS#8 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject (ObjectInputStream stream)
throws IOException {

    try {
        decode(stream);

    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}
 
Example 14
Project: jdk8u-jdk   File: X509Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... X.509 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject(ObjectInputStream stream) throws IOException {
    try {
        decode(stream);
    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}
 
Example 15
Project: jdk8u-jdk   File: PKCS8Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... PKCS#8 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject (ObjectInputStream stream)
throws IOException {

    try {
        decode(stream);

    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}
 
Example 16
Project: openjdk-jdk10   File: X509Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... X.509 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject(ObjectInputStream stream) throws IOException {
    try {
        decode(stream);
    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}
 
Example 17
Project: openjdk-jdk10   File: PKCS8Key.java   View Source Code Vote up 5 votes
/**
 * Serialization read ... PKCS#8 keys serialize as
 * themselves, and they're parsed when they get read back.
 */
private void readObject (ObjectInputStream stream)
throws IOException {

    try {
        decode(stream);

    } catch (InvalidKeyException e) {
        e.printStackTrace();
        throw new IOException("deserialized key is invalid: " +
                              e.getMessage());
    }
}