Bouncy Castle Cryptography Library 1.79

org.bouncycastle.openpgp.operator.bc
Class BcAEADUtil

java.lang.Object
  |
  +--org.bouncycastle.openpgp.operator.bc.BcAEADUtil

public class BcAEADUtil
extends java.lang.Object


Inner Class Summary
protected static class BcAEADUtil.PGPAeadInputStream
           
protected static class BcAEADUtil.PGPAeadOutputStream
           
 
Constructor Summary
BcAEADUtil()
           
 
Method Summary
static org.bouncycastle.crypto.modes.AEADBlockCipher createAEADCipher(int encAlgorithm, int aeadAlgorithm)
           
protected static long getChunkLength(int chunkSize)
          Calculate an actual chunk length from the encoded chunk size.
protected static byte[] getNonce(byte[] iv, long chunkIndex)
          Generate a nonce by xor-ing the given iv with the chunk index.
protected static void xorChunkId(byte[] nonce, long chunkIndex)
          XOR the byte array with the chunk index in-place.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BcAEADUtil

public BcAEADUtil()
Method Detail

getNonce

protected static byte[] getNonce(byte[] iv,
                                 long chunkIndex)
Generate a nonce by xor-ing the given iv with the chunk index.
Parameters:
iv - initialization vector
chunkIndex - chunk index
Returns:
nonce

xorChunkId

protected static void xorChunkId(byte[] nonce,
                                 long chunkIndex)
XOR the byte array with the chunk index in-place.
Parameters:
nonce - byte array
chunkIndex - chunk index

getChunkLength

protected static long getChunkLength(int chunkSize)
Calculate an actual chunk length from the encoded chunk size.
Parameters:
chunkSize - encoded chunk size
Returns:
decoded length

createAEADCipher

public static org.bouncycastle.crypto.modes.AEADBlockCipher createAEADCipher(int encAlgorithm,
                                                                             int aeadAlgorithm)
                                                                      throws PGPException

Bouncy Castle Cryptography Library 1.79