![JAR search and dependency download from the Maven repository](/logo.png)
org.bouncycastle.crypto.fips.FipsMACOperatorFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips-debug Show documentation
Show all versions of bc-fips-debug Show documentation
The FIPS 140-2 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-2 level 1. This jar contains the debug version JCE provider and low-level API for the BC-FJA version 1.0.2.3, FIPS Certificate #3514. Please note the debug jar is not certified.
package org.bouncycastle.crypto.fips;
import org.bouncycastle.crypto.AuthenticationParameters;
import org.bouncycastle.crypto.MACOperatorFactory;
import org.bouncycastle.crypto.SymmetricKey;
import org.bouncycastle.crypto.internal.Mac;
import org.bouncycastle.crypto.internal.io.MacOutputStream;
/**
* Base class for the approved mode MACOperatorFactory implementations.
*
* @param the parameters type associated with the final implementation of this factory.
*/
public abstract class FipsMACOperatorFactory
implements MACOperatorFactory
{
// package protect constructor
FipsMACOperatorFactory()
{
FipsStatus.isReady();
}
public final FipsOutputMACCalculator createOutputMACCalculator(SymmetricKey key, final T parameters)
{
final Mac mac = createMAC(key, parameters);
return new FipsOutputMACCalculator()
{
public T getParameters()
{
return parameters;
}
public int getMACSize()
{
return mac.getMacSize();
}
public org.bouncycastle.crypto.UpdateOutputStream getMACStream()
{
return new MacOutputStream(mac);
}
public int getMAC(byte[] output, int off)
{
return mac.doFinal(output, off);
}
public void reset()
{
mac.reset();
}
};
}
protected abstract int calculateMACSize(T parameters);
protected abstract Mac createMAC(SymmetricKey key, T parameters);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy