public class ISO9796d1Encoding extends java.lang.Object implements AsymmetricBlockCipher
Modifier and Type | Field and Description |
---|---|
private int |
bitSize |
private AsymmetricBlockCipher |
engine |
private boolean |
forEncryption |
private static byte[] |
inverse |
private java.math.BigInteger |
modulus |
private int |
padBits |
private static byte[] |
shadows |
private static java.math.BigInteger |
SIX |
private static java.math.BigInteger |
SIXTEEN |
Constructor and Description |
---|
ISO9796d1Encoding(AsymmetricBlockCipher cipher) |
Modifier and Type | Method and Description |
---|---|
private static byte[] |
convertOutputDecryptOnly(java.math.BigInteger result) |
private byte[] |
decodeBlock(byte[] in,
int inOff,
int inLen) |
private byte[] |
encodeBlock(byte[] in,
int inOff,
int inLen) |
int |
getInputBlockSize()
return the input block size.
|
int |
getOutputBlockSize()
return the maximum possible size for the output.
|
int |
getPadBits()
retrieve the number of pad bits in the last decoded message.
|
AsymmetricBlockCipher |
getUnderlyingCipher() |
void |
init(boolean forEncryption,
CipherParameters param)
initialise the cipher.
|
byte[] |
processBlock(byte[] in,
int inOff,
int inLen)
process the block of len bytes stored in in from offset inOff.
|
void |
setPadBits(int padBits)
set the number of bits in the next message to be treated as
pad bits.
|
private static final java.math.BigInteger SIXTEEN
private static final java.math.BigInteger SIX
private static byte[] shadows
private static byte[] inverse
private AsymmetricBlockCipher engine
private boolean forEncryption
private int bitSize
private int padBits
private java.math.BigInteger modulus
public ISO9796d1Encoding(AsymmetricBlockCipher cipher)
public AsymmetricBlockCipher getUnderlyingCipher()
public void init(boolean forEncryption, CipherParameters param)
AsymmetricBlockCipher
init
in interface AsymmetricBlockCipher
forEncryption
- if true the cipher is initialised for
encryption, if false for decryption.param
- the key and other data required by the cipher.public int getInputBlockSize()
getInputBlockSize
in interface AsymmetricBlockCipher
public int getOutputBlockSize()
getOutputBlockSize
in interface AsymmetricBlockCipher
public void setPadBits(int padBits)
public int getPadBits()
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
AsymmetricBlockCipher
processBlock
in interface AsymmetricBlockCipher
in
- the input datainOff
- offset into the in array where the data startsinLen
- the length of the block to be processed.InvalidCipherTextException
- data decrypts improperly.private byte[] encodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
InvalidCipherTextException
private byte[] decodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
InvalidCipherTextException
- if the decrypted block is not a valid ISO 9796 bit stringprivate static byte[] convertOutputDecryptOnly(java.math.BigInteger result)