Class PKCS1Encoding
java.lang.Object
org.bouncycastle.crypto.encodings.PKCS1Encoding
- All Implemented Interfaces:
AsymmetricBlockCipher
public class PKCS1Encoding extends Object implements AsymmetricBlockCipher
this does your basic PKCS 1 v1.5 padding - whether or not you should be using this
depends on your application - see PKCS1 Version 2 for details.
-
Field Summary
Fields Modifier and Type Field Description static StringSTRICT_LENGTH_ENABLED_PROPERTYsome providers fail to include the leading zero in PKCS1 encoded blocks. -
Constructor Summary
Constructors Constructor Description PKCS1Encoding(AsymmetricBlockCipher cipher)Basic constructor. -
Method Summary
Modifier and Type Method Description intgetInputBlockSize()returns the largest size an input block can be.intgetOutputBlockSize()returns the maximum size of the block produced by this cipher.AsymmetricBlockCiphergetUnderlyingCipher()voidinit(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.
-
Field Details
-
STRICT_LENGTH_ENABLED_PROPERTY
some providers fail to include the leading zero in PKCS1 encoded blocks. If you need to work with one of these set the system property org.bouncycastle.pkcs1.strict to false.The system property is checked during construction of the encoding object, it is set to true by default.
- See Also:
- Constant Field Values
-
-
Constructor Details
-
PKCS1Encoding
Basic constructor.- Parameters:
cipher-
-
-
Method Details
-
getUnderlyingCipher
-
init
Description copied from interface:AsymmetricBlockCipherinitialise the cipher.- Specified by:
initin interfaceAsymmetricBlockCipher- Parameters:
forEncryption- if true the cipher is initialised for encryption, if false for decryption.param- the key and other data required by the cipher.
-
getInputBlockSize
public int getInputBlockSize()Description copied from interface:AsymmetricBlockCipherreturns the largest size an input block can be.- Specified by:
getInputBlockSizein interfaceAsymmetricBlockCipher- Returns:
- maximum size for an input block.
-
getOutputBlockSize
public int getOutputBlockSize()Description copied from interface:AsymmetricBlockCipherreturns the maximum size of the block produced by this cipher.- Specified by:
getOutputBlockSizein interfaceAsymmetricBlockCipher- Returns:
- maximum size of the output block produced by the cipher.
-
processBlock
Description copied from interface:AsymmetricBlockCipherprocess the block of len bytes stored in in from offset inOff.- Specified by:
processBlockin interfaceAsymmetricBlockCipher- Parameters:
in- the input datainOff- offset into the in array where the data startsinLen- the length of the block to be processed.- Returns:
- the resulting byte array of the encryption/decryption process.
- Throws:
InvalidCipherTextException- data decrypts improperly.
-