PageRenderTime 56ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/gcc/libjava/classpath/gnu/javax/crypto/jce/GnuCrypto.java

https://github.com/atgreen/moxiedev
Java | 598 lines | 489 code | 39 blank | 70 comment | 0 complexity | 6d0e85de4e8317f0a9defd057ee42599 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, BSD-3-Clause-No-Nuclear-License-2014, BSD-3-Clause, GPL-3.0, LGPL-2.0, CC-BY-SA-3.0
  1. /* GnuCrypto.java --
  2. Copyright (C) 2004, 2006 Free Software Foundation, Inc.
  3. This file is a part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or (at
  7. your option) any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  15. USA
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package gnu.javax.crypto.jce;
  32. import gnu.java.security.Registry;
  33. import gnu.javax.crypto.cipher.CipherFactory;
  34. import gnu.javax.crypto.mac.MacFactory;
  35. import java.security.AccessController;
  36. import java.security.PrivilegedAction;
  37. import java.security.Provider;
  38. import java.util.HashSet;
  39. import java.util.Set;
  40. /**
  41. * The additional GNU algorithm implementation as a Java Cryptographic Extension
  42. * (JCE) Provider.
  43. *
  44. * @see java.security.Provider
  45. */
  46. public final class GnuCrypto
  47. extends Provider
  48. {
  49. public GnuCrypto()
  50. {
  51. super(Registry.GNU_CRYPTO, 2.1, "GNU Crypto JCE Provider");
  52. AccessController.doPrivileged(new PrivilegedAction()
  53. {
  54. public Object run()
  55. {
  56. // Cipher
  57. put("Cipher.ANUBIS",
  58. gnu.javax.crypto.jce.cipher.AnubisSpi.class.getName());
  59. put("Cipher.ANUBIS ImplementedIn", "Software");
  60. put("Cipher.ARCFOUR",
  61. gnu.javax.crypto.jce.cipher.ARCFourSpi.class.getName());
  62. put("Cipher.ARCFOUR ImplementedIn", "Software");
  63. put("Cipher.BLOWFISH",
  64. gnu.javax.crypto.jce.cipher.BlowfishSpi.class.getName());
  65. put("Cipher.BLOWFISH ImplementedIn", "Software");
  66. put("Cipher.DES", gnu.javax.crypto.jce.cipher.DESSpi.class.getName());
  67. put("Cipher.DES ImplementedIn", "Software");
  68. put("Cipher.KHAZAD",
  69. gnu.javax.crypto.jce.cipher.KhazadSpi.class.getName());
  70. put("Cipher.KHAZAD ImplementedIn", "Software");
  71. put("Cipher.NULL",
  72. gnu.javax.crypto.jce.cipher.NullCipherSpi.class.getName());
  73. put("Cipher.NULL ImplementedIn", "Software");
  74. put("Cipher.AES",
  75. gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
  76. put("Cipher.AES ImplementedIn", "Software");
  77. put("Cipher.RIJNDAEL",
  78. gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
  79. put("Cipher.RIJNDAEL ImplementedIn", "Software");
  80. put("Cipher.SERPENT",
  81. gnu.javax.crypto.jce.cipher.SerpentSpi.class.getName());
  82. put("Cipher.SERPENT ImplementedIn", "Software");
  83. put("Cipher.SQUARE",
  84. gnu.javax.crypto.jce.cipher.SquareSpi.class.getName());
  85. put("Cipher.SQUARE ImplementedIn", "Software");
  86. put("Cipher.TRIPLEDES",
  87. gnu.javax.crypto.jce.cipher.TripleDESSpi.class.getName());
  88. put("Cipher.TRIPLEDES ImplementedIn", "Software");
  89. put("Cipher.TWOFISH",
  90. gnu.javax.crypto.jce.cipher.TwofishSpi.class.getName());
  91. put("Cipher.TWOFISH ImplementedIn", "Software");
  92. put("Cipher.CAST5",
  93. gnu.javax.crypto.jce.cipher.Cast5Spi.class.getName());
  94. put("Cipher.CAST5 ImplementedIn", "Software");
  95. // PBES2 ciphers.
  96. put("Cipher.PBEWithHMacHavalAndAES",
  97. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.AES.class.getName());
  98. put("Cipher.PBEWithHMacHavalAndAnubis",
  99. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Anubis.class.getName());
  100. put("Cipher.PBEWithHMacHavalAndBlowfish",
  101. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Blowfish.class.getName());
  102. put("Cipher.PBEWithHMacHavalAndCast5",
  103. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Cast5.class.getName());
  104. put("Cipher.PBEWithHMacHavalAndDES",
  105. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.DES.class.getName());
  106. put("Cipher.PBEWithHMacHavalAndKhazad",
  107. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Khazad.class.getName());
  108. put("Cipher.PBEWithHMacHavalAndSerpent",
  109. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Serpent.class.getName());
  110. put("Cipher.PBEWithHMacHavalAndSquare",
  111. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Square.class.getName());
  112. put("Cipher.PBEWithHMacHavalAndTripleDES",
  113. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.TripleDES.class.getName());
  114. put("Cipher.PBEWithHMacHavalAndTwofish",
  115. gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Twofish.class.getName());
  116. put("Cipher.PBEWithHMacMD2AndAES",
  117. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.AES.class.getName());
  118. put("Cipher.PBEWithHMacMD2AndAnubis",
  119. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Anubis.class.getName());
  120. put("Cipher.PBEWithHMacMD2AndBlowfish",
  121. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Blowfish.class.getName());
  122. put("Cipher.PBEWithHMacMD2AndCast5",
  123. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Cast5.class.getName());
  124. put("Cipher.PBEWithHMacMD2AndDES",
  125. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.DES.class.getName());
  126. put("Cipher.PBEWithHMacMD2AndKhazad",
  127. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Khazad.class.getName());
  128. put("Cipher.PBEWithHMacMD2AndSerpent",
  129. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Serpent.class.getName());
  130. put("Cipher.PBEWithHMacMD2AndSquare",
  131. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Square.class.getName());
  132. put("Cipher.PBEWithHMacMD2AndTripleDES",
  133. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.TripleDES.class.getName());
  134. put("Cipher.PBEWithHMacMD2AndTwofish",
  135. gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Twofish.class.getName());
  136. put("Cipher.PBEWithHMacMD4AndAES",
  137. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.AES.class.getName());
  138. put("Cipher.PBEWithHMacMD4AndAnubis",
  139. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Anubis.class.getName());
  140. put("Cipher.PBEWithHMacMD4AndBlowfish",
  141. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Blowfish.class.getName());
  142. put("Cipher.PBEWithHMacMD4AndCast5",
  143. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Cast5.class.getName());
  144. put("Cipher.PBEWithHMacMD4AndDES",
  145. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.DES.class.getName());
  146. put("Cipher.PBEWithHMacMD4AndKhazad",
  147. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Khazad.class.getName());
  148. put("Cipher.PBEWithHMacMD4AndSerpent",
  149. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Serpent.class.getName());
  150. put("Cipher.PBEWithHMacMD4AndSquare",
  151. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Square.class.getName());
  152. put("Cipher.PBEWithHMacMD4AndTripleDES",
  153. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.TripleDES.class.getName());
  154. put("Cipher.PBEWithHMacMD4AndTwofish",
  155. gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Twofish.class.getName());
  156. put("Cipher.PBEWithHMacMD5AndAES",
  157. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.AES.class.getName());
  158. put("Cipher.PBEWithHMacMD5AndAnubis",
  159. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Anubis.class.getName());
  160. put("Cipher.PBEWithHMacMD5AndBlowfish",
  161. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Blowfish.class.getName());
  162. put("Cipher.PBEWithHMacMD5AndCast5",
  163. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Cast5.class.getName());
  164. put("Cipher.PBEWithHMacMD5AndDES",
  165. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.DES.class.getName());
  166. put("Cipher.PBEWithHMacMD5AndKhazad",
  167. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Khazad.class.getName());
  168. put("Cipher.PBEWithHMacMD5AndSerpent",
  169. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Serpent.class.getName());
  170. put("Cipher.PBEWithHMacMD5AndSquare",
  171. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Square.class.getName());
  172. put("Cipher.PBEWithHMacMD5AndTripleDES",
  173. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.TripleDES.class.getName());
  174. put("Cipher.PBEWithHMacMD5AndTwofish",
  175. gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Twofish.class.getName());
  176. put("Cipher.PBEWithHMacSHA1AndAES",
  177. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.AES.class.getName());
  178. put("Cipher.PBEWithHMacSHA1AndAnubis",
  179. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Anubis.class.getName());
  180. put("Cipher.PBEWithHMacSHA1AndBlowfish",
  181. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Blowfish.class.getName());
  182. put("Cipher.PBEWithHMacSHA1AndCast5",
  183. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Cast5.class.getName());
  184. put("Cipher.PBEWithHMacSHA1AndDES",
  185. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.DES.class.getName());
  186. put("Cipher.PBEWithHMacSHA1AndKhazad",
  187. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Khazad.class.getName());
  188. put("Cipher.PBEWithHMacSHA1AndSerpent",
  189. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Serpent.class.getName());
  190. put("Cipher.PBEWithHMacSHA1AndSquare",
  191. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Square.class.getName());
  192. put(
  193. "Cipher.PBEWithHMacSHA1AndTripleDES",
  194. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.TripleDES.class.getName());
  195. put("Cipher.PBEWithHMacSHA1AndTwofish",
  196. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Twofish.class.getName());
  197. put("Cipher.PBEWithHMacSHA256AndAES",
  198. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.AES.class.getName());
  199. put("Cipher.PBEWithHMacSHA256AndAnubis",
  200. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Anubis.class.getName());
  201. put("Cipher.PBEWithHMacSHA256AndBlowfish",
  202. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Blowfish.class.getName());
  203. put("Cipher.PBEWithHMacSHA256AndCast5",
  204. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Cast5.class.getName());
  205. put("Cipher.PBEWithHMacSHA256AndDES",
  206. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.DES.class.getName());
  207. put("Cipher.PBEWithHMacSHA256AndKhazad",
  208. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Khazad.class.getName());
  209. put("Cipher.PBEWithHMacSHA256AndSerpent",
  210. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Serpent.class.getName());
  211. put("Cipher.PBEWithHMacSHA256AndSquare",
  212. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Square.class.getName());
  213. put("Cipher.PBEWithHMacSHA256AndTripleDES",
  214. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.TripleDES.class.getName());
  215. put("Cipher.PBEWithHMacSHA256AndTwofish",
  216. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Twofish.class.getName());
  217. put("Cipher.PBEWithHMacSHA384AndAES",
  218. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.AES.class.getName());
  219. put("Cipher.PBEWithHMacSHA384AndAnubis",
  220. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Anubis.class.getName());
  221. put("Cipher.PBEWithHMacSHA384AndBlowfish",
  222. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Blowfish.class.getName());
  223. put("Cipher.PBEWithHMacSHA384AndCast5",
  224. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Cast5.class.getName());
  225. put("Cipher.PBEWithHMacSHA384AndDES",
  226. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.DES.class.getName());
  227. put("Cipher.PBEWithHMacSHA384AndKhazad",
  228. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Khazad.class.getName());
  229. put("Cipher.PBEWithHMacSHA384AndSerpent",
  230. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Serpent.class.getName());
  231. put("Cipher.PBEWithHMacSHA384AndSquare",
  232. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Square.class.getName());
  233. put("Cipher.PBEWithHMacSHA384AndTripleDES",
  234. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.TripleDES.class.getName());
  235. put("Cipher.PBEWithHMacSHA384AndTwofish",
  236. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Twofish.class.getName());
  237. put("Cipher.PBEWithHMacSHA512AndAES",
  238. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.AES.class.getName());
  239. put("Cipher.PBEWithHMacSHA512AndAnubis",
  240. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Anubis.class.getName());
  241. put("Cipher.PBEWithHMacSHA512AndBlowfish",
  242. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Blowfish.class.getName());
  243. put("Cipher.PBEWithHMacSHA512AndCast5",
  244. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Cast5.class.getName());
  245. put("Cipher.PBEWithHMacSHA512AndDES",
  246. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.DES.class.getName());
  247. put("Cipher.PBEWithHMacSHA512AndKhazad",
  248. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Khazad.class.getName());
  249. put("Cipher.PBEWithHMacSHA512AndSerpent",
  250. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Serpent.class.getName());
  251. put("Cipher.PBEWithHMacSHA512AndSquare",
  252. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Square.class.getName());
  253. put("Cipher.PBEWithHMacSHA512AndTripleDES",
  254. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.TripleDES.class.getName());
  255. put("Cipher.PBEWithHMacSHA512AndTwofish",
  256. gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Twofish.class.getName());
  257. put("Cipher.PBEWithHMacTigerAndAES",
  258. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.AES.class.getName());
  259. put("Cipher.PBEWithHMacTigerAndAnubis",
  260. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Anubis.class.getName());
  261. put("Cipher.PBEWithHMacTigerAndBlowfish",
  262. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Blowfish.class.getName());
  263. put("Cipher.PBEWithHMacTigerAndCast5",
  264. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Cast5.class.getName());
  265. put("Cipher.PBEWithHMacTigerAndDES",
  266. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.DES.class.getName());
  267. put("Cipher.PBEWithHMacTigerAndKhazad",
  268. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Khazad.class.getName());
  269. put("Cipher.PBEWithHMacTigerAndSerpent",
  270. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Serpent.class.getName());
  271. put("Cipher.PBEWithHMacTigerAndSquare",
  272. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Square.class.getName());
  273. put("Cipher.PBEWithHMacTigerAndTripleDES",
  274. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.TripleDES.class.getName());
  275. put("Cipher.PBEWithHMacTigerAndTwofish",
  276. gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Twofish.class.getName());
  277. put("Cipher.PBEWithHMacWhirlpoolAndAES",
  278. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.AES.class.getName());
  279. put("Cipher.PBEWithHMacWhirlpoolAndAnubis",
  280. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Anubis.class.getName());
  281. put("Cipher.PBEWithHMacWhirlpoolAndBlowfish",
  282. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Blowfish.class.getName());
  283. put("Cipher.PBEWithHMacWhirlpoolAndCast5",
  284. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Cast5.class.getName());
  285. put("Cipher.PBEWithHMacWhirlpoolAndDES",
  286. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.DES.class.getName());
  287. put("Cipher.PBEWithHMacWhirlpoolAndKhazad",
  288. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Khazad.class.getName());
  289. put("Cipher.PBEWithHMacWhirlpoolAndSerpent",
  290. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Serpent.class.getName());
  291. put("Cipher.PBEWithHMacWhirlpoolAndSquare",
  292. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Square.class.getName());
  293. put("Cipher.PBEWithHMacWhirlpoolAndTripleDES",
  294. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.TripleDES.class.getName());
  295. put("Cipher.PBEWithHMacWhirlpoolAndTwofish",
  296. gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Twofish.class.getName());
  297. // Key Wrapping Algorithm cipher
  298. put("Cipher." + Registry.AES128_KWA,
  299. gnu.javax.crypto.jce.cipher.AES128KeyWrapSpi.class.getName());
  300. put("Cipher." + Registry.AES192_KWA,
  301. gnu.javax.crypto.jce.cipher.AES192KeyWrapSpi.class.getName());
  302. put("Cipher." + Registry.AES256_KWA,
  303. gnu.javax.crypto.jce.cipher.AES256KeyWrapSpi.class.getName());
  304. put("Cipher." + Registry.TRIPLEDES_KWA,
  305. gnu.javax.crypto.jce.cipher.TripleDESKeyWrapSpi.class.getName());
  306. // SecretKeyFactory interface to PBKDF2.
  307. put("SecretKeyFactory.PBKDF2WithHMacHaval",
  308. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacHaval.class.getName());
  309. put("SecretKeyFactory.PBKDF2WithHMacMD2",
  310. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD2.class.getName());
  311. put("SecretKeyFactory.PBKDF2WithHMacMD4",
  312. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD4.class.getName());
  313. put("SecretKeyFactory.PBKDF2WithHMacMD5",
  314. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD5.class.getName());
  315. put("SecretKeyFactory.PBKDF2WithHMacSHA1",
  316. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA1.class.getName());
  317. put("SecretKeyFactory.PBKDF2WithHMacSHA256",
  318. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA256.class.getName());
  319. put("SecretKeyFactory.PBKDF2WithHMacSHA384",
  320. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA384.class.getName());
  321. put("SecretKeyFactory.PBKDF2WithHMacSHA512",
  322. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA512.class.getName());
  323. put("SecretKeyFactory.PBKDF2WithHMacTiger",
  324. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacTiger.class.getName());
  325. put("SecretKeyFactory.PBKDF2WithHMacWhirlpool",
  326. gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacWhirlpool.class.getName());
  327. // Simple SecretKeyFactory implementations.
  328. put("SecretKeyFactory.Anubis",
  329. gnu.javax.crypto.jce.key.AnubisSecretKeyFactoryImpl.class.getName());
  330. put("SecretKeyFactory.Blowfish",
  331. gnu.javax.crypto.jce.key.BlowfishSecretKeyFactoryImpl.class.getName());
  332. put("SecretKeyFactory.Cast5",
  333. gnu.javax.crypto.jce.key.Cast5SecretKeyFactoryImpl.class.getName());
  334. put("SecretKeyFactory.DES",
  335. gnu.javax.crypto.jce.key.DESSecretKeyFactoryImpl.class.getName());
  336. put("SecretKeyFactory.Khazad",
  337. gnu.javax.crypto.jce.key.KhazadSecretKeyFactoryImpl.class.getName());
  338. put("SecretKeyFactory.Rijndael",
  339. gnu.javax.crypto.jce.key.RijndaelSecretKeyFactoryImpl.class.getName());
  340. put("SecretKeyFactory.Serpent",
  341. gnu.javax.crypto.jce.key.SerpentSecretKeyFactoryImpl.class.getName());
  342. put("SecretKeyFactory.Square",
  343. gnu.javax.crypto.jce.key.SquareSecretKeyFactoryImpl.class.getName());
  344. put("SecretKeyFactory.TripleDES",
  345. gnu.javax.crypto.jce.key.DESedeSecretKeyFactoryImpl.class.getName());
  346. put("Alg.Alias.SecretKeyFactory.AES", "Rijndael");
  347. put("Alg.Alias.SecretKeyFactory.DESede", "TripleDES");
  348. put("Alg.Alias.SecretKeyFactory.3-DES", "TripleDES");
  349. put("Alg.Alias.SecretKeyFactory.3DES", "TripleDES");
  350. put("AlgorithmParameters.BlockCipherParameters",
  351. gnu.javax.crypto.jce.params.BlockCipherParameters.class.getName());
  352. put("Alg.Alias.AlgorithmParameters.Anubis", "BlockCipherParameters");
  353. put("Alg.Alias.AlgorithmParameters.Blowfish", "BlockCipherParameters");
  354. put("Alg.Alias.AlgorithmParameters.Cast5", "BlockCipherParameters");
  355. put("Alg.Alias.AlgorithmParameters.DES", "BlockCipherParameters");
  356. put("Alg.Alias.AlgorithmParameters.Khazad", "BlockCipherParameters");
  357. put("Alg.Alias.AlgorithmParameters.Rijndael", "BlockCipherParameters");
  358. put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
  359. put("Alg.Alias.AlgorithmParameters.Serpent", "BlockCipherParameters");
  360. put("Alg.Alias.AlgorithmParameters.Square", "BlockCipherParameters");
  361. put("Alg.Alias.AlgorithmParameters.TripleDES", "BlockCipherParameters");
  362. put("Alg.Alias.AlgorithmParameters.DESede", "BlockCipherParameters");
  363. put("Alg.Alias.AlgorithmParameters.3-DES", "BlockCipherParameters");
  364. put("Alg.Alias.AlgorithmParameters.3DES", "BlockCipherParameters");
  365. // KeyGenerator Adapter implementations
  366. put("KeyGenerator.Anubis",
  367. gnu.javax.crypto.jce.key.AnubisKeyGeneratorImpl.class.getName());
  368. put("KeyGenerator.Blowfish",
  369. gnu.javax.crypto.jce.key.BlowfishKeyGeneratorImpl.class.getName());
  370. put("KeyGenerator.Cast5",
  371. gnu.javax.crypto.jce.key.Cast5KeyGeneratorImpl.class.getName());
  372. put("KeyGenerator.DES",
  373. gnu.javax.crypto.jce.key.DESKeyGeneratorImpl.class.getName());
  374. put("KeyGenerator.Khazad",
  375. gnu.javax.crypto.jce.key.KhazadKeyGeneratorImpl.class.getName());
  376. put("KeyGenerator.Rijndael",
  377. gnu.javax.crypto.jce.key.RijndaelKeyGeneratorImpl.class.getName());
  378. put("KeyGenerator.Serpent",
  379. gnu.javax.crypto.jce.key.SerpentKeyGeneratorImpl.class.getName());
  380. put("KeyGenerator.Square",
  381. gnu.javax.crypto.jce.key.SquareKeyGeneratorImpl.class.getName());
  382. put("KeyGenerator.TripleDES",
  383. gnu.javax.crypto.jce.key.TripleDESKeyGeneratorImpl.class.getName());
  384. put("Alg.Alias.KeyGenerator.AES", "Rijndael");
  385. put("Alg.Alias.KeyGenerator.DESede", "TripleDES");
  386. put("Alg.Alias.KeyGenerator.3-DES", "TripleDES");
  387. put("Alg.Alias.KeyGenerator.3DES", "TripleDES");
  388. // MAC
  389. put("Mac.HMAC-MD2", gnu.javax.crypto.jce.mac.HMacMD2Spi.class.getName());
  390. put("Mac.HMAC-MD4", gnu.javax.crypto.jce.mac.HMacMD4Spi.class.getName());
  391. put("Mac.HMAC-MD5", gnu.javax.crypto.jce.mac.HMacMD5Spi.class.getName());
  392. put("Mac.HMAC-RIPEMD128",
  393. gnu.javax.crypto.jce.mac.HMacRipeMD128Spi.class.getName());
  394. put("Mac.HMAC-RIPEMD160",
  395. gnu.javax.crypto.jce.mac.HMacRipeMD160Spi.class.getName());
  396. put("Mac.HMAC-SHA160",
  397. gnu.javax.crypto.jce.mac.HMacSHA160Spi.class.getName());
  398. put("Mac.HMAC-SHA256",
  399. gnu.javax.crypto.jce.mac.HMacSHA256Spi.class.getName());
  400. put("Mac.HMAC-SHA384",
  401. gnu.javax.crypto.jce.mac.HMacSHA384Spi.class.getName());
  402. put("Mac.HMAC-SHA512",
  403. gnu.javax.crypto.jce.mac.HMacSHA512Spi.class.getName());
  404. put("Mac.HMAC-TIGER",
  405. gnu.javax.crypto.jce.mac.HMacTigerSpi.class.getName());
  406. put("Mac.HMAC-HAVAL",
  407. gnu.javax.crypto.jce.mac.HMacHavalSpi.class.getName());
  408. put("Mac.HMAC-WHIRLPOOL",
  409. gnu.javax.crypto.jce.mac.HMacWhirlpoolSpi.class.getName());
  410. put("Mac.TMMH16", gnu.javax.crypto.jce.mac.TMMH16Spi.class.getName());
  411. put("Mac.UHASH32", gnu.javax.crypto.jce.mac.UHash32Spi.class.getName());
  412. put("Mac.UMAC32", gnu.javax.crypto.jce.mac.UMac32Spi.class.getName());
  413. put("Mac.OMAC-ANUBIS",
  414. gnu.javax.crypto.jce.mac.OMacAnubisImpl.class.getName());
  415. put("Mac.OMAC-BLOWFISH",
  416. gnu.javax.crypto.jce.mac.OMacBlowfishImpl.class.getName());
  417. put("Mac.OMAC-CAST5",
  418. gnu.javax.crypto.jce.mac.OMacCast5Impl.class.getName());
  419. put("Mac.OMAC-DES",
  420. gnu.javax.crypto.jce.mac.OMacDESImpl.class.getName());
  421. put("Mac.OMAC-KHAZAD",
  422. gnu.javax.crypto.jce.mac.OMacKhazadImpl.class.getName());
  423. put("Mac.OMAC-RIJNDAEL",
  424. gnu.javax.crypto.jce.mac.OMacRijndaelImpl.class.getName());
  425. put("Mac.OMAC-SERPENT",
  426. gnu.javax.crypto.jce.mac.OMacSerpentImpl.class.getName());
  427. put("Mac.OMAC-SQUARE",
  428. gnu.javax.crypto.jce.mac.OMacSquareImpl.class.getName());
  429. put("Mac.OMAC-TRIPLEDES",
  430. gnu.javax.crypto.jce.mac.OMacTripleDESImpl.class.getName());
  431. put("Mac.OMAC-TWOFISH",
  432. gnu.javax.crypto.jce.mac.OMacTwofishImpl.class.getName());
  433. // Aliases
  434. put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
  435. put("Alg.Alias.AlgorithmParameters.BLOWFISH", "BlockCipherParameters");
  436. put("Alg.Alias.AlgorithmParameters.ANUBIS", "BlockCipherParameters");
  437. put("Alg.Alias.AlgorithmParameters.KHAZAD", "BlockCipherParameters");
  438. put("Alg.Alias.AlgorithmParameters.NULL", "BlockCipherParameters");
  439. put("Alg.Alias.AlgorithmParameters.RIJNDAEL", "BlockCipherParameters");
  440. put("Alg.Alias.AlgorithmParameters.SERPENT", "BlockCipherParameters");
  441. put("Alg.Alias.AlgorithmParameters.SQUARE", "BlockCipherParameters");
  442. put("Alg.Alias.AlgorithmParameters.TWOFISH", "BlockCipherParameters");
  443. put("Alg.Alias.Cipher.RC4", "ARCFOUR");
  444. put("Alg.Alias.Cipher.3-DES", "TRIPLEDES");
  445. put("Alg.Alias.Cipher.3DES", "TRIPLEDES");
  446. put("Alg.Alias.Cipher.DES-EDE", "TRIPLEDES");
  447. put("Alg.Alias.Cipher.DESede", "TRIPLEDES");
  448. put("Alg.Alias.Cipher.CAST128", "CAST5");
  449. put("Alg.Alias.Cipher.CAST-128", "CAST5");
  450. put("Alg.Alias.Mac.HMAC-SHS", "HMAC-SHA160");
  451. put("Alg.Alias.Mac.HMAC-SHA", "HMAC-SHA160");
  452. put("Alg.Alias.Mac.HMAC-SHA1", "HMAC-SHA160");
  453. put("Alg.Alias.Mac.HMAC-SHA-160", "HMAC-SHA160");
  454. put("Alg.Alias.Mac.HMAC-SHA-256", "HMAC-SHA256");
  455. put("Alg.Alias.Mac.HMAC-SHA-384", "HMAC-SHA384");
  456. put("Alg.Alias.Mac.HMAC-SHA-512", "HMAC-SHA512");
  457. put("Alg.Alias.Mac.HMAC-RIPEMD-160", "HMAC-RIPEMD160");
  458. put("Alg.Alias.Mac.HMAC-RIPEMD-128", "HMAC-RIPEMD128");
  459. put("Alg.Alias.Mac.OMAC-AES", "OMAC-RIJNDAEL");
  460. put("Alg.Alias.Mac.OMAC-3DES", "OMAC-3DES");
  461. put("Alg.Alias.Mac.HmacMD4", "HMAC-MD4");
  462. put("Alg.Alias.Mac.HmacMD5", "HMAC-MD5");
  463. put("Alg.Alias.Mac.HmacSHA-1", "HMAC-SHA-1");
  464. put("Alg.Alias.Mac.HmacSHA1", "HMAC-SHA1");
  465. put("Alg.Alias.Mac.HmacSHA-160", "HMAC-SHA-160");
  466. put("Alg.Alias.Mac.HmacSHA160", "HMAC-SHA-160");
  467. put("Alg.Alias.Mac.HmacSHA-256", "HMAC-SHA-256");
  468. put("Alg.Alias.Mac.HmacSHA256", "HMAC-SHA-256");
  469. put("Alg.Alias.Mac.HmacSHA-384", "HMAC-SHA-384");
  470. put("Alg.Alias.Mac.HmacSHA384", "HMAC-SHA-384");
  471. put("Alg.Alias.Mac.HmacSHA-512", "HMAC-SHA-512");
  472. put("Alg.Alias.Mac.HmacSHA512", "HMAC-SHA-512");
  473. put("Alg.Alias.Mac.HmacRIPEMD128", "HMAC-RIPEMD128");
  474. put("Alg.Alias.Mac.HmacRIPEMD-128", "HMAC-RIPEMD128");
  475. put("Alg.Alias.Mac.HmacRIPEMD160", "HMAC-RIPEMD160");
  476. put("Alg.Alias.Mac.HmacRIPEMD-160", "HMAC-RIPEMD160");
  477. put("Alg.Alias.Mac.HmacTiger", "HMAC-TIGER");
  478. put("Alg.Alias.Mac.HmacHaval", "HMAC-HAVAL");
  479. put("Alg.Alias.Mac.HmacWhirlpool", "HMAC-WHIRLPOOL");
  480. // KeyAgreement
  481. put("KeyAgreement.DH",
  482. gnu.javax.crypto.jce.DiffieHellmanImpl.class.getName());
  483. put("Alg.Alias.KeyAgreement.DiffieHellman", "DH");
  484. // Cipher
  485. put("Cipher.RSAES-PKCS1-v1_5",
  486. gnu.javax.crypto.RSACipherImpl.class.getName());
  487. put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
  488. // SecureRandom
  489. put("SecureRandom.ARCFOUR",
  490. gnu.javax.crypto.jce.prng.ARCFourRandomSpi.class.getName());
  491. put("SecureRandom.ARCFOUR ImplementedIn", "Software");
  492. put("SecureRandom.CSPRNG",
  493. gnu.javax.crypto.jce.prng.CSPRNGSpi.class.getName());
  494. put("SecureRandom.CSPRNG ImplementedIn", "Software");
  495. put("SecureRandom.ICM",
  496. gnu.javax.crypto.jce.prng.ICMRandomSpi.class.getName());
  497. put("SecureRandom.ICM ImplementedIn", "Software");
  498. put("SecureRandom.UMAC-KDF",
  499. gnu.javax.crypto.jce.prng.UMacRandomSpi.class.getName());
  500. put("SecureRandom.UMAC-KDF ImplementedIn", "Software");
  501. put("SecureRandom.Fortuna",
  502. gnu.javax.crypto.jce.prng.FortunaImpl.class.getName());
  503. put("SecureRandom.Fortuna ImplementedIn", "Software");
  504. // KeyStore
  505. put("KeyStore.GKR",
  506. gnu.javax.crypto.jce.keyring.GnuKeyring.class.getName());
  507. put("Alg.Alias.KeyStore.GnuKeyring", "GKR");
  508. // KeyPairGenerator ---------------------------------------------------
  509. put("KeyPairGenerator.DH",
  510. gnu.javax.crypto.jce.sig.DHKeyPairGeneratorSpi.class.getName());
  511. put("KeyPairGenerator.DH KeySize", "512");
  512. put("KeyPairGenerator.DH ImplementedIn", "Software");
  513. put("Alg.Alias.KeyPairGenerator.DiffieHellman", "DH");
  514. // KeyFactory ---------------------------------------------------------
  515. put("KeyFactory.DH",
  516. gnu.javax.crypto.jce.sig.DHKeyFactory.class.getName());
  517. put("Alg.Alias,KeyFactory.DiffieHellman", "DH");
  518. // Algorithm Parameters -----------------------------------------------
  519. put("AlgorithmParameters.DH",
  520. gnu.javax.crypto.jce.sig.DHParameters.class.getName());
  521. put("Alg.Alias.AlgorithmParameters.DiffieHellman", "DH");
  522. // Algorithm Parameters Generator -------------------------------------
  523. put("AlgorithmParameterGenerator.DH",
  524. gnu.javax.crypto.jce.sig.DHParametersGenerator.class.getName());
  525. put("Alg.Alias.AlgorithmParameterGenerator.DiffieHellman", "DH");
  526. return null;
  527. }
  528. });
  529. }
  530. /**
  531. * Returns a {@link Set} of names of symmetric key block cipher algorithms
  532. * available from this {@link Provider}.
  533. *
  534. * @return a {@link Set} of cipher names (Strings).
  535. */
  536. public static final Set getCipherNames()
  537. {
  538. HashSet s = new HashSet();
  539. s.addAll(CipherFactory.getNames());
  540. s.add(Registry.ARCFOUR_PRNG);
  541. return s;
  542. }
  543. /**
  544. * Returns a {@link Set} of names of MAC algorithms available from this
  545. * {@link Provider}.
  546. *
  547. * @return a {@link Set} of MAC names (Strings).
  548. */
  549. public static final Set getMacNames()
  550. {
  551. return MacFactory.getNames();
  552. }
  553. }