|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.jce.crypto.Cipher
public class Cipher
Field Summary | |
---|---|
static int |
DECRYPT_MODE
|
static int |
ENCRYPT_MODE
|
Constructor Summary | |
---|---|
protected |
Cipher(CipherSpi cipherSpi,
Provider provider,
java.lang.String transformation)
|
Method Summary | |
---|---|
byte[] |
doFinal(byte[] input)
Encrypt the entire input array. |
byte[] |
doFinal(byte[] input,
int inputOffset,
int inputLen)
Encrypt part of the input array |
int |
doFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output)
Encrypt part of the input array and stores the result in the given output array. |
int |
doFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Encrypt part of the input array and stores the result in the given output array. |
java.lang.String |
getAlgorithm()
Get the name of the algorithm implemented by this Cipher instance. |
int |
getBlockSize()
Get how big blocks this algorithm works on. |
static Cipher |
getInstance(java.lang.String transformation)
Get a Cipher instance which implements the given algorithm in any of the registered providers. |
static Cipher |
getInstance(java.lang.String transformation,
java.lang.String provider)
Get a Cipher instance which implements the given algorithm in the given provider. |
byte[] |
getIV()
Get the IV used by this instance |
int |
getOutputSize(int inputLen)
Calculate how much encryted data an imput of the given length will cause. |
Provider |
getProvider()
Get the provider which implements this algorithm. |
void |
init(int opmode,
Key key)
Initialize this Cipher instance. |
void |
init(int opmode,
Key key,
AlgorithmParameterSpec params)
Initialize this Cipher instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DECRYPT_MODE
public static final int ENCRYPT_MODE
Constructor Detail |
---|
protected Cipher(CipherSpi cipherSpi, Provider provider, java.lang.String transformation)
Method Detail |
---|
public final byte[] doFinal(byte[] input)
Note that the input must be a multiple of the block size bytes long.
input
- array of data to encrypt
public final byte[] doFinal(byte[] input, int inputOffset, int inputLen)
Note that the input must be a multiple of the block size bytes long.
input
- array of data to encryptinputOffset
- start of data to encryptinputLen
- length of data to encrypt
public final int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output)
Note that the input must be a multiple of the block size bytes long.
input
- array of data to encryptinputOffset
- start of data to encryptinputLen
- length of data to encryptoutput
- array in which output is stored. This array
must have room for at least
getOutputSize(inputLen) bytes
public final int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
Note that the input must be a multiple of the block size bytes long.
input
- array of data to encryptinputOffset
- start of data to encryptinputLen
- length of data to encryptoutput
- array in which output is stored. This array
must have room for at least
getOutputSize(inputLen) bytesoutputOffset
- Start offset in the output array where the output
should be stored.
public final java.lang.String getAlgorithm()
public final int getBlockSize()
public static final Cipher getInstance(java.lang.String transformation) throws NoSuchAlgorithmException
transformation
- name of the desired algorithm (like
AES/CBC).
NoSuchAlgorithmException
- if no implementation can be foundpublic static final Cipher getInstance(java.lang.String transformation, java.lang.String provider) throws NoSuchAlgorithmException, NoSuchProviderException
transformation
- name of the desired algorithm (like
AES/CBC).
NoSuchAlgorithmException
- if no implementation can be found
NoSuchProviderException
public final byte[] getIV()
public final int getOutputSize(int inputLen)
inputLen
- length of input data
public final Provider getProvider()
public final void init(int opmode, Key key) throws InvalidKeyException
opmode
- The operating mode. This should be either
Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE.key
- the encryption or decryption key
InvalidKeyException
public final void init(int opmode, Key key, AlgorithmParameterSpec params) throws InvalidKeyException
opmode
- The operating mode. This should be either
Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE.key
- the encryption or decryption keyparams
- Extra algorithm parameters
InvalidKeyException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |