// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.jcajce.provider.symmetric;

import org.bouncycastle.crypto.engines.TnepresEngine;
import org.bouncycastle.crypto.macs.GMac;
import org.bouncycastle.crypto.modes.GCMBlockCipher;
import org.bouncycastle.crypto.generators.Poly1305KeyGenerator;
import org.bouncycastle.crypto.Mac;
import org.bouncycastle.crypto.macs.Poly1305;
import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac;
import org.bouncycastle.crypto.modes.OFBBlockCipher;
import org.bouncycastle.internal.asn1.gnu.GNUObjectIdentifiers;
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
import org.bouncycastle.crypto.CipherKeyGenerator;
import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
import org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider;
import org.bouncycastle.crypto.BufferedBlockCipher;
import org.bouncycastle.crypto.modes.CFBBlockCipher;
import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.engines.SerpentEngine;
import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher;
import org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters;

public final class Serpent
{
    private Serpent() {
    }
    
    public static class AlgParams extends IvAlgorithmParameters
    {
        @Override
        protected String engineToString() {
            return "Serpent IV";
        }
    }
    
    public static class CBC extends BaseBlockCipher
    {
        public CBC() {
            super(new CBCBlockCipher(new SerpentEngine()), 128);
        }
    }
    
    public static class CBC128 extends BaseBlockCipher
    {
        public CBC128() {
            super(128, new CBCBlockCipher(new SerpentEngine()), 128);
        }
    }
    
    public static class CBC192 extends BaseBlockCipher
    {
        public CBC192() {
            super(192, new CBCBlockCipher(new SerpentEngine()), 128);
        }
    }
    
    public static class CBC256 extends BaseBlockCipher
    {
        public CBC256() {
            super(256, new CBCBlockCipher(new SerpentEngine()), 128);
        }
    }
    
    public static class CFB extends BaseBlockCipher
    {
        public CFB() {
            super(new BufferedBlockCipher(new CFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class CFB128 extends BaseBlockCipher
    {
        public CFB128() {
            super(128, new BufferedBlockCipher(new CFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class CFB192 extends BaseBlockCipher
    {
        public CFB192() {
            super(192, new BufferedBlockCipher(new CFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class CFB256 extends BaseBlockCipher
    {
        public CFB256() {
            super(256, new BufferedBlockCipher(new CFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class ECB extends BaseBlockCipher
    {
        public ECB() {
            super(new BlockCipherProvider() {
                @Override
                public BlockCipher get() {
                    return new SerpentEngine();
                }
            });
        }
    }
    
    public static class ECB128 extends BaseBlockCipher
    {
        public ECB128() {
            super(128, new BlockCipherProvider() {
                @Override
                public BlockCipher get() {
                    return new SerpentEngine();
                }
            });
        }
    }
    
    public static class ECB192 extends BaseBlockCipher
    {
        public ECB192() {
            super(192, new BlockCipherProvider() {
                @Override
                public BlockCipher get() {
                    return new SerpentEngine();
                }
            });
        }
    }
    
    public static class ECB256 extends BaseBlockCipher
    {
        public ECB256() {
            super(256, new BlockCipherProvider() {
                @Override
                public BlockCipher get() {
                    return new SerpentEngine();
                }
            });
        }
    }
    
    public static class KeyGen extends BaseKeyGenerator
    {
        public KeyGen() {
            super("Serpent", 192, new CipherKeyGenerator());
        }
    }
    
    public static class Mappings extends SymmetricAlgorithmProvider
    {
        private static final String PREFIX;
        
        @Override
        public void configure(final ConfigurableProvider configurableProvider) {
            configurableProvider.addAlgorithm("Cipher.Serpent", Mappings.PREFIX + "$ECB");
            configurableProvider.addAlgorithm("KeyGenerator.Serpent", Mappings.PREFIX + "$KeyGen");
            configurableProvider.addAlgorithm("AlgorithmParameters.Serpent", Mappings.PREFIX + "$AlgParams");
            configurableProvider.addAlgorithm("Cipher.Tnepres", Mappings.PREFIX + "$TECB");
            configurableProvider.addAlgorithm("KeyGenerator.Tnepres", Mappings.PREFIX + "$TKeyGen");
            configurableProvider.addAlgorithm("AlgorithmParameters.Tnepres", Mappings.PREFIX + "$TAlgParams");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_ECB, Mappings.PREFIX + "$ECB128");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_ECB, Mappings.PREFIX + "$ECB192");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_ECB, Mappings.PREFIX + "$ECB256");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_CBC, Mappings.PREFIX + "$CBC128");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_CBC, Mappings.PREFIX + "$CBC192");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_CBC, Mappings.PREFIX + "$CBC256");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_CFB, Mappings.PREFIX + "$CFB128");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_CFB, Mappings.PREFIX + "$CFB192");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_CFB, Mappings.PREFIX + "$CFB256");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_OFB, Mappings.PREFIX + "$OFB128");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_OFB, Mappings.PREFIX + "$OFB192");
            configurableProvider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_OFB, Mappings.PREFIX + "$OFB256");
            this.addGMacAlgorithm(configurableProvider, "SERPENT", Mappings.PREFIX + "$SerpentGMAC", Mappings.PREFIX + "$KeyGen");
            this.addGMacAlgorithm(configurableProvider, "TNEPRES", Mappings.PREFIX + "$TSerpentGMAC", Mappings.PREFIX + "$TKeyGen");
            this.addPoly1305Algorithm(configurableProvider, "SERPENT", Mappings.PREFIX + "$Poly1305", Mappings.PREFIX + "$Poly1305KeyGen");
        }
        
        static {
            PREFIX = Serpent.class.getName();
        }
    }
    
    public static class OFB extends BaseBlockCipher
    {
        public OFB() {
            super(new BufferedBlockCipher(new OFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class OFB128 extends BaseBlockCipher
    {
        public OFB128() {
            super(128, new BufferedBlockCipher(new OFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class OFB192 extends BaseBlockCipher
    {
        public OFB192() {
            super(192, new BufferedBlockCipher(new OFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class OFB256 extends BaseBlockCipher
    {
        public OFB256() {
            super(256, new BufferedBlockCipher(new OFBBlockCipher(new SerpentEngine(), 128)), 128);
        }
    }
    
    public static class Poly1305 extends BaseMac
    {
        public Poly1305() {
            super(new org.bouncycastle.crypto.macs.Poly1305(new SerpentEngine()));
        }
    }
    
    public static class Poly1305KeyGen extends BaseKeyGenerator
    {
        public Poly1305KeyGen() {
            super("Poly1305-Serpent", 256, new Poly1305KeyGenerator());
        }
    }
    
    public static class SerpentGMAC extends BaseMac
    {
        public SerpentGMAC() {
            super(new GMac(GCMBlockCipher.newInstance(new SerpentEngine())));
        }
    }
    
    public static class TAlgParams extends IvAlgorithmParameters
    {
        @Override
        protected String engineToString() {
            return "Tnepres IV";
        }
    }
    
    public static class TECB extends BaseBlockCipher
    {
        public TECB() {
            super(new BlockCipherProvider() {
                @Override
                public BlockCipher get() {
                    return new TnepresEngine();
                }
            });
        }
    }
    
    public static class TKeyGen extends BaseKeyGenerator
    {
        public TKeyGen() {
            super("Tnepres", 192, new CipherKeyGenerator());
        }
    }
    
    public static class TSerpentGMAC extends BaseMac
    {
        public TSerpentGMAC() {
            super(new GMac(GCMBlockCipher.newInstance(new TnepresEngine())));
        }
    }
}
