net.rim.device.api.crypto
Class StreamEncryptor

java.lang.Object
  extended by java.io.OutputStream
      extended by net.rim.device.api.crypto.CryptoOutputStream
          extended by net.rim.device.api.crypto.EncryptorOutputStream
              extended by net.rim.device.api.crypto.StreamEncryptor
Direct Known Subclasses:
CFBEncryptor, ECIESEncryptor, PRNGEncryptor

public abstract class StreamEncryptor
extends EncryptorOutputStream

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.

See Also:
StreamDecryptor
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Field Summary
 
Fields inherited from class net.rim.device.api.crypto.CryptoOutputStream
_out
 
Constructor Summary
Category: Signed protected StreamEncryptor(OutputStream output)
          Creates a StreamEncryptor object based upon an output stream that will be given the encrypted data.
 
Method Summary
Category: Signed protected abstract  void encrypt(byte[] plaintext, int plaintextOffset, int length, byte[] ciphertext)
          Encrypts data using the specific implementation of the chosen stream encryptor.
Category: Signed  void flush(boolean pad)
          Flushes any pending data to the stream and, optionally, does any necessary padding correctly.
Category: Signed  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

StreamEncryptor

protected StreamEncryptor(OutputStream output)
Creates a StreamEncryptor object based upon an output stream that will be given the encrypted data.

Parameters:
output - An output stream used for writing the transformed data to.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

write

public void write(byte[] data,
                  int offset,
                  int length)
           throws IOException
Description copied from class: CryptoOutputStream
Writes a specified length of bytes from the given byte array to this output stream.

Specified by:
write in class CryptoOutputStream
Parameters:
data - 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.

Throws:
IOException - Thrown if an I/O error occurs.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

encrypt

protected abstract void encrypt(byte[] plaintext,
                                int plaintextOffset,
                                int length,
                                byte[] ciphertext)
                         throws CryptoTokenException
Encrypts data using the specific implementation of the chosen stream encryptor.

Parameters:
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.
Throws:
CryptoTokenException - Thrown when a problem occurs with the crypto token or the crypto token is invalid.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

flush

public void flush(boolean pad)
           throws IOException
Flushes any pending data to the stream and, optionally, does any necessary padding correctly. A subclass should override this function if they have padding they need done.

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.

Overrides:
flush in class EncryptorOutputStream
Parameters:
pad - If true, then perform the appropriate padding code ( if necessary - stream ciphers don't require this ) Otherwise, just flush normally.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0





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