|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bouncycastle.crypto.encodings.PKCS1Encoding
public class PKCS1Encoding
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 | |
---|---|
private AsymmetricBlockCipher |
engine
|
private boolean |
forEncryption
|
private boolean |
forPrivateKey
|
private static int |
HEADER_LENGTH
|
private java.security.SecureRandom |
random
|
static java.lang.String |
STRICT_LENGTH_ENABLED_PROPERTY
some providers fail to include the leading zero in PKCS1 encoded blocks. |
private boolean |
useStrictLength
|
Constructor Summary | |
---|---|
PKCS1Encoding(AsymmetricBlockCipher cipher)
Basic constructor. |
Method Summary | |
---|---|
private byte[] |
decodeBlock(byte[] in,
int inOff,
int inLen)
|
private 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. |
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. |
private boolean |
useStrict()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String STRICT_LENGTH_ENABLED_PROPERTY
The system property is checked during construction of the encoding object, it is set to true by default.
private static final int HEADER_LENGTH
private java.security.SecureRandom random
private AsymmetricBlockCipher engine
private boolean forEncryption
private boolean forPrivateKey
private boolean useStrictLength
Constructor Detail |
---|
public PKCS1Encoding(AsymmetricBlockCipher cipher)
cipher
- Method Detail |
---|
private boolean useStrict()
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.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 in
PKCS1 format.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc