|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
net.rim.device.api.crypto.CryptoOutputStream
net.rim.device.api.crypto.EncryptorOutputStream
net.rim.device.api.crypto.StreamEncryptor
public abstract class StreamEncryptor
StreamEncryptor is an abstract class which contains functionality
common to all stream ciphers. A stream encryptor is an encryption
scheme which encrypts data one byte at a time, instead of in blocks.
StreamDecryptor| Field Summary |
|---|
| Fields inherited from class net.rim.device.api.crypto.CryptoOutputStream |
|---|
_out |
| Constructor Summary | ||
|---|---|---|
|
protected |
StreamEncryptor(OutputStream output)
Creates a StreamEncryptor object based upon an output stream that will be given
the encrypted data. |
| Method Summary | ||
|---|---|---|
|
protected abstract void |
encrypt(byte[] plaintext,
int plaintextOffset,
int length,
byte[] ciphertext)
Encrypts data using the specific implementation of the chosen stream encryptor. |
|
void |
flush(boolean pad)
Flushes any pending data to the stream and, optionally, does any necessary padding correctly. |
|
void |
write(byte[] data,
int offset,
int length)
Writes a specified length of bytes from the given byte array to this output stream. |
| Methods inherited from class net.rim.device.api.crypto.CryptoOutputStream |
|---|
close, flush, getAlgorithm, getOutputStream, write, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected StreamEncryptor(OutputStream output)
StreamEncryptor object based upon an output stream that will be given
the encrypted data.
output - An output stream used for writing the transformed data to.| Method Detail |
|---|
public void write(byte[] data,
int offset,
int length)
throws IOException
CryptoOutputStream
write in class CryptoOutputStreamdata - The byte array containing the bytes that are
going to be written to the output stream.offset - The offset in the byte array where the method
will start writing from.length - The number of bytes that will be written to
the output stream.
IOException - Thrown if an I/O error occurs.
protected abstract void encrypt(byte[] plaintext,
int plaintextOffset,
int length,
byte[] ciphertext)
throws CryptoTokenException
plaintext - A byte array containing the input to the stream cipher.plaintextOffset - The offset, or initial position within the array, of the information to encrypt.length - The length of the information to encrypt.ciphertext - A byte array to hold the output of the stream cipher.
CryptoTokenException - Thrown when a problem occurs with the crypto token
or the crypto token is invalid.
public void flush(boolean pad)
throws IOException
This function is useful if you wish to re-use this object and so require that the previously written data have any necessary padding completed for it.
flush in class EncryptorOutputStreampad - If true, then perform the appropriate padding code ( if necessary - stream ciphers don't require this )
Otherwise, just flush normally.
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal