|
|||||||||
| 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.BlockEncryptor
public class BlockEncryptor
The superclass of all classes that implement block ciphers. The block ciphers sit on the Encryptor output stream and any data that is written to the output stream is acted on by the Block cipher. The class BlockEncryptor itself simply overrides many of the methods defined for the Encryptor class with methods that are specific to block ciphers.
It is important to note that the default mode for all block ciphers is Electronic Code Book mode (ECB) where each block is encrypted/decrypted separately and independently from all other blocks.
Note: For the block cipher algorithm classes, each block is encrypted one block at a time.
| Field Summary |
|---|
| Fields inherited from class net.rim.device.api.crypto.CryptoOutputStream |
|---|
_out |
| Constructor Summary | ||
|---|---|---|
|
BlockEncryptor(BlockEncryptorEngine encryptorEngine,
OutputStream out)
Creates a BlockEncryptor object using the specified block encryptor engine and output stream. |
|
|
BlockEncryptor(BlockFormatterEngine formatterEngine,
OutputStream out)
Creates a BlockEncryptor object using the specified block encoder and output stream. |
|
| Method Summary | ||
|---|---|---|
|
void |
close()
Closes the output stream. |
|
void |
flush()
Flushes out the remainder of the data in the output stream. |
|
void |
flush(boolean pad)
Flushes any pending data to the stream and, optionally, does any necessary padding correctly. |
|
String |
getAlgorithm()
Returns the name of the algorithm or both the algorithm and formatter engine used, depending what BlockEncryptor constructor was used. |
|
int |
getInputBlockLength()
Returns the input block length of the cipher in bytes. |
|
int |
getOutputBlockLength()
Returns the output block length of the cipher in bytes. |
|
protected void |
pad()
Pads the output properly. |
|
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 |
|---|
getOutputStream, write, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockEncryptor(BlockFormatterEngine formatterEngine,
OutputStream out)
formatterEngine - The formatter engine that will be
used to encode the data.out - The output stream that the data will be written to.
public BlockEncryptor(BlockEncryptorEngine encryptorEngine,
OutputStream out)
encryptorEngine - The encryptor engine that will be
used to encrypt the data.out - The output stream that the data will be written to.| Method Detail |
|---|
public String getAlgorithm()
getAlgorithm in class CryptoOutputStreampublic int getInputBlockLength()
public int getOutputBlockLength()
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.
public void flush()
throws IOException
CryptoOutputStream
flush in class CryptoOutputStreamIOException - Thrown if an I/O error occurs.
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. Otherwise, just flush normally.
IOException
protected void pad()
throws IOException
IOException - Thrown if an I/O error occurs.
public void close()
throws IOException
CryptoOutputStreamBefore closing the stream, it flushes out all of the data that is in the output stream.
See the flush() method for more information.
close in class CryptoOutputStreamIOException - Thrown if an I/O error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.