Class ConfidentialityAlgorithm
java.lang.Object
org.metricshub.ipmi.core.coding.security.ConfidentialityAlgorithm
- Direct Known Subclasses:
ConfidentialityAesCbc128,ConfidentialityNone
Interface for Confidentiality Algorithms. All classes extending this one must
implement constructor(byte[]).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract byte[]decrypt(byte[] data) Decrypts the data.abstract byte[]encrypt(byte[] data) Encrypts the data.abstract bytegetCode()Returns the algorithm's ID.abstract intgetConfidentialityOverheadSize(int payloadSize) Calculates size of the confidentiality header and trailer specific for the algorithm.voidinitialize(byte[] sik, AuthenticationAlgorithm authenticationAlgorithm) Initializes Confidentiality Algorithm
-
Constructor Details
-
ConfidentialityAlgorithm
public ConfidentialityAlgorithm()
-
-
Method Details
-
initialize
public void initialize(byte[] sik, AuthenticationAlgorithm authenticationAlgorithm) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException Initializes Confidentiality Algorithm- Parameters:
sik- - Session Integrity Key calculated during the opening of the session or user password if 'one-key' logins are enabled.authenticationAlgorithm- - Algorithm used for authentication.- Throws:
InvalidKeyException- - when initiation of the algorithm failsNoSuchAlgorithmException- - when initiation of the algorithm failsNoSuchPaddingException- - when initiation of the algorithm fails
-
getCode
public abstract byte getCode()Returns the algorithm's ID. -
encrypt
Encrypts the data.- Parameters:
data- - payload to be encrypted- Returns:
- encrypted data encapsulated in COnfidentiality Header and Trailer.
- Throws:
InvalidKeyException- - when initiation of the algorithm fails
-
decrypt
public abstract byte[] decrypt(byte[] data) Decrypts the data.- Parameters:
data- - encrypted data encapsulated in COnfidentiality Header and Trailer.- Returns:
- decrypted data.
- Throws:
IllegalArgumentException- - when initiation of the algorithm fails
-
getConfidentialityOverheadSize
public abstract int getConfidentialityOverheadSize(int payloadSize) Calculates size of the confidentiality header and trailer specific for the algorithm.- Parameters:
payloadSize- - size of the data that will be encrypted
-