
org.spongycastle.jcajce.provider.symmetric.Serpent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prov Show documentation
Show all versions of prov Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
package org.spongycastle.jcajce.provider.symmetric;
import org.spongycastle.crypto.BlockCipher;
import org.spongycastle.crypto.CipherKeyGenerator;
import org.spongycastle.crypto.engines.SerpentEngine;
import org.spongycastle.crypto.engines.TwofishEngine;
import org.spongycastle.crypto.generators.Poly1305KeyGenerator;
import org.spongycastle.crypto.macs.GMac;
import org.spongycastle.crypto.modes.GCMBlockCipher;
import org.spongycastle.jcajce.provider.config.ConfigurableProvider;
import org.spongycastle.jcajce.provider.symmetric.util.BaseBlockCipher;
import org.spongycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
import org.spongycastle.jcajce.provider.symmetric.util.BaseMac;
import org.spongycastle.jcajce.provider.symmetric.util.BlockCipherProvider;
import org.spongycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters;
public final class Serpent
{
private Serpent()
{
}
public static class ECB
extends BaseBlockCipher
{
public ECB()
{
super(new BlockCipherProvider()
{
public BlockCipher get()
{
return new SerpentEngine();
}
});
}
}
public static class KeyGen
extends BaseKeyGenerator
{
public KeyGen()
{
super("Serpent", 192, new CipherKeyGenerator());
}
}
public static class SerpentGMAC
extends BaseMac
{
public SerpentGMAC()
{
super(new GMac(new GCMBlockCipher(new SerpentEngine())));
}
}
public static class Poly1305
extends BaseMac
{
public Poly1305()
{
super(new org.spongycastle.crypto.macs.Poly1305(new TwofishEngine()));
}
}
public static class Poly1305KeyGen
extends BaseKeyGenerator
{
public Poly1305KeyGen()
{
super("Poly1305-Serpent", 256, new Poly1305KeyGenerator());
}
}
public static class AlgParams
extends IvAlgorithmParameters
{
protected String engineToString()
{
return "Serpent IV";
}
}
public static class Mappings
extends SymmetricAlgorithmProvider
{
private static final String PREFIX = Serpent.class.getName();
public Mappings()
{
}
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("Cipher.Serpent", PREFIX + "$ECB");
provider.addAlgorithm("KeyGenerator.Serpent", PREFIX + "$KeyGen");
provider.addAlgorithm("AlgorithmParameters.Serpent", PREFIX + "$AlgParams");
addGMacAlgorithm(provider, "SERPENT", PREFIX + "$SerpentGMAC", PREFIX + "$KeyGen");
addPoly1305Algorithm(provider, "SERPENT", PREFIX + "$Poly1305", PREFIX + "$Poly1305KeyGen");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy