/android/upstream/org/bouncycastle/jce/provider/symmetric/Blowfish.java
Java | 69 lines | 58 code | 8 blank | 3 comment | 0 complexity | a7cc672d2b4e47e0bc122ae2454c5864 MD5 | raw file
- package org.bouncycastle.jce.provider.symmetric;
- import java.util.HashMap;
- import org.bouncycastle.crypto.CipherKeyGenerator;
- import org.bouncycastle.crypto.engines.BlowfishEngine;
- import org.bouncycastle.crypto.modes.CBCBlockCipher;
- import org.bouncycastle.jce.provider.JCEBlockCipher;
- import org.bouncycastle.jce.provider.JCEKeyGenerator;
- import org.bouncycastle.jce.provider.JDKAlgorithmParameters;
- public final class Blowfish
- {
- private Blowfish()
- {
- }
-
- public static class ECB
- extends JCEBlockCipher
- {
- public ECB()
- {
- super(new BlowfishEngine());
- }
- }
- public static class CBC
- extends JCEBlockCipher
- {
- public CBC()
- {
- super(new CBCBlockCipher(new BlowfishEngine()), 64);
- }
- }
- public static class KeyGen
- extends JCEKeyGenerator
- {
- public KeyGen()
- {
- super("Blowfish", 128, new CipherKeyGenerator());
- }
- }
- public static class AlgParams
- extends JDKAlgorithmParameters.IVAlgorithmParameters
- {
- protected String engineToString()
- {
- return "Blowfish IV";
- }
- }
- public static class Mappings
- extends HashMap
- {
- public Mappings()
- {
- put("Cipher.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$ECB");
- // BEGIN android-removed
- // put("Cipher.1.3.6.1.4.1.3029.1.2", "org.bouncycastle.jce.provider.symmetric.Blowfish$CBC");
- // END android-removed
- put("KeyGenerator.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$KeyGen");
- put("Alg.Alias.KeyGenerator.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
- put("AlgorithmParameters.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$AlgParams");
- put("Alg.Alias.AlgorithmParameters.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
- }
- }
- }