SHOW Signed

net.rim.device.api.crypto
Class OFBPseudoRandomSource

java.lang.Object
  |
  +--net.rim.device.api.crypto.AbstractPseudoRandomSource
        |
        +--net.rim.device.api.crypto.OFBPseudoRandomSource
All Implemented Interfaces:
PseudoRandomSource

public final class OFBPseudoRandomSource
extends AbstractPseudoRandomSource
implements PseudoRandomSource

OFBPseudoRandomSource uses a symmetric key block cipher in Output Feedback Mode to provide a sequence of pseudo random bytes. OFB mode is defined in FIPS 81.

More than one message can be encrypted with the same key provided that a different initialization vector (IV) is used every time.

Note that any change in the ciphertext directly affects the plaintext. A ciphertext error only effects the corresponding bit of plaintext (this is why it is considered a stream cipher).

The width of the feedback is the block size of the cipher. For example, when used with DES, OFB uses 64 bit feedback.

For a code sample using the OFB pseudo random source, click here.

Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 3.6.0

Constructor Summary
 Category: Signed OFBPseudoRandomSource(SymmetricKeyEncryptorEngine engine, InitializationVector iv)
          Creates an OFBPseudoRandomSource object based on the specified encryptor engine and initialization vector.
 
Method Summary
 Category: Signed  String getAlgorithm()
          Returns the name of this PseudoRandomSource.
 Category: Signed  int getAvailable()
          Returns the number of pseudo random bytes currently available.
 Category: Signed  int getMaxAvailable()
          Returns the maximum number of pseudo random bytes that this PRNG can produce.
 Category: Signed  void xorBytes(byte[] buffer, int offset, int length)
          Exclusive-OR's (xor) random bytes into the given buffer starting at the specified array offset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.rim.device.api.crypto.PseudoRandomSource
getBytes, getBytes, getBytes, xorBytes, xorBytes, xorCopy, xorCopy
 

Constructor Detail

OFBPseudoRandomSource

public OFBPseudoRandomSource(SymmetricKeyEncryptorEngine engine,
                             InitializationVector iv)
                      throws CryptoTokenException
Creates an OFBPseudoRandomSource object based on the specified encryptor engine and initialization vector.

Parameters:
engine - The encryption engine (algorithm) that will be used for the OFB mode.
iv - The initialization vector that is to be used for the OFB mode (must have the same length as the engine's block length).
Throws:
CryptoTokenException - Thrown if an error 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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Method Detail

getAlgorithm

public String getAlgorithm()
Returns the name of this PseudoRandomSource. SymmetricKeyEncryptorEngine.getAlgorithm() + "/OFB".

Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

xorBytes

public void xorBytes(byte[] buffer,
                     int offset,
                     int length)
              throws CryptoTokenException
Description copied from interface: PseudoRandomSource
Exclusive-OR's (xor) random bytes into the given buffer starting at the specified array offset.

Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getAvailable

public int getAvailable()
Description copied from interface: PseudoRandomSource
Returns the number of pseudo random bytes currently available.

For PRNG sources that have an indefinite length but implement this interface, the value returned is Integer.MAX.

Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getMaxAvailable

public int getMaxAvailable()
Description copied from interface: PseudoRandomSource
Returns the maximum number of pseudo random bytes that this PRNG can produce.

For PRNG sources that have an indefinite length but implement this interface, the value returned is Integer.MAX.

Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2004 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.