|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.DSACryptoToken
public abstract class DSACryptoToken
An interface for DSA cryptographic tokens to implement.
The RIM Crypto API will call this interface when a DSA operation is to be performed on a DSA enabled cryptographic token. Note: This class must be extended in order to override the default implementation.
Details on implementing for smart cards.
Note: It is considered good practice to implement the equals and hashCode methods when extending this class. Otherwise, odd behaviour can occur.
CryptoToken
,
DSACryptoSystem
,
DSAPrivateKey
,
DSAPublicKey
Field Summary |
---|
Fields inherited from interface net.rim.device.api.crypto.AsymmetricCryptoToken |
---|
KEY_GENERATION, PRIVATE_KEY_OPERATION, PUBLIC_KEY_OPERATION |
Constructor Summary | ||
---|---|---|
|
protected |
DSACryptoToken()
Creates a new DSACryptoToken object. |
Method Summary | ||
---|---|---|
|
DSAKeyPair |
createDSAKeyPair(CryptoTokenCryptoSystemData cryptoTokenData)
Returns a copy of the DSA key pair. |
|
void |
deleteDSAPrivateKey(CryptoTokenPrivateKeyData data)
Delete the specified key on the crypto token. |
|
void |
deleteDSAPublicKey(CryptoTokenPublicKeyData data)
Delete the specified key on the crypto token. |
|
byte[] |
extractDSAPrivateKeyData(CryptoTokenPrivateKeyData cryptoTokenData)
Returns the private key data. |
|
byte[] |
extractDSAPublicKeyData(CryptoTokenPrivateKeyData cryptoTokenData)
Returns the public key data. |
|
byte[] |
extractDSAPublicKeyData(CryptoTokenPublicKeyData cryptoTokenData)
Returns the public key data. |
|
String |
getAlgorithm()
Returns the algorithm supported by this token, ie "DSA". |
|
int |
getDSACryptoSystemBitLength(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the number of bits (aka the "strength") of the crypto system, eg 1024. |
|
CryptoTokenCryptoSystemData |
getDSACryptoSystemData(byte[] p,
byte[] q,
byte[] g,
String name)
Creates a crypto system associated with this token. |
|
byte[] |
getDSACryptoSystemG(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the g domain parameter. |
|
String |
getDSACryptoSystemName(CryptoTokenCryptoSystemData cryptoTokenData)
Returns a String that indicates the set of parameters in use, eg "WTLS1", or null. |
|
byte[] |
getDSACryptoSystemP(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the p domain parameter. |
|
byte[] |
getDSACryptoSystemQ(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the q domain parameter, or null. |
|
int |
getDSAPrivateKeyLength(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the length of the private key. |
|
int |
getDSAPublicKeyLength(CryptoTokenCryptoSystemData cryptoTokenData)
Returns the length of the public key. |
|
DSACryptoSystem[] |
getSuggestedDSACryptoSystems()
Returns a list of supported or suggested crypto systems. |
|
CryptoTokenPrivateKeyData |
injectDSAPrivateKey(CryptoTokenCryptoSystemData cryptoSystemData,
byte[] data)
Inserts the raw private key data into the crypto token. |
|
CryptoTokenPublicKeyData |
injectDSAPublicKey(CryptoTokenCryptoSystemData cryptoSystemData,
byte[] data)
Inserts the raw public key data into the crypto token. |
|
boolean |
isSupported(CryptoSystem cryptoSystem,
int operation)
Indicates whether the chosen operation is supported by this CryptoToken using the provided CryptoSytem. |
|
boolean |
providesUserAuthentication()
Returns true if the token provides its own user authentication checks, eg a smartcard will prompt for a password before allowing access to the keys. |
|
void |
signDSA(CryptoTokenCryptoSystemData cryptoSystemData,
CryptoTokenPrivateKeyData privateKeyData,
byte[] digest,
int digestOffset,
int digestLength,
byte[] r,
int rOffset,
byte[] s,
int sOffset)
Generates a DSA signature. |
|
void |
signDSA(CryptoTokenCryptoSystemData cryptoSystemData,
CryptoTokenPrivateKeyData privateKeyData,
byte[] digest,
int digestOffset,
int digestLength,
byte[] r,
int rOffset,
byte[] s,
int sOffset,
Object context)
Generates a DSA signature. |
|
boolean |
verifyDSA(CryptoTokenCryptoSystemData cryptoSystemData,
CryptoTokenPublicKeyData publicKeyData,
byte[] digest,
int digestOffset,
int digestLength,
byte[] r,
int rOffset,
byte[] s,
int sOffset)
Verifies a DSA signature. |
|
void |
verifyDSACryptoSystemData(CryptoTokenCryptoSystemData cryptoSystemData)
Checks the validity of the crypto system parameters represented by this token. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DSACryptoToken()
DSACryptoToken
object.
This constructor is not used.
Method Detail |
---|
public final String getAlgorithm()
This method will always return the String "DSA".
getAlgorithm
in interface CryptoToken
public boolean providesUserAuthentication()
providesUserAuthentication
in interface CryptoToken
public int getDSACryptoSystemBitLength(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public String getDSACryptoSystemName(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] getDSACryptoSystemP(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] getDSACryptoSystemQ(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] getDSACryptoSystemG(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public int getDSAPublicKeyLength(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public int getDSAPrivateKeyLength(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] extractDSAPublicKeyData(CryptoTokenPublicKeyData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] extractDSAPublicKeyData(CryptoTokenPrivateKeyData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public byte[] extractDSAPrivateKeyData(CryptoTokenPrivateKeyData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public CryptoTokenCryptoSystemData getDSACryptoSystemData(byte[] p, byte[] q, byte[] g, String name) throws CryptoTokenException, CryptoUnsupportedOperationException, InvalidCryptoSystemException, UnsupportedCryptoSystemException
p
- The domain parameter p.q
- The domain parameter q.g
- The domain parameter g.name
- The name of the crypto system.
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.
InvalidCryptoSystemException
- Thrown if one or all of the domain
parameters are invalid.
UnsupportedCryptoSystemException
- Thrown if one or all of the
specified domain paramters are invalid.public void verifyDSACryptoSystemData(CryptoTokenCryptoSystemData cryptoSystemData) throws CryptoTokenException, CryptoUnsupportedOperationException, InvalidCryptoSystemException
This method is called by DSACryptoSystem.verify()
after it
has gone through the integrity tests for the DSACryptoSystem
object.
cryptoSystemData
- The crypto system data to be verified.
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.
InvalidCryptoSystemException
- Thrown if the specified crypto
system is improperly formatted or invalid.public DSACryptoSystem[] getSuggestedDSACryptoSystems() throws CryptoTokenException, CryptoUnsupportedOperationException
This list does not have to be exhaustive.
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.public DSAKeyPair createDSAKeyPair(CryptoTokenCryptoSystemData cryptoTokenData) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoTokenData
- The data associated with the crypto token.
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.public CryptoTokenPublicKeyData injectDSAPublicKey(CryptoTokenCryptoSystemData cryptoSystemData, byte[] data) throws InvalidKeyException, CryptoTokenException, CryptoUnsupportedOperationException
cryptoSystemData
- The data associated with the crypto token.data
- A byte array containing the key data.
InvalidKeyException
- Thrown if the specified key is improperly
formatted or invalid.
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.public CryptoTokenPrivateKeyData injectDSAPrivateKey(CryptoTokenCryptoSystemData cryptoSystemData, byte[] data) throws InvalidKeyException, CryptoTokenException, CryptoUnsupportedOperationException
cryptoSystemData
- The data associated with the crypto token.data
- A byte array containing the key data.
InvalidKeyException
- Thrown if the specified key is improperly
formatted or invalid.
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.public void deleteDSAPublicKey(CryptoTokenPublicKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The key data contained within the token.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public void deleteDSAPrivateKey(CryptoTokenPrivateKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The key data contained within the token.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public void signDSA(CryptoTokenCryptoSystemData cryptoSystemData, CryptoTokenPrivateKeyData privateKeyData, byte[] digest, int digestOffset, int digestLength, byte[] r, int rOffset, byte[] s, int sOffset) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoSystemData
- The data associated with the crypto token.privateKeyData
- The DSA private key used to sign the data.digest
- The digest data to be signed.digestOffset
- The offset in the digest buffer where digest data begins.digestLength
- The length of the digest to be signed.r
- A buffer to hold return result of r.rOffset
- The offset to begin the writing the result r in the buffer r.s
- A buffer to hold return result of s.sOffset
- The offset to begin the writing the result s in the buffer s.
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.public void signDSA(CryptoTokenCryptoSystemData cryptoSystemData, CryptoTokenPrivateKeyData privateKeyData, byte[] digest, int digestOffset, int digestLength, byte[] r, int rOffset, byte[] s, int sOffset, Object context) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoSystemData
- The data associated with the crypto token.privateKeyData
- The DSA private key used to sign the data.digest
- The digest data to be signed.digestOffset
- The offset in the digest buffer where digest data begins.digestLength
- The length of the digest to be signed.r
- A buffer to hold return result of r.rOffset
- The offset to begin the writing the result r in the buffer r.s
- A buffer to hold return result of s.sOffset
- The offset to begin the writing the result s in the buffer s.context
- The context object.
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.public boolean verifyDSA(CryptoTokenCryptoSystemData cryptoSystemData, CryptoTokenPublicKeyData publicKeyData, byte[] digest, int digestOffset, int digestLength, byte[] r, int rOffset, byte[] s, int sOffset) throws CryptoTokenException, CryptoUnsupportedOperationException
cryptoSystemData
- The data associated with the crypto token.publicKeyData
- The DSA public key used to verify the data.digest
- The digest data to be signed.digestOffset
- The offset in the digest buffer where digest data begins.digestLength
- The length of the digest to be signed.r
- A buffer to hold return result of r.rOffset
- The offset to begin the writing the result r in the buffer r.s
- A buffer to hold return result of s.sOffset
- The offset to begin the writing the result s in the buffer s.
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.public boolean isSupported(CryptoSystem cryptoSystem, int operation)
isSupported
in interface AsymmetricCryptoToken
cryptoSystem
- The CryptoSystem to check against.operation
- An integer, either KEY_GENERATION, PUBLIC_KEY_OPERATION, PRIVATE_KEY_OPERATION,
or some other value specific to the cryptosystem that indicates the operation to be checked.
|
|||||||||
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