net.rim.device.api.crypto
Class PKCS1MGF1PseudoRandomSource

java.lang.Object
  extended by net.rim.device.api.crypto.AbstractPseudoRandomSource
      extended by net.rim.device.api.crypto.PKCS1MGF1PseudoRandomSource
All Implemented Interfaces:
PseudoRandomSource

public final class PKCS1MGF1PseudoRandomSource
extends AbstractPseudoRandomSource
implements PseudoRandomSource

The PKCS1MGF1PseudoRandomSource class implements the PKCS1 mask generation function (MGF1), using a digest to expand a finite length seed into an arbitrarily long stream of pseudo-random bytes.

We implemented the PKCS1 MGF as per the PKCS #1 version 2.1 document.

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

Constructor Summary
Category: Signed PKCS1MGF1PseudoRandomSource(byte[] seed)
          Creates a PKCS1MGF1PseudoRandomSource object using a seed.
Category: Signed PKCS1MGF1PseudoRandomSource(byte[] seed, int offset, int length)
          Creates a PKCS1MGF1PseudoRandomSource object using a seed.
Category: Signed PKCS1MGF1PseudoRandomSource(byte[] seed, int offset, int length, Digest digest)
          Creates a PKCS1MGF1PseudoRandomSource object using a seed and a digest.
Category: Signed PKCS1MGF1PseudoRandomSource(byte[] seed, Digest digest)
          Creates a PKCS1MGF1PseudoRandomSource object using a seed and a digest.
Category: Signed PKCS1MGF1PseudoRandomSource(SymmetricKey seed)
          Creates a PKCS1MGF1PseudoRandomSource object using a SymmetricKey seed.
Category: Signed PKCS1MGF1PseudoRandomSource(SymmetricKey seed, Digest digest)
          Creates a PKCS1MGF1PseudoRandomSource object using a SymmetricKey seed and a digest.
 
Method Summary
Category: Signed  String getAlgorithm()
          Returns the name of this PseudoRandomSource "PKCS1MGF1".
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 random bytes into the given buffer starting at the specified array offset.
 
Methods inherited from class net.rim.device.api.crypto.AbstractPseudoRandomSource
getBytes, getBytes, getBytes, xorBytes, xorBytes, xorCopy, xorCopy
 
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(byte[] seed,
                                   Digest digest)
Creates a PKCS1MGF1PseudoRandomSource object using a seed and a digest.

Parameters:
seed - A byte array containing the seed that will be used to seed the digest.
digest - The digest to be used for the pseudo random source.
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(byte[] seed,
                                   int offset,
                                   int length,
                                   Digest digest)
Creates a PKCS1MGF1PseudoRandomSource object using a seed and a digest.

Parameters:
seed - A byte array containing the seed that will be used to seed the digest.
digest - The digest to be used for the pseudo random source.
length - The length of the portion of seed to be used.
offset - The offset, or start position, of the portion to be used.
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(SymmetricKey seed,
                                   Digest digest)
                            throws CryptoTokenException,
                                   CryptoUnsupportedOperationException
Creates a PKCS1MGF1PseudoRandomSource object using a SymmetricKey seed and a digest.

Parameters:
seed - A symmetric key containing the seed that will be used to seed the digest.
digest - The digest to be used for the pseudo random source.
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(byte[] seed,
                                   int offset,
                                   int length)
Creates a PKCS1MGF1PseudoRandomSource object using a seed. This constructor will by default use the SHA1Digest for the digest.

Parameters:
seed - A byte array containing the seed that will be used to seed the digest.
offset - The offset, or starting position, of the seed data within the array.
length - The number of bytes to use as seed data.
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(byte[] seed)
Creates a PKCS1MGF1PseudoRandomSource object using a seed. This constructor will by default use the SHA1Digest for the digest.

Parameters:
seed - A byte array containing the seed that will be used to seed the digest.
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

PKCS1MGF1PseudoRandomSource

public PKCS1MGF1PseudoRandomSource(SymmetricKey seed)
                            throws CryptoTokenException,
                                   CryptoUnsupportedOperationException
Creates a PKCS1MGF1PseudoRandomSource object using a SymmetricKey seed. This constructor will use the SHA1Digest by default.

Parameters:
seed - A symmetric key containing the seed that will be used to seed the digest.
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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 this PseudoRandomSource "PKCS1MGF1".

This method will always return the String "PKCS1MGF1".

Specified by:
getAlgorithm in interface PseudoRandomSource
Returns:
A String representing 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

xorBytes

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

Specified by:
xorBytes in interface PseudoRandomSource
Specified by:
xorBytes in class AbstractPseudoRandomSource
Parameters:
buffer - The byte array to xor the bytes into.
offset - The starting offset within buffer.
length - The number of bytes to xor.
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

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.

Specified by:
getAvailable in interface PseudoRandomSource
Returns:
An integer that represents the number of bytes.
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

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.

Specified by:
getMaxAvailable in interface PseudoRandomSource
Returns:
An integer that specifies the maximum number of random bytes that can be produced.
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