net.rim.device.api.crypto
Interface MAC
- All Known Implementing Classes:
- CBCMAC, HMAC, NullMAC
public interface MAC
MAC
is an interface which represents the properties shared between all Message
Authentication Code algorithms. MAC functions are also called keyed hash functions since they
require a key to operate.
The two common ways of obtaining a MAC are by using a digest algorithm
and by using a block cipher.
- 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 Summary |
|
boolean |
checkMAC(byte[] mac)
Returns true if the MAC calculated so far is the same as the given MAC. |
|
boolean |
checkMAC(byte[] mac,
boolean reset)
Returns true if the MAC calculated so far is the same as the given MAC. |
|
boolean |
checkMAC(byte[] mac,
int offset)
Returns true if the MAC calculated so far is the same as the given MAC. |
|
boolean |
checkMAC(byte[] mac,
int offset,
boolean reset)
Returns true if the MAC calculated so far is the same as the given MAC. |
|
String |
getAlgorithm()
Returns the name of the mac alonng with the digest or block cipher used, such as "HMAC/SHA1". |
|
int |
getLength()
Returns the length, in bytes, of the MAC. |
|
byte[] |
getMAC()
Returns a byte array containing the MAC of all the input data since the
last reset. |
|
byte[] |
getMAC(boolean reset)
Returns a byte array containing the MAC of all the input data since the
last reset. |
|
int |
getMAC(byte[] buffer,
int offset)
Puts the MAC of all the input data since the last reset
into the given buffer starting at the specified offset. |
|
int |
getMAC(byte[] buffer,
int offset,
boolean reset)
Puts the MAC of all the input data since the last reset
into the given buffer starting at the specified offset. |
|
void |
reset()
Reinitializes the MAC. |
|
void |
update(byte[] data)
Feeds more data into the MAC algorithm. |
|
void |
update(byte[] data,
int offset,
int length)
Feeds more data into the MAC algorithm. |
|
void |
update(int data)
Feeds more data into the MAC algorithm. |
getAlgorithm
String getAlgorithm()
- Returns the name of the mac alonng with the digest or block cipher used, such as "HMAC/SHA1".
- Returns:
- A String representing the mac algorithm along with the name of the digest or cipher.
- 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
reset
void reset()
throws CryptoTokenException
- Reinitializes the MAC.
- Throws:
CryptoTokenException
- Thrown if an error occurs with the 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.
- Since:
- BlackBerry API 3.6.0
update
void update(int data)
throws CryptoTokenException
- Feeds more data into the MAC algorithm.
- Parameters:
data
- A byte of input data.
- 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.
- Since:
- BlackBerry API 3.6.0
update
void update(byte[] data)
throws CryptoTokenException
- Feeds more data into the MAC algorithm.
- Parameters:
data
- The array containing the input data. The entire array is
added to the MAC.
- 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.
- Since:
- BlackBerry API 3.6.0
update
void update(byte[] data,
int offset,
int length)
throws CryptoTokenException
- Feeds more data into the MAC algorithm.
- Parameters:
data
- The array containing the input data.offset
- The offset, or initial position, of the data within the array.length
- The length of the input data, in 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.
- Since:
- BlackBerry API 3.6.0
getLength
int getLength()
- Returns the length, in bytes, of the MAC.
- Returns:
- An integer that represents the length of the MAC.
- 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
getMAC
byte[] getMAC()
throws CryptoTokenException
- Returns a byte array containing the MAC of all the input data since the
last reset. The MAC is then reset.
- Returns:
- A byte array containing the MAC.
- 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.
- Since:
- BlackBerry API 3.6.0
getMAC
byte[] getMAC(boolean reset)
throws CryptoTokenException
- Returns a byte array containing the MAC of all the input data since the
last reset.
- Parameters:
reset
- if true then the MAC is reset.
- Returns:
- A byte array containing the MAC.
- 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.
- Since:
- BlackBerry API 3.6.0
getMAC
int getMAC(byte[] buffer,
int offset)
throws CryptoTokenException
- Puts the MAC of all the input data since the last reset
into the given buffer starting at the specified offset.
The MAC is then reset.
- Parameters:
buffer
- The array to contain the MAC.offset
- The offset, or initial position, of teh MAC data within the buffer.
- Returns:
- An integer representing the number of bytes written to the
buffer.
- 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.
- Since:
- BlackBerry API 3.6.0
getMAC
int getMAC(byte[] buffer,
int offset,
boolean reset)
throws CryptoTokenException
- Puts the MAC of all the input data since the last reset
into the given buffer starting at the specified offset.
The MAC is then reset.
- Parameters:
buffer
- The array to contain the MAC.offset
- The offset, or initial position, of teh MAC data within the buffer.reset
- if true then the MAC is reset.
- Returns:
- An integer representing the number of bytes written to the
buffer.
- 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.
- Since:
- BlackBerry API 3.6.0
checkMAC
boolean checkMAC(byte[] mac)
throws CryptoTokenException
- Returns true if the MAC calculated so far is the same as the given MAC. The MAC is then reset.
- Parameters:
mac
- The MAC to check against.
- Returns:
- Returns true if the MAC verifies.
- 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.
- Since:
- BlackBerry API 3.6.0
checkMAC
boolean checkMAC(byte[] mac,
boolean reset)
throws CryptoTokenException
- Returns true if the MAC calculated so far is the same as the given MAC.
- Parameters:
mac
- The MAC to check against.reset
- if true then the MAC is reset.
- Returns:
- Returns true if the MAC verifies.
- 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.
- Since:
- BlackBerry API 3.6.0
checkMAC
boolean checkMAC(byte[] mac,
int offset)
throws CryptoTokenException
- Returns true if the MAC calculated so far is the same as the given MAC. The MAC is then reset.
- Parameters:
mac
- The array containing the MAC to check against.offset
- The starting offset of the MAC in the array.
- Returns:
- Returns true if the MAC verifies.
- 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.
- Since:
- BlackBerry API 3.6.0
checkMAC
boolean checkMAC(byte[] mac,
int offset,
boolean reset)
throws CryptoTokenException
- Returns true if the MAC calculated so far is the same as the given MAC.
- Parameters:
mac
- The array containing the MAC to check against.offset
- The starting offset of the MAC in the array.reset
- if true then the MAC is reset.
- Returns:
- Returns true if the MAC verifies.
- 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.
- 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