Top Description Fields Constructors Methods
org.bouncycastle.crypto.encodings

public Class OAEPEncoding

extends Object
implements AsymmetricBlockCipher
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.AsymmetricBlockCipher
Imports
java.security.SecureRandom, org.bouncycastle.crypto.AsymmetricBlockCipher, .CipherParameters, .CryptoServicesRegistrar, .DataLengthException, .Digest, .InvalidCipherTextException, org.bouncycastle.crypto.params.ParametersWithRandom, org.bouncycastle.crypto.util.DigestFactory, org.bouncycastle.util.Arrays, .Pack

Optimal Asymmetric Encryption Padding (OAEP) - see PKCS 1 V 2.

Field Summary

Modifier and TypeField and Description
private byte[]
private AsymmetricBlockCipher
private boolean
private Digest
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
public
public
OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, byte[] encodingParams)

public
OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, Digest mgf1Hash, byte[] encodingParams)

Method Summary

Modifier and TypeMethod and Description
public byte[]
decodeBlock(byte[] in, int inOff, int inLen)

public byte[]
encodeBlock(byte[] in, int inOff, int inLen)

public int
getInputBlockSize()

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.getInputBlockSize.

returns the largest size an input block can be.
public int
getOutputBlockSize()

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.getOutputBlockSize.

returns the maximum size of the block produced by this cipher.
public AsymmetricBlockCipher
public void
init(boolean
if true the cipher is initialised for encryption, if false for decryption.
forEncryption
,
CipherParameters
the key and other data required by the cipher.
param
)

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.init.

initialise the cipher.
private byte[]
maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)

mask generator function, as described in PKCS1v2.

public byte[]
processBlock(byte[]
the input data
in
,
int
offset into the in array where the data starts
inOff
,
int
the length of the block to be processed.
inLen
)

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.processBlock.

process the block of len bytes stored in in from offset inOff.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defHashback to summary
private byte[] defHash
engineback to summary
private AsymmetricBlockCipher engine
forEncryptionback to summary
private boolean forEncryption
mgf1Hashback to summary
private Digest mgf1Hash
randomback to summary
private SecureRandom random

Constructor Detail

OAEPEncodingback to summary
public OAEPEncoding(AsymmetricBlockCipher cipher)
OAEPEncodingback to summary
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash)
OAEPEncodingback to summary
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, byte[] encodingParams)
OAEPEncodingback to summary
public OAEPEncoding(AsymmetricBlockCipher cipher, Digest hash, Digest mgf1Hash, byte[] encodingParams)

Method Detail

decodeBlockback to summary
public byte[] decodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
Exceptions
InvalidCipherTextException:
if the decrypted block turns out to be badly formatted.
encodeBlockback to summary
public byte[] encodeBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
getInputBlockSizeback to summary
public int getInputBlockSize()

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.getInputBlockSize.

Doc from org.bouncycastle.crypto.AsymmetricBlockCipher.getInputBlockSize.

returns the largest size an input block can be.

Returns:int

maximum size for an input block.

getOutputBlockSizeback to summary
public int getOutputBlockSize()

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.getOutputBlockSize.

Doc from org.bouncycastle.crypto.AsymmetricBlockCipher.getOutputBlockSize.

returns the maximum size of the block produced by this cipher.

Returns:int

maximum size of the output block produced by the cipher.

getUnderlyingCipherback to summary
public AsymmetricBlockCipher getUnderlyingCipher()
initback to summary
public void init(boolean forEncryption, CipherParameters param)

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.init.

Doc from org.bouncycastle.crypto.AsymmetricBlockCipher.init.

initialise the cipher.

Parameters
forEncryption:boolean

if true the cipher is initialised for encryption, if false for decryption.

param:CipherParameters

the key and other data required by the cipher.

maskGeneratorFunction1back to summary
private byte[] maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)

mask generator function, as described in PKCS1v2.

processBlockback to summary
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException

Implements org.bouncycastle.crypto.AsymmetricBlockCipher.processBlock.

Doc from org.bouncycastle.crypto.AsymmetricBlockCipher.processBlock.

process the block of len bytes stored in in from offset inOff.

Parameters
in:byte[]

the input data

inOff:int

offset into the in array where the data starts

inLen:int

the length of the block to be processed.

Returns:byte[]

the resulting byte array of the encryption/decryption process.

Exceptions
InvalidCipherTextException:
data decrypts improperly.