public class

PKCS1Encoding

extends Object
implements AsymmetricBlockCipher
java.lang.Object
   ↳ org.bouncycastle.crypto.encodings.PKCS1Encoding

Class Overview

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.

Summary

Constants
String STRICT_LENGTH_ENABLED_PROPERTY some providers fail to include the leading zero in PKCS1 encoded blocks.
Public Constructors
PKCS1Encoding(AsymmetricBlockCipher cipher)
Basic constructor.
Public Methods
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.
byte[] processBlock(byte[] in, int inOff, int inLen)
process the block of len bytes stored in in from offset inOff.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.bouncycastle.crypto.AsymmetricBlockCipher

Constants

public static final String 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.

Constant Value: "org.bouncycastle.pkcs1.strict"

Public Constructors

public PKCS1Encoding (AsymmetricBlockCipher cipher)

Basic constructor.

Public Methods

public int getInputBlockSize ()

returns the largest size an input block can be.

Returns
  • maximum size for an input block.

public int getOutputBlockSize ()

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

Returns
  • maximum size of the output block produced by the cipher.

public AsymmetricBlockCipher getUnderlyingCipher ()

public void init (boolean forEncryption, CipherParameters param)

initialise the cipher.

Parameters
forEncryption if true the cipher is initialised for encryption, if false for decryption.
param the key and other data required by the cipher.

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

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

Parameters
in the input data
inOff offset into the in array where the data starts
inLen the length of the block to be processed.
Returns
  • the resulting byte array of the encryption/decryption process.