当前位置: 首页>>代码示例>>Java>>正文


Java InvalidKeyException.printStackTrace方法代码示例

本文整理汇总了Java中java.security.InvalidKeyException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java InvalidKeyException.printStackTrace方法的具体用法?Java InvalidKeyException.printStackTrace怎么用?Java InvalidKeyException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.InvalidKeyException的用法示例。


在下文中一共展示了InvalidKeyException.printStackTrace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTheCipherInstance

import java.security.InvalidKeyException; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:CryptManager.java

示例2: calculateECKAShS

import java.security.InvalidKeyException; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:20,代码来源:ECCUtils.java

示例3: mac

import java.security.InvalidKeyException; //导入方法依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:boomiutils,项目名称:api-aws-signature,代码行数:23,代码来源:AwsHelper.java

示例4: createTheCipherInstance

import java.security.InvalidKeyException; //导入方法依赖的package包/类
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;
}
 
开发者ID:EverCraft,项目名称:SayNoToMcLeaks,代码行数:15,代码来源:CryptManager.java

示例5: cipherInit

import java.security.InvalidKeyException; //导入方法依赖的package包/类
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();
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:9,代码来源:EncFSCrypto.java

示例6: readObject

import java.security.InvalidKeyException; //导入方法依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:X509Key.java

示例7: readObject

import java.security.InvalidKeyException; //导入方法依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:PKCS8Key.java


注:本文中的java.security.InvalidKeyException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。