com.intel.crypto
Class SymmetricSignatureAlg
- java.lang.Object
-
- com.intel.crypto.SymmetricSignatureAlg
-
- All Implemented Interfaces:
- SequentialSignature, Signature
public abstract class SymmetricSignatureAlg extends java.lang.Object implements SequentialSignature
This abstract class represents a symmetric signing algorithm. This class implements the signature interface and creates specific signing algorithm implementations using the
create
factory method. In addition, this class supports signing or verification of data in several transactions and maintains the intermediate internal state between them (see thesignUpdate
andverifyUpdate
methods for more details).The following signing algorithms are supported by this class:
- HMAC SHA-1
- HMAC SHA-256
- HMAC SHA-1 with Platform Binding key
- HMAC SHA-256 with Platform Binding key
Before using the signing or verification methods of this class, the class must be configured with the following parameters:
- Signing key - using the
setKey
method (if not using an instance that implements Platform Binding algorithm).
-
-
Field Summary
Fields Modifier and Type Field and Description static short
ALG_TYPE_HMAC_SHA1
HMAC SHA1 algorithm.static short
ALG_TYPE_HMAC_SHA256
HMAC SHA256 algorithm.static short
ALG_TYPE_PBIND_HMAC_SHA1
HMAC SHA1 with Platform Binding key algorithm.static short
ALG_TYPE_PBIND_HMAC_SHA256
HMAC SHA256 with Platform Binding key algorithm.static short
HMAC_SHA1_SIGNATURE_LENGTH
HMAC SHA1 signature length in bytes.static short
HMAC_SHA256_SIGNATURE_LENGTH
HMAC SHA256 signature length in bytes.
-
Method Summary
Methods Modifier and Type Method and Description static SymmetricSignatureAlg
create(short algType)
Factory method for creating a concrete instance.short
getAlgType()
Returns the algorithm type used by this instance.abstract short
getKey(byte[] keyArray, short keyIndex)
Obtains the key currently used by this instance.abstract short
getKeySize()
Returns the key size (in bytes) currently used by this instance.abstract void
setKey(byte[] keyArray, short keyIndex, short keyLength)
Sets the key to be used by this instance.-
Methods inherited from interface com.intel.crypto.SequentialSignature
signComplete, signUpdate, verifyComplete, verifyUpdate
-
Methods inherited from interface com.intel.crypto.Signature
getSignatureLength
-
-
-
-
Field Detail
-
ALG_TYPE_HMAC_SHA1
public static final short ALG_TYPE_HMAC_SHA1
HMAC SHA1 algorithm.- See Also:
- Constant Field Values
-
ALG_TYPE_HMAC_SHA256
public static final short ALG_TYPE_HMAC_SHA256
HMAC SHA256 algorithm.- See Also:
- Constant Field Values
-
ALG_TYPE_PBIND_HMAC_SHA1
public static final short ALG_TYPE_PBIND_HMAC_SHA1
HMAC SHA1 with Platform Binding key algorithm. This algorithm type does not require a signing key to be configured using thesetKey
method. The Platform Binding key is generated internally by the algorithm implementation, unique for each application and each platform, and cannot be accessed through any of the external interfaces. Note that different instances of the same application will share the same Platform Binding key. This algorithm type can be used by applications to add integrity protection to data saved in external storage (for example, the hard drive).- See Also:
- Constant Field Values
-
ALG_TYPE_PBIND_HMAC_SHA256
public static final short ALG_TYPE_PBIND_HMAC_SHA256
HMAC SHA256 with Platform Binding key algorithm. This algorithm type does not require a signing key to be configured using thesetKey
method. The Platform Binding key is generated internally by the algorithm implementation, unique for each application and each platform, and cannot be accessed through any of the external interfaces. Note that different instances of the same application will share the same Platform Binding key. This algorithm type can be used by applications to add integrity protection to data saved in external storage (for example, the hard drive).- See Also:
- Constant Field Values
-
HMAC_SHA1_SIGNATURE_LENGTH
public static final short HMAC_SHA1_SIGNATURE_LENGTH
HMAC SHA1 signature length in bytes.- See Also:
- Constant Field Values
-
HMAC_SHA256_SIGNATURE_LENGTH
public static final short HMAC_SHA256_SIGNATURE_LENGTH
HMAC SHA256 signature length in bytes.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAlgType
public short getAlgType()
Returns the algorithm type used by this instance.- Returns:
- The algorithm used by this type, see ALG_TYPE_... definitions above for possible values.
-
setKey
public abstract void setKey(byte[] keyArray, short keyIndex, short keyLength) throws CryptoException
Sets the key to be used by this instance. This method must be called before using any processing methods of this class. Calling this method will override any other key previously stored by this instance and also reset any sequence of operations that has already started.- Parameters:
keyArray
- the key datakeyIndex
- index in the key arraykeyLength
- key length in bytes- Throws:
NotSupportedException
- if this method is called for an instance of the Platform Binding algorithm type, or if the provided key size is not supported for this signature type.CryptoException
-
getKey
public abstract short getKey(byte[] keyArray, short keyIndex) throws CryptoException
Obtains the key currently used by this instance.- Parameters:
keyArray
- output array for the keykeyIndex
- index in the output array- Returns:
- The returned key size in bytes.
- Throws:
NotInitializedException
- if the key was not initialized yet.NotSupportedException
- when called for an instance of Platform Binding algorithm type.CryptoException
-
getKeySize
public abstract short getKeySize() throws CryptoException
Returns the key size (in bytes) currently used by this instance.- Returns:
- Key size in bytes.
- Throws:
NotInitializedException
- if the key was not initialized yet.CryptoException
-
create
public static final SymmetricSignatureAlg create(short algType) throws CryptoException
Factory method for creating a concrete instance.- Parameters:
algType
- the requested algorithm, see ALG_TYPE_.. definitions above for the possible values- Returns:
SymmetricSignAlg
instance of the requested type.- Throws:
NotSupportedException
- if the requested algorithm type is not supported.CryptoException
-
-