Class IntegrityAlgorithm
java.lang.Object
org.metricshub.ipmi.core.coding.security.IntegrityAlgorithm
- Direct Known Subclasses:
IntegrityHmacMd5_128,IntegrityHmacSha1_96,IntegrityHmacSha256_128,IntegrityMd5_128,IntegrityNone
Interface for Integrity Algorithms. All classes extending this one must
implement constructor(byte[]).
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]generateAuthCode(byte[] base) Creates AuthCode field for message.abstract StringReturns the name of the algorithm.abstract intReturns the length of the authentication codeabstract bytegetCode()Returns the algorithm's ID.voidinitialize(byte[] key) Initializes Integrity AlgorithmvoidwipeKey()Wipes the key passed toinitialize(byte[])(the password for MD5-128 integrity) once the session is over, and keys the MAC with the wiped key: the codes the algorithm generates no longer match the session.
-
Method Details
-
initialize
Initializes Integrity Algorithm- Parameters:
key- - Session Integrity Key calculated during the opening of the session or user password if 'one-key' logins are enabled.- Throws:
InvalidKeyException
-
wipeKey
public void wipeKey()Wipes the key passed toinitialize(byte[])(the password for MD5-128 integrity) once the session is over, and keys the MAC with the wiped key: the codes the algorithm generates no longer match the session. -
getCode
public abstract byte getCode()Returns the algorithm's ID. -
generateAuthCode
public byte[] generateAuthCode(byte[] base) Creates AuthCode field for message. Synchronized: the sending, receiving and keep-alive threads share this instance and itsMac.- Parameters:
base- - data starting with the AuthType/Format field up to and including the field that immediately precedes the AuthCode field- Returns:
- AuthCode field. Might be null if empty AuthCOde field is generated.
- See Also:
-
getAlgorithmName
Returns the name of the algorithm.- Returns:
- The algorithm name as a
String.
-
getAuthCodeLength
public abstract int getAuthCodeLength()Returns the length of the authentication code- Returns:
- The length of the authentication code in bytes.
-