org.bouncycastle.crypto.internal.util.ISOTrailers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips Show documentation
Show all versions of bc-fips Show documentation
The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.
package org.bouncycastle.crypto.internal.util;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.crypto.internal.Digest;
import org.bouncycastle.util.Integers;
public class ISOTrailers
{
private static final Map trailerMap;
static final public int TRAILER_RIPEMD160 = 0x31CC;
static final public int TRAILER_RIPEMD128 = 0x32CC;
static final public int TRAILER_SHA1 = 0x33CC;
static final public int TRAILER_SHA256 = 0x34CC;
static final public int TRAILER_SHA512 = 0x35CC;
static final public int TRAILER_SHA384 = 0x36CC;
static final public int TRAILER_WHIRLPOOL = 0x37CC;
static final public int TRAILER_SHA224 = 0x38CC;
static final public int TRAILER_SHA512_224 = 0x39CC;
static final public int TRAILER_SHA512_256 = 0x3aCC;
static
{
Map trailers = new HashMap();
trailers.put("RIPEMD128", Integers.valueOf(TRAILER_RIPEMD128));
trailers.put("RIPEMD160", Integers.valueOf(TRAILER_RIPEMD160));
trailers.put("SHA-1", Integers.valueOf(TRAILER_SHA1));
trailers.put("SHA-224", Integers.valueOf(TRAILER_SHA224));
trailers.put("SHA-256", Integers.valueOf(TRAILER_SHA256));
trailers.put("SHA-384", Integers.valueOf(TRAILER_SHA384));
trailers.put("SHA-512", Integers.valueOf(TRAILER_SHA512));
trailers.put("SHA-512/224", Integers.valueOf(TRAILER_SHA512_224));
trailers.put("SHA-512/256", Integers.valueOf(TRAILER_SHA512_256));
trailers.put("WHIRLPOOL", Integers.valueOf(TRAILER_WHIRLPOOL));
trailerMap = Collections.unmodifiableMap(trailers);
}
public static Integer getTrailer(Digest digest)
{
return trailerMap.get(digest.getAlgorithmName());
}
public static boolean noTrailerAvailable(Digest digest)
{
return !trailerMap.containsKey(digest.getAlgorithmName());
}
}