public class JceStreamCipherImpl extends java.lang.Object implements TlsStreamCipherImpl
Constructor and Description |
---|
JceStreamCipherImpl(javax.crypto.Cipher cipher,
java.lang.String algorithm,
boolean isEncrypting) |
Modifier and Type | Method and Description |
---|---|
int |
doFinal(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Perform the cipher encryption/decryption returning the output in output.
|
void |
init(byte[] iv)
Initialise the parameters for stream cipher.
|
void |
setKey(byte[] key)
Set the key to be used by the stream cipher implementation supporting this service.
|
public JceStreamCipherImpl(javax.crypto.Cipher cipher, java.lang.String algorithm, boolean isEncrypting) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public void setKey(byte[] key)
TlsStreamCipherImpl
setKey
in interface TlsStreamCipherImpl
key
- the stream cipher key.public void init(byte[] iv)
TlsStreamCipherImpl
init
in interface TlsStreamCipherImpl
iv
- the nonce for the stream cipher.public int doFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
TlsStreamCipherImpl
Note: we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher.
doFinal
in interface TlsStreamCipherImpl
input
- array holding input data to the cipher.inputOffset
- offset into input array data starts at.inputLength
- length of the input data in the array.output
- array to hold the cipher output.outputOffset
- offset into output array to start saving output.