當前位置: 首頁>>代碼示例>>Java>>正文


Java BufferedBlockCipher.getBlockSize方法代碼示例

本文整理匯總了Java中org.bouncycastle.crypto.BufferedBlockCipher.getBlockSize方法的典型用法代碼示例。如果您正苦於以下問題:Java BufferedBlockCipher.getBlockSize方法的具體用法?Java BufferedBlockCipher.getBlockSize怎麽用?Java BufferedBlockCipher.getBlockSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bouncycastle.crypto.BufferedBlockCipher的用法示例。


在下文中一共展示了BufferedBlockCipher.getBlockSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDataDecryptor

import org.bouncycastle.crypto.BufferedBlockCipher; //導入方法依賴的package包/類
public static PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, BlockCipher engine, byte[] key)
{
    final BufferedBlockCipher c = createStreamCipher(false, engine, withIntegrityPacket, key);

    return new PGPDataDecryptor()
    {
        public InputStream getInputStream(InputStream in)
        {
            return new CipherInputStream(in, c);
        }

        public int getBlockSize()
        {
            return c.getBlockSize();
        }

        public PGPDigestCalculator getIntegrityCalculator()
        {
            return new SHA1PGPDigestCalculator();
        }
    };
}
 
開發者ID:ttt43ttt,項目名稱:gwt-crypto,代碼行數:23,代碼來源:BcUtil.java

示例2: CipherOutputStream

import org.bouncycastle.crypto.BufferedBlockCipher; //導入方法依賴的package包/類
/**
 * Constructs a CipherOutputStream from an OutputStream and a
 * BufferedBlockCipher.
 */
public CipherOutputStream(
    OutputStream os,
    BufferedBlockCipher cipher)
{
    super(os);
    this.bufferedBlockCipher = cipher;
    this.buf = new byte[cipher.getBlockSize()];
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:13,代碼來源:CipherOutputStream.java

示例3: decrypt

import org.bouncycastle.crypto.BufferedBlockCipher; //導入方法依賴的package包/類
public static byte[] decrypt(byte[] input, BufferedBlockCipher cipher) {

        synchronized(cipher) {

        byte[] cipherText = new byte[cipher.getOutputSize(input.length) - pad.length];

        int padCopied = 0;

        if(input.length -1 >= cipher.getBlockSize() * 2) {
            //If the pad is not relevant for the last two blocks, simply process it out ahead of time
            padCopied = cipher.getUnderlyingCipher().processBlock(input, 0, new byte[pad.length], 0);
        } else {
            //Otherwise, the pad may be relevant for the CTS step, so we'll need to process it
            //normally
            padCopied = cipher.processBytes(input, 0, pad.length, new byte[pad.length], 0);
        }

        int outputLen = cipher.processBytes(input, pad.length, input.length - pad.length, cipherText, 0);

        byte[] lastBlock = new byte[input.length - padCopied - outputLen];

        try {
            int size = cipher.doFinal(lastBlock, 0);
            int count = 0;
            for(int i = pad.length - padCopied ; i < size ; ++i) {
                cipherText[outputLen + count] = lastBlock[i];
                count++;
            }
        } catch(CryptoException e) {
            Logger.die("process", e);
        }

        return cipherText;

        }
    }
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:37,代碼來源:CryptUtil.java


注:本文中的org.bouncycastle.crypto.BufferedBlockCipher.getBlockSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。