IMacSetup interface
Contents
- Introduction to the Library
- Basic support package (com.kryptel.bslx)
- Kryptel API Commons package (com.kryptel)
- Cipher package (com.kryptel.cipher)
- Compressor package (com.kryptel.compressor)
- Exceptions package (com.kryptel.exceptions)
- Hash function package (com.kryptel.hash_function)
- MAC function package (com.kryptel.mac)
- IMacSetup interface
- Example: Computing string HMAC
- Key-related functions (com.kryptel.key)
- Silver Key engine (com.kryptel.silver_key)
- Kryptel encrypted storage (com.kryptel.storage)
Declaration
package com.kryptel.mac; public interface IMacSetup { void SetBase(UUID cid) throws Exception; void SetBase(IKryptelComponent comp) throws Exception; void SetKey(byte[] key, int start, int size) throws Exception; }
Description
This interface sets HMAC key and HMAC's base hash function.
SetBase
void SetBase(UUID cid) throws Exception; void SetBase(IKryptelComponent comp) throws Exception;
Sets the base hash function that will be used for HMAC computation. The first form creates the hash function by the provided Component ID and uses it with default parameters. If you need to use the hash function with some specific parameters, instantiate it, set the desired parameters using IHashFunctionParams interface, and pass the function's IKryptelComponent.
Note that the hash function component passed to the second SetBase form is not used or discarded on cleanup. HMAC calls the hash function's IComponentState.Clone and uses the copy of the component.
SetKey
void SetKey(byte[] key, int start, int size) throws Exception;
Sets HMAC binary key. If size is not equal to the base hash function's block size, the key is normalized – either truncated or padded with zero bytes.