|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.AbstractPseudoRandomSource
net.rim.device.api.crypto.X942KDFPseudoRandomSource
public final class X942KDFPseudoRandomSource
Implements the key derivation function (KDF) found in ANSI X9.42. This KDF does not have a definite length and can be used to generate a variety of symmetric keys.
Constructor Summary | ||
---|---|---|
|
X942KDFPseudoRandomSource(byte[] sharedSecret,
int offset,
int length,
OID algorithmID,
byte[] partyAInfo,
byte[] partyBInfo,
byte[] suppPrivateInfo,
byte[] suppPublicInfo)
Creates an X942KDFPseudoRandomSource object using the given parameters and
the default SHA-1 digest. |
|
|
X942KDFPseudoRandomSource(byte[] sharedSecret,
int offset,
int length,
OID algorithmID,
byte[] partyAInfo,
byte[] partyBInfo,
byte[] suppPrivateInfo,
byte[] suppPublicInfo,
Digest digest)
Creates an X942KDFPseudoRandomSource object using the given parameters and
the specified digest. |
|
|
X942KDFPseudoRandomSource(byte[] sharedSecret,
OID algorithmID,
byte[] partyAInfo,
byte[] partyBInfo,
byte[] suppPrivateInfo,
byte[] suppPublicInfo)
Creates an X942KDFPseudoRandomSource object using the given parameters and
the default SHA-1 digest. |
|
|
X942KDFPseudoRandomSource(byte[] sharedSecret,
OID algorithmID,
byte[] partyAInfo,
byte[] partyBInfo,
byte[] suppPrivateInfo,
byte[] suppPublicInfo,
Digest digest)
Creates an X942KDFPseudoRandomSource object using the specified parameters and the given digest. |
Method Summary | ||
---|---|---|
|
String |
getAlgorithm()
Returns the name of this PseaudoRandomSource "X942KDF". |
|
int |
getAvailable()
Returns the number of pseudo random bytes currently available. |
|
int |
getMaxAvailable()
Returns the maximum number of pseudo random bytes that this PRNG can produce. |
|
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 |
---|
public X942KDFPseudoRandomSource(byte[] sharedSecret, OID algorithmID, byte[] partyAInfo, byte[] partyBInfo, byte[] suppPrivateInfo, byte[] suppPublicInfo)
X942KDFPseudoRandomSource
object using the given parameters and
the default SHA-1 digest. Optional parameters may be null.
The intended use of this PseudoRandomSource is in order to create a shared secret key between two people ( party A and party B ). So the javadocs refer to the different parameters as belonging to one party or the other. That does not restrict the use of this PseudoRandomSource, however. The parameters could all be created by one user and passed in.
Note: While there is no restriction on what OID you can pass into this constructor, the intention is that you would pass the OID representing the symmetric key algorithm you wish to make a key for. For example, suppose you wished to create a Triple DES key, you could create it as follows. Assume sharedSecret has been set. We'll assume the optional parameters are null for clarity sake.
X942KDFPseudoRandomSource source = new X942KDFPseudoRandomSource( sharedSecret, OIDs.getOID( OIDs.desEDE3CBC ), null, null, null ); byte[] keyData = source.getBytes( TripleDESKey.LENGTH ); TripleDESKey key = new TripleDESKey( keyData );Some other useful OIDs you could use are OIDs.AES_128_CBC ( and the other AES oids ), OIDs.rc2CBC, etc..
sharedSecret
- A byte array containing the shared secret generated by a key-agreement scheme.algorithmID
- The OID of the symmetric key algorithm with which the generated key will be used. No
limits are placed on the type of OID you pass in, though, so it can be any OID.partyAInfo
- A byte array containing information provided by party A. This parameter is can be null.partyBInfo
- A byte array containing information provided by party B. This parameter is can be null.suppPrivateInfo
- A byte array containing additional, mutually-known private information. This parameter is can be null.suppPublicInfo
- A byte array containing additional, mutually-known public information. This parameter is can be null.public X942KDFPseudoRandomSource(byte[] sharedSecret, int offset, int length, OID algorithmID, byte[] partyAInfo, byte[] partyBInfo, byte[] suppPrivateInfo, byte[] suppPublicInfo)
X942KDFPseudoRandomSource
object using the given parameters and
the default SHA-1 digest. Optional parameters may be null.
The intended use of this PseudoRandomSource is in order to create a shared secret key between two people ( party A and party B ). So the javadocs refer to the different parameters as belonging to one party or the other. That does not restrict the use of this PseudoRandomSource, however. The parameters could all be created by one user and passed in.
Note: While there is no restriction on what OID you can pass into this constructor, the intention is that you would pass the OID representing the symmetric key algorithm you wish to make a key for. For example, suppose you wished to create a Triple DES key, you could create it as follows :
Assume sharedSecret has been set. We'll assume the optional parameters are null for clarity sake. X942KDFPseudoRandomSource source = new X942KDFPseudoRandomSource( sharedSecret, OIDs.getOID( OIDs.desEDE3CBC ), null, null, null ); byte[] keyData = source.getBytes( TripleDESKey.LENGTH ); TripleDESKey key = new TripleDESKey( keyData ); Some other useful OIDs you could use are OIDs.AES_128_CBC ( and the other AES oids ), OIDs.rc2CBC, etc..
sharedSecret
- A byte array containing the shared secret generated by a key-agreement scheme.offset
- The offset, or initial position, of the shared secret data within the array.length
- The number of bytes to use as shared secret data.algorithmID
- The OID of the symmetric key algorithm with which the generated key will be used. No
limits are placed on the type of OID you pass in, though, so it can be any OID.partyAInfo
- A byte array containing the information provided by party A. This parameter is can be null.partyBInfo
- A byte array containing the information provided by party B. This parameter is can be null.suppPrivateInfo
- A byte array containing additional, mutually-known private information. This parameter is can be null.suppPublicInfo
- A byte array containing additional, mutually-known public information. This parameter is can be null.public X942KDFPseudoRandomSource(byte[] sharedSecret, OID algorithmID, byte[] partyAInfo, byte[] partyBInfo, byte[] suppPrivateInfo, byte[] suppPublicInfo, Digest digest)
X942KDFPseudoRandomSource
object using the specified parameters and the given digest.
Optional parameters may be null.
The intended use of this PseudoRandomSource is in order to create a shared secret key between two people ( party A and party B ). So the javadocs refer to the different parameters as belonging to one party or the other. That does not restrict the use of this PseudoRandomSource, however. The parameters could all be created by one user and passed in.
Note: While there is no restriction on what OID you can pass into this constructor, the intention is that you would pass the OID representing the symmetric key algorithm you wish to make a key for. For example, suppose you wished to create a Triple DES key, you could create it as follows :
Assume sharedSecret has been set. We'll assume the optional parameters are null for clarity sake. X942KDFPseudoRandomSource source = new X942KDFPseudoRandomSource( sharedSecret, OIDs.getOID( OIDs.desEDE3CBC ), null, null, null ); byte[] keyData = source.getBytes( TripleDESKey.LENGTH ); TripleDESKey key = new TripleDESKey( keyData ); Some other useful OIDs you could use are OIDs.AES_128_CBC ( and the other AES oids ), OIDs.rc2CBC, etc..
sharedSecret
- A byte array containing the shared secret generated by a key-agreement scheme.algorithmID
- The OID of the symmetric key algorithm with which the generated key will be used. No
limits are placed on the type of OID you pass in, though, so it can be any OID.partyAInfo
- A byte array containing information provided by party A. This parameter is can be null.partyBInfo
- A byte array containing information provided by party B. This parameter is can be null.suppPrivateInfo
- A byte array containing additional, mutually-known private information. This parameter is can be null.suppPublicInfo
- A byte array containing additional, mutually-known public information. This parameter is can be null.digest
- An instance of the desired digest.public X942KDFPseudoRandomSource(byte[] sharedSecret, int offset, int length, OID algorithmID, byte[] partyAInfo, byte[] partyBInfo, byte[] suppPrivateInfo, byte[] suppPublicInfo, Digest digest)
X942KDFPseudoRandomSource
object using the given parameters and
the specified digest. Optional parameters may be null.
The intended use of this PseudoRandomSource is in order to create a shared secret key between two people ( party A and party B ). So the javadocs refer to the different parameters as belonging to one party or the other. That does not restrict the use of this PseudoRandomSource, however. The parameters could all be created by one user and passed in.
Note: While there is no restriction on what OID you can pass into this constructor, the intention is that you would pass the OID representing the symmetric key algorithm you wish to make a key for. For example, suppose you wished to create a Triple DES key, you could create it as follows :
Assume sharedSecret has been set. We'll assume the optional parameters are null for clarity sake. X942KDFPseudoRandomSource source = new X942KDFPseudoRandomSource( sharedSecret, OIDs.getOID( OIDs.desEDE3CBC ), null, null, null ); byte[] keyData = source.getBytes( TripleDESKey.LENGTH ); TripleDESKey key = new TripleDESKey( keyData ); Some other useful OIDs you could use are OIDs.AES_128_CBC ( and the other AES oids ), OIDs.rc2CBC, etc..
sharedSecret
- A byte array containing the shared secret generated by a key-agreement scheme.algorithmID
- The OID of the symmetric key algorithm with which the generated key will be used. No
limits are placed on the type of OID you pass in, though, so it can be any OID.offset
- The offset, or initial position, of the shared secret data within the array.length
- The number of bytes to use as shared secret data.partyAInfo
- A byte array containing the information provided by party A. This parameter is can be null.partyBInfo
- A byte array containing the information provided by party B. This parameter is can be null.suppPrivateInfo
- A byte array containing additional, mutually-known private information. This parameter is can be null.suppPublicInfo
- A byte array containing additional, mutually-known public information. This parameter is can be null.digest
- An instance of the digest to use for hashing.Method Detail |
---|
public String getAlgorithm()
getAlgorithm
in interface PseudoRandomSource
public void xorBytes(byte[] buffer, int offset, int length)
AbstractPseudoRandomSource
xorBytes
in interface PseudoRandomSource
xorBytes
in class AbstractPseudoRandomSource
buffer
- The byte array to xor the bytes into.offset
- The starting offset within buffer.length
- The number of bytes to xor.public int getAvailable()
PseudoRandomSource
For PRNG sources that have an indefinite length but implement
this interface, the value returned is Integer.MAX
.
getAvailable
in interface PseudoRandomSource
public int getMaxAvailable()
PseudoRandomSource
For PRNG sources that have an indefinite length but implement
this interface, the value returned is Integer.MAX
.
getMaxAvailable
in interface PseudoRandomSource
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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