當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。