public final class RSAPadding
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
PAD_BLOCKTYPE_1 |
static int |
PAD_BLOCKTYPE_2 |
static int |
PAD_NONE |
static int |
PAD_OAEP_MGF1 |
| Modifier and Type | Method and Description |
|---|---|
static RSAPadding |
getInstance(int type,
int paddedSize)
Get a RSAPadding instance of the specified type.
|
static RSAPadding |
getInstance(int type,
int paddedSize,
java.security.SecureRandom random)
Get a RSAPadding instance of the specified type.
|
static RSAPadding |
getInstance(int type,
int paddedSize,
java.security.SecureRandom random,
javax.crypto.spec.OAEPParameterSpec spec)
Get a RSAPadding instance of the specified type, which must be
OAEP.
|
int |
getMaxDataSize()
Return the maximum size of the plaintext data that can be processed
using this object.
|
byte[] |
pad(byte[] data)
Pad the data and return the padded block.
|
byte[] |
pad(byte[] data,
int ofs,
int len)
Pad the data and return the padded block.
|
byte[] |
unpad(byte[] padded)
Unpad the padded block and return the data.
|
public static final int PAD_BLOCKTYPE_1
public static final int PAD_BLOCKTYPE_2
public static final int PAD_NONE
public static final int PAD_OAEP_MGF1
public static RSAPadding getInstance(int type, int paddedSize) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionpublic static RSAPadding getInstance(int type, int paddedSize, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionpublic static RSAPadding getInstance(int type, int paddedSize, java.security.SecureRandom random, javax.crypto.spec.OAEPParameterSpec spec) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionpublic int getMaxDataSize()
public byte[] pad(byte[] data)
throws javax.crypto.BadPaddingException
javax.crypto.BadPaddingExceptionpublic byte[] pad(byte[] data,
int ofs,
int len)
throws javax.crypto.BadPaddingException
javax.crypto.BadPaddingExceptionpublic byte[] unpad(byte[] padded)
throws javax.crypto.BadPaddingException
javax.crypto.BadPaddingException