public class OAEPEncoding extends java.lang.Object implements AsymmetricBlockCipher
Modifier and Type | Field and Description |
---|---|
private byte[] |
defHash |
private AsymmetricBlockCipher |
engine |
private boolean |
forEncryption |
private Digest |
hash |
private Digest |
mgf1Hash |
private java.security.SecureRandom |
random |
Constructor and Description |
---|
OAEPEncoding(AsymmetricBlockCipher cipher) |
OAEPEncoding(AsymmetricBlockCipher cipher,
Digest hash) |
OAEPEncoding(AsymmetricBlockCipher cipher,
Digest hash,
byte[] encodingParams) |
OAEPEncoding(AsymmetricBlockCipher cipher,
Digest hash,
Digest mgf1Hash,
byte[] encodingParams) |
Modifier and Type | Method and Description |
---|---|
byte[] |
decodeBlock(byte[] in,
int inOff,
int inLen) |
byte[] |
encodeBlock(byte[] in,
int inOff,
int inLen) |
int |
getInputBlockSize()
returns the largest size an input block can be.
|
int |
getOutputBlockSize()
returns the maximum size of the block produced by this cipher.
|
AsymmetricBlockCipher |
getUnderlyingCipher() |
void |
init(boolean forEncryption,
CipherParameters param)
initialise the cipher.
|
private void |
ItoOSP(int i,
byte[] sp)
int to octet string.
|
private byte[] |
maskGeneratorFunction1(byte[] Z,
int zOff,
int zLen,
int length)
mask generator function, as described in PKCS1v2.
|
byte[] |
processBlock(byte[] in,
int inOff,
int inLen)
process the block of len bytes stored in in from offset inOff.
|
private byte[] defHash
private Digest hash
private Digest mgf1Hash
private AsymmetricBlockCipher engine
private java.security.SecureRandom random
private boolean forEncryption
public OAEPEncoding(AsymmetricBlockCipher cipher)
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash)
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, byte[] encodingParams)
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, Digest mgf1Hash, byte[] encodingParams)
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()
AsymmetricBlockCipher
getInputBlockSize
in interface AsymmetricBlockCipher
public int getOutputBlockSize()
AsymmetricBlockCipher
getOutputBlockSize
in interface AsymmetricBlockCipher
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.public byte[] encodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
InvalidCipherTextException
public byte[] decodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
InvalidCipherTextException
- if the decrypted block turns out to
be badly formatted.private void ItoOSP(int i, byte[] sp)
private byte[] maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)