Package anbxj
Class Crypto_HmacPair
java.lang.Object
anbxj.Crypto_HmacPair
- All Implemented Interfaces:
Serializable
A class to store the result of an HMAC operation along with metadata about the used algorithm.
Moreover, it allows carrying information for AnBx private or public digests.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCrypto_HmacPair(Crypto_ByteArray hashValue, Crypto_SealedPair k, String HMacAlgorithm) Constructs a Crypto_HmacPair with the specified parameters.Crypto_HmacPair(Crypto_ByteArray hashValue, SecretKey sk, String HMacAlgorithm) Constructs a Crypto_HmacPair with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidAnonymizes the HMAC pair by removing the public secret key.static Crypto_HmacPairfromByteArray(byte[] data) Deserializes aCrypto_HmacPairfrom a byte array, delegating toCrypto_SerializationUtils.deserialize(byte[]).Gets the HMAC algorithm.Gets the hash value.getK()Gets the sealed pair.getSK()Gets the secret key.byte[]Serializes thisCrypto_HmacPairinto a byte array using standard Java object serialization, delegating toCrypto_SerializationUtils.serialize(Object).toString()Returns a string representation of the Crypto_HmacPair.
-
Constructor Details
-
Crypto_HmacPair
Constructs a Crypto_HmacPair with the specified parameters.- Parameters:
hashValue- The hash value.k- The sealed pair.HMacAlgorithm- The HMAC algorithm.
-
Crypto_HmacPair
Constructs a Crypto_HmacPair with the specified parameters.- Parameters:
hashValue- The hash value.sk- The secret key.HMacAlgorithm- The HMAC algorithm.
-
-
Method Details
-
getHashValue
Gets the hash value.- Returns:
- The hash value.
-
getK
Gets the sealed pair.- Returns:
- The sealed pair.
-
getSK
Gets the secret key.- Returns:
- The secret key.
-
getAlgorithm
Gets the HMAC algorithm.- Returns:
- The HMAC algorithm.
-
anonymize
public void anonymize()Anonymizes the HMAC pair by removing the public secret key. -
toByteArray
Serializes thisCrypto_HmacPairinto a byte array using standard Java object serialization, delegating toCrypto_SerializationUtils.serialize(Object).- Returns:
- the serialized bytes
- Throws:
IOException- if an I/O error occurs during serialization
-
fromByteArray
Deserializes aCrypto_HmacPairfrom a byte array, delegating toCrypto_SerializationUtils.deserialize(byte[]).- Parameters:
data- the bytes produced bytoByteArray()- Returns:
- the reconstructed
Crypto_HmacPair - Throws:
IOException- if an I/O error occurs during deserializationClassNotFoundException- if the class of the serialized object cannot be found
-
toString
Returns a string representation of the Crypto_HmacPair.
-