SHOW Signed
 

net.rim.device.api.crypto
Class P1363KDF1PseudoRandomSource

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

public final class P1363KDF1PseudoRandomSource
extends AbstractPseudoRandomSource
implements PseudoRandomSource

The P1363KDF1PseudoRandomSource class implements the key derivation function 1 (KDF1) found in the main section of P1363. The version we implemented is from the draft 13 ( "d13" ) P1363 document.

Note that it has a fixed length determined by the hash function. The recommended hash functions to use with this KDF are SHA-1 and RIPEMD-160.

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

Constructor Summary
 Category: Signed P1363KDF1PseudoRandomSource(byte[] sharedSecret, int offset, int length, byte[] optionalParameters)
          Creates a P1363KDF1PseudoRandomSource object using the given parameters and the default SHA-1 digest.
 Category: Signed P1363KDF1PseudoRandomSource(byte[] sharedSecret, int offset, int length, byte[] optionalParameters, Digest digest)
          Creates a P1363KDF1PseudoRandomSource object using the given parameters and the specified digest.
 
Method Summary
 Category: Signed  String getAlgorithm()
          Returns the name of this PseudoRandomSource "P1363KDF1".
 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 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

P1363KDF1PseudoRandomSource

public P1363KDF1PseudoRandomSource(byte[] sharedSecret,
                                   int offset,
                                   int length,
                                   byte[] optionalParameters)
Creates a P1363KDF1PseudoRandomSource object using the given parameters and the default SHA-1 digest.

Parameters:
sharedSecret - The shared secret (from the key-agreement scheme) to base the derived key upon.
offset - The offset, or starting position, of the shared secret data within the array.
length - The number of bytes to use as shared secret data.
optionalParameters - A byte array containing information to be hashed into the derived key. This parameter is optional.
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.

P1363KDF1PseudoRandomSource

public P1363KDF1PseudoRandomSource(byte[] sharedSecret,
                                   int offset,
                                   int length,
                                   byte[] optionalParameters,
                                   Digest digest)
Creates a P1363KDF1PseudoRandomSource object using the given parameters and the specified digest.

Parameters:
sharedSecret - A byte array containing the shared secret (from the key-agreement scheme) to base the derived key upon.
offset - The offset, or starting position, of the shared secret data within the array.
length - The number of bytes to use as shared secret data.
optionalParameters - A byte array containing information to be hashed into the derived key. This parameter is optional.
digest - The digest algorithm to use.
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

getAlgorithm

public String getAlgorithm()
Returns the name of this PseudoRandomSource "P1363KDF1".

This method will always return the String "P1363KDF1".

Returns:
A String that represents the name of the algorithm.
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.

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

Following copied from interface: PseudoRandomSource
Returns:
An integer that represents the number of bytes.
Throws:
CryptoTokenException - Thrown when a problem occurs with a 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.

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

Following copied from interface: PseudoRandomSource
Returns:
An integer that specifies the maximum number of random bytes that can be produced.
Throws:
CryptoTokenException - Thrown when a problem occurs with a 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.

xorBytes

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

Specified by:
xorBytes in interface PseudoRandomSource
Overrides:
xorBytes in class AbstractPseudoRandomSource
Since:
JDE 3.6.0

Following copied from interface: PseudoRandomSource
Parameters:
buffer - The buffer to xor the bytes into.
offset - The starting offset, or initial bit position, of the data within the buffer.
length - The number of bytes to xor.
Throws:
IllegalStateException - if the available random bytes are exhausted.
CryptoTokenException - Thrown when a problem occurs with a 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.



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.