public class NativeRSACipherSpi extends AbstractRSACipherSpi
| Modifier and Type | Field and Description |
|---|---|
static int |
CIPHER_DESCRIPTION_SIZE |
| Constructor and Description |
|---|
NativeRSACipherSpi(int nativeTransformationId,
int paddingType,
int oaepHashAlgorithm)
Custom constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
decrypt(byte[] in,
int inOffset,
int inLength,
byte[] output,
int outputOffset)
Decrypt a buffer with the RSA cipher.
|
protected int |
encrypt(byte[] in,
int inOffset,
int inLength,
byte[] output,
int outputOffset)
Encrypt a buffer with the RSA cipher.
|
static NativeRSACipherSpi |
getInstance(String transformation)
Creates a cipher context for the given transformation.
|
protected void |
init(NativePublicKey publicKey,
NativePrivateKey privateKey,
int padding,
int hash)
Initialize the native part of the RSA cipher.
|
static int |
nativeGetTransformationDescription(byte[] transformation,
byte[] description)
Gets for the given transformation the cipher description.
|
engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetOutputSize, engineInit, engineInit, engineUpdate, engineUpdateengineUnwrap, engineUpdateAAD, engineWrappublic NativeRSACipherSpi(int nativeTransformationId,
int paddingType,
int oaepHashAlgorithm)
nativeTransformationId - transformation id received from the native world.paddingType - padding type constant.oaepHashAlgorithm - OAEP hash algorithm (if used).protected int decrypt(byte[] in,
int inOffset,
int inLength,
byte[] output,
int outputOffset)
AbstractRSACipherSpidecrypt in class AbstractRSACipherSpiin - input bufferinOffset - offset in the input bufferinLength - input buffer lengthoutput - output bufferoutputOffset - offset in the output buffer lengthprotected int encrypt(byte[] in,
int inOffset,
int inLength,
byte[] output,
int outputOffset)
AbstractRSACipherSpiencrypt in class AbstractRSACipherSpiin - input bufferinOffset - offset in the input bufferinLength - input buffer lengthoutput - output bufferoutputOffset - offset in the output buffer length@Nullable public static NativeRSACipherSpi getInstance(String transformation)
transformation - the cipher transformation to be usednull if the transformation is not supported.protected void init(NativePublicKey publicKey, NativePrivateKey privateKey, int padding, int hash)
AbstractRSACipherSpiinit in class AbstractRSACipherSpipublicKey - Public key of the RSA cipher (null for decryption).privateKey - Private key of the RSA cipher (null for encryption).padding - Padding scheme of the RSA cipher.hash - Hash algorithm of the RSA cipher (valid only for OAEP with MGF1 padding scheme).public static int nativeGetTransformationDescription(byte[] transformation,
byte[] description)
transformation - Null terminated string that describes the transformationdescription - must be filled-in with:
PAD_* values defined in
AbstractRSACipherSpiOAEP_HASH_* values defined in
AbstractRSACipherSpi