/src/org/spongycastle/jce/provider/symmetric/Blowfish.java
https://github.com/senecaso/spongycastle · Java · 67 lines · 59 code · 8 blank · 0 comment · 0 complexity · 3f6c4ab7c47cb0434c8ca8741dc97dda MD5 · raw file
- package org.spongycastle.jce.provider.symmetric;
- import java.util.HashMap;
- import org.spongycastle.crypto.CipherKeyGenerator;
- import org.spongycastle.crypto.engines.BlowfishEngine;
- import org.spongycastle.crypto.modes.CBCBlockCipher;
- import org.spongycastle.jce.provider.JCEBlockCipher;
- import org.spongycastle.jce.provider.JCEKeyGenerator;
- import org.spongycastle.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.spongycastle.jce.provider.symmetric.Blowfish$ECB");
- put("Cipher.1.3.6.1.4.1.3029.1.2", "org.spongycastle.jce.provider.symmetric.Blowfish$CBC");
- put("KeyGenerator.BLOWFISH", "org.spongycastle.jce.provider.symmetric.Blowfish$KeyGen");
- put("Alg.Alias.KeyGenerator.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
- put("AlgorithmParameters.BLOWFISH", "org.spongycastle.jce.provider.symmetric.Blowfish$AlgParams");
- put("Alg.Alias.AlgorithmParameters.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
- }
- }
- }