SHOW Signed
 

net.rim.device.api.crypto
Class StreamEncryptor

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--net.rim.device.api.crypto.CryptoOutputStream
              |
              +--net.rim.device.api.crypto.EncryptorOutputStream
                    |
                    +--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.

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:
JDE 3.6.0
See Also:
StreamDecryptor

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.
Since:
JDE 3.6.0
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.
Method Detail

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.
Since:
JDE 3.6.0
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.

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.
Since:
JDE 4.0.0
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.

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.

Overrides:
write in class CryptoOutputStream
Since:
JDE 3.6.0

Following copied from class: CryptoOutputStream
Parameters:
buffer - 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.



Copyright 1999-2009 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.