PageRenderTime 114ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/android/upstream/org/bouncycastle/jce/provider/symmetric/Blowfish.java

https://bitbucket.org/festevezga/xobotos
Java | 69 lines | 58 code | 8 blank | 3 comment | 0 complexity | a7cc672d2b4e47e0bc122ae2454c5864 MD5 | raw file
  1. package org.bouncycastle.jce.provider.symmetric;
  2. import java.util.HashMap;
  3. import org.bouncycastle.crypto.CipherKeyGenerator;
  4. import org.bouncycastle.crypto.engines.BlowfishEngine;
  5. import org.bouncycastle.crypto.modes.CBCBlockCipher;
  6. import org.bouncycastle.jce.provider.JCEBlockCipher;
  7. import org.bouncycastle.jce.provider.JCEKeyGenerator;
  8. import org.bouncycastle.jce.provider.JDKAlgorithmParameters;
  9. public final class Blowfish
  10. {
  11. private Blowfish()
  12. {
  13. }
  14. public static class ECB
  15. extends JCEBlockCipher
  16. {
  17. public ECB()
  18. {
  19. super(new BlowfishEngine());
  20. }
  21. }
  22. public static class CBC
  23. extends JCEBlockCipher
  24. {
  25. public CBC()
  26. {
  27. super(new CBCBlockCipher(new BlowfishEngine()), 64);
  28. }
  29. }
  30. public static class KeyGen
  31. extends JCEKeyGenerator
  32. {
  33. public KeyGen()
  34. {
  35. super("Blowfish", 128, new CipherKeyGenerator());
  36. }
  37. }
  38. public static class AlgParams
  39. extends JDKAlgorithmParameters.IVAlgorithmParameters
  40. {
  41. protected String engineToString()
  42. {
  43. return "Blowfish IV";
  44. }
  45. }
  46. public static class Mappings
  47. extends HashMap
  48. {
  49. public Mappings()
  50. {
  51. put("Cipher.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$ECB");
  52. // BEGIN android-removed
  53. // put("Cipher.1.3.6.1.4.1.3029.1.2", "org.bouncycastle.jce.provider.symmetric.Blowfish$CBC");
  54. // END android-removed
  55. put("KeyGenerator.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$KeyGen");
  56. put("Alg.Alias.KeyGenerator.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
  57. put("AlgorithmParameters.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$AlgParams");
  58. put("Alg.Alias.AlgorithmParameters.1.3.6.1.4.1.3029.1.2", "BLOWFISH");
  59. }
  60. }
  61. }