当前位置: 首页>>代码示例>>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;未经允许,请勿转载。