net.rim.device.api.crypto
Class PRNGEncryptor

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
                  extended by net.rim.device.api.crypto.PRNGEncryptor

public final class PRNGEncryptor
extends StreamEncryptor

The PRNGEncryptor is used in conjunction with a PseudoRandomSource to encrypt data provided to this class in a stream interface to the calling class.

A PRNG represents a Pseudo Random Number Generator.

It provides a similar relationship or functionality that the BlockEncryptor uses for BlockEncryptorEngines. That is, it allows you to use a PseudoRandomSource as an output stream instead of relying on the encryption mechanisms exposed in the PseudoRandomSource class.

See Also:
PRNGDecryptor
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 PRNGEncryptor(PseudoRandomSource keystream, OutputStream output)
          Creates a PRNGEncryptor object given a specified output stream and a keystream will generate numbers to encrypt with.
 
Method Summary
Category: Signed protected  void encrypt(byte[] plaintext, int plaintextOffset, int plaintextLength, byte[] ciphertext)
          Encrypts data using the specific implementation of the chosen stream encryptor.
Category: Signed  String getAlgorithm()
          Returns the name of the encryption algorithm used, eg "ARC4".
 
Methods inherited from class net.rim.device.api.crypto.StreamEncryptor
flush, write
 
Methods inherited from class net.rim.device.api.crypto.CryptoOutputStream
close, flush, getOutputStream, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

PRNGEncryptor

public PRNGEncryptor(PseudoRandomSource keystream,
                     OutputStream output)
Creates a PRNGEncryptor object given a specified output stream and a keystream will generate numbers to encrypt with.

Parameters:
output - An OutputStream object that will contain the ciphertext after the class has completed its task.
keystream - A PseudoRandomSource object to create random numbers that provide a secure method for encrypting the stream.
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

getAlgorithm

public String getAlgorithm()
Returns the name of the encryption algorithm used, eg "ARC4".

Specified by:
getAlgorithm in class CryptoOutputStream
Returns:
A String that represents the name of the algorithm.
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 void encrypt(byte[] plaintext,
                       int plaintextOffset,
                       int plaintextLength,
                       byte[] ciphertext)
                throws CryptoTokenException
Description copied from class: StreamEncryptor
Encrypts data using the specific implementation of the chosen stream encryptor.

Specified by:
encrypt in class StreamEncryptor
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.
plaintextLength - 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





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