PageRenderTime 877ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/src/gnu-crypto/source/gnu/crypto/jce/GnuCrypto.java

https://github.com/clibrepo/04f6ea02286af71632b72d73554979a61da424cf681886674b21ecd595715c12
Java | 645 lines | 474 code | 43 blank | 128 comment | 1 complexity | 5a509f164da2e8386cd5467d31ba7ae1 MD5 | raw file
  1. package gnu.crypto.jce;
  2. // --------------------------------------------------------------------------
  3. // $Id: GnuCrypto.java,v 1.20 2003/12/25 02:17:15 uid66198 Exp $
  4. //
  5. // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
  6. //
  7. // This file is part of GNU Crypto.
  8. //
  9. // GNU Crypto is free software; you can redistribute it and/or modify it
  10. // under the terms of the GNU General Public License as published by the
  11. // Free Software Foundation; either version 2 of the License, or (at
  12. // your option) any later version.
  13. //
  14. // GNU Crypto is distributed in the hope that it will be useful, but
  15. // WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. // General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program; if not, write to the
  21. //
  22. // Free Software Foundation, Inc.,
  23. // 59 Temple Place, Suite 330,
  24. // Boston, MA 02111-1307
  25. // USA
  26. //
  27. // Linking this library statically or dynamically with other modules is
  28. // making a combined work based on this library. Thus, the terms and
  29. // conditions of the GNU General Public License cover the whole
  30. // combination.
  31. //
  32. // As a special exception, the copyright holders of this library give
  33. // you permission to link this library with independent modules to
  34. // produce an executable, regardless of the license terms of these
  35. // independent modules, and to copy and distribute the resulting
  36. // executable under terms of your choice, provided that you also meet,
  37. // for each linked independent module, the terms and conditions of the
  38. // license of that module. An independent module is a module which is
  39. // not derived from or based on this library. If you modify this
  40. // library, you may extend this exception to your version of the
  41. // library, but you are not obligated to do so. If you do not wish to
  42. // do so, delete this exception statement from your version.
  43. //
  44. // --------------------------------------------------------------------------
  45. import gnu.crypto.Registry;
  46. import gnu.crypto.cipher.CipherFactory;
  47. import gnu.crypto.hash.HashFactory;
  48. import gnu.crypto.mac.MacFactory;
  49. import gnu.crypto.sasl.ClientFactory;
  50. import gnu.crypto.sasl.ServerFactory;
  51. import gnu.crypto.key.KeyPairGeneratorFactory;
  52. import gnu.crypto.sig.SignatureFactory;
  53. import java.security.AccessController;
  54. import java.security.PrivilegedAction;
  55. import java.security.Provider;
  56. import java.util.Collections;
  57. import java.util.HashSet;
  58. import java.util.Iterator;
  59. import java.util.Set;
  60. /**
  61. * <p>The GNU Crypto implementation of the Java Cryptographic Extension (JCE)
  62. * Provider.</p>
  63. *
  64. * @version $Revision: 1.20 $
  65. * @see java.security.Provider
  66. */
  67. public final class GnuCrypto extends Provider {
  68. // Constants and variables
  69. // -------------------------------------------------------------------------
  70. // Constructor(s)
  71. // -------------------------------------------------------------------------
  72. /**
  73. * <p>The <a href="http://www.gnu.org/software/gnu-crypto/">GNU Crypto</a>
  74. * Provider.</p>
  75. */
  76. public GnuCrypto() {
  77. super(Registry.GNU_CRYPTO, 2.0, "GNU Crypto JCE Provider");
  78. AccessController.doPrivileged(
  79. new PrivilegedAction() {
  80. public Object run() {
  81. // MessageDigest
  82. put("MessageDigest.HAVAL", "gnu.crypto.jce.hash.HavalSpi");
  83. put("MessageDigest.HAVAL ImplementedIn", "Software");
  84. put("MessageDigest.MD2", "gnu.crypto.jce.hash.MD2Spi");
  85. put("MessageDigest.MD2 ImplementedIn", "Software");
  86. put("MessageDigest.MD4", "gnu.crypto.jce.hash.MD4Spi");
  87. put("MessageDigest.MD4 ImplementedIn", "Software");
  88. put("MessageDigest.MD5", "gnu.crypto.jce.hash.MD5Spi");
  89. put("MessageDigest.MD5 ImplementedIn", "Software");
  90. put("MessageDigest.RIPEMD128", "gnu.crypto.jce.hash.RipeMD128Spi");
  91. put("MessageDigest.RIPEMD128 ImplementedIn", "Software");
  92. put("MessageDigest.RIPEMD160", "gnu.crypto.jce.hash.RipeMD160Spi");
  93. put("MessageDigest.RIPEMD160 ImplementedIn", "Software");
  94. put("MessageDigest.SHA-160", "gnu.crypto.jce.hash.Sha160Spi");
  95. put("MessageDigest.SHA-160 ImplementedIn", "Software");
  96. put("MessageDigest.SHA-256", "gnu.crypto.jce.hash.Sha256Spi");
  97. put("MessageDigest.SHA-256 ImplementedIn", "Software");
  98. put("MessageDigest.SHA-384", "gnu.crypto.jce.hash.Sha384Spi");
  99. put("MessageDigest.SHA-384 ImplementedIn", "Software");
  100. put("MessageDigest.SHA-512", "gnu.crypto.jce.hash.Sha512Spi");
  101. put("MessageDigest.SHA-512 ImplementedIn", "Software");
  102. put("MessageDigest.TIGER", "gnu.crypto.jce.hash.TigerSpi");
  103. put("MessageDigest.TIGER ImplementedIn", "Software");
  104. put("MessageDigest.WHIRLPOOL", "gnu.crypto.jce.hash.WhirlpoolSpi");
  105. put("MessageDigest.WHIRLPOOL ImplementedIn", "Software");
  106. // SecureRandom
  107. put("SecureRandom.ARCFOUR", "gnu.crypto.jce.prng.ARCFourRandomSpi");
  108. put("SecureRandom.MD2PRNG", "gnu.crypto.jce.prng.MD2RandomSpi");
  109. put("SecureRandom.MD2PRNG ImplementedIn", "Software");
  110. put("SecureRandom.MD4PRNG", "gnu.crypto.jce.prng.MD4RandomSpi");
  111. put("SecureRandom.MD4PRNG ImplementedIn", "Software");
  112. put("SecureRandom.MD5PRNG", "gnu.crypto.jce.prng.MD5RandomSpi");
  113. put("SecureRandom.MD5PRNG ImplementedIn", "Software");
  114. put("SecureRandom.RIPEMD128PRNG", "gnu.crypto.jce.prng.RipeMD128RandomSpi");
  115. put("SecureRandom.RIPEMD128PRNG ImplementedIn", "Software");
  116. put("SecureRandom.RIPEMD160PRNG", "gnu.crypto.jce.prng.RipeMD160RandomSpi");
  117. put("SecureRandom.RIPEMD160PRNG ImplementedIn", "Software");
  118. put("SecureRandom.SHA-160PRNG", "gnu.crypto.jce.prng.Sha160RandomSpi");
  119. put("SecureRandom.SHA-160PRNG ImplementedIn", "Software");
  120. put("SecureRandom.SHA-256PRNG", "gnu.crypto.jce.prng.Sha256RandomSpi");
  121. put("SecureRandom.SHA-256PRNG ImplementedIn", "Software");
  122. put("SecureRandom.SHA-384PRNG", "gnu.crypto.jce.prng.Sha384RandomSpi");
  123. put("SecureRandom.SHA-384PRNG ImplementedIn", "Software");
  124. put("SecureRandom.SHA-512PRNG", "gnu.crypto.jce.prng.Sha512RandomSpi");
  125. put("SecureRandom.SHA-512PRNG ImplementedIn", "Software");
  126. put("SecureRandom.TIGERPRNG", "gnu.crypto.jce.prng.TigerRandomSpi");
  127. put("SecureRandom.TIGERPRNG ImplementedIn", "Software");
  128. put("SecureRandom.HAVALPRNG", "gnu.crypto.jce.prng.HavalRandomSpi");
  129. put("SecureRandom.HAVALPRNG ImplementedIn", "Software");
  130. put("SecureRandom.WHIRLPOOLPRNG", "gnu.crypto.jce.prng.WhirlpoolRandomSpi");
  131. put("SecureRandom.WHIRLPOOLPRNG ImplementedIn", "Software");
  132. put("SecureRandom.ICM", "gnu.crypto.jce.prng.ICMRandomSpi");
  133. put("SecureRandom.ICM ImplementedIn", "Software");
  134. put("SecureRandom.UMAC-KDF", "gnu.crypto.jce.prng.UMacRandomSpi");
  135. put("SecureRandom.UMAC-KDF ImplementedIn", "Software");
  136. // KeyPairGenerator
  137. put("KeyPairGenerator.DSS", "gnu.crypto.jce.sig.DSSKeyPairGeneratorSpi");
  138. put("KeyPairGenerator.DSS KeySize", "1024");
  139. put("KeyPairGenerator.DSS ImplementedIn", "Software");
  140. put("KeyPairGenerator.RSA", "gnu.crypto.jce.sig.RSAKeyPairGeneratorSpi");
  141. put("KeyPairGenerator.RSA KeySize", "1024");
  142. put("KeyPairGenerator.RSA ImplementedIn", "Software");
  143. // Signature
  144. put("Signature.DSS/RAW", "gnu.crypto.jce.sig.DSSRawSignatureSpi");
  145. put("Signature.DSS/RAW KeySize", "1024");
  146. put("Signature.DSS/RAW ImplementedIn", "Software");
  147. put("Signature.RSA-PSS/RAW", "gnu.crypto.jce.sig.RSAPSSRawSignatureSpi");
  148. put("Signature.RSA-PSS/RAW KeySize", "1024");
  149. put("Signature.RSA-PSS/RAW ImplementedIn", "Software");
  150. // Cipher
  151. put("Cipher.ANUBIS", "gnu.crypto.jce.cipher.AnubisSpi");
  152. put("Cipher.ANUBIS ImplementedIn", "Software");
  153. put("Cipher.ARCFOUR", "gnu.crypto.jce.cipher.ARCFourSpi");
  154. put("Cipher.ARCFOUR ImplementedIn", "Software");
  155. put("Cipher.BLOWFISH", "gnu.crypto.jce.cipher.BlowfishSpi");
  156. put("Cipher.BLOWFISH ImplementedIn", "Software");
  157. put("Cipher.DES", "gnu.crypto.jce.cipher.DESSpi");
  158. put("Cipher.DES ImplementedIn", "Software");
  159. put("Cipher.KHAZAD", "gnu.crypto.jce.cipher.KhazadSpi");
  160. put("Cipher.KHAZAD ImplementedIn", "Software");
  161. put("Cipher.NULL", "gnu.crypto.jce.cipher.NullCipherSpi");
  162. put("Cipher.NULL ImplementedIn", "Software");
  163. put("Cipher.AES", "gnu.crypto.jce.cipher.RijndaelSpi");
  164. put("Cipher.AES ImplementedIn", "Software");
  165. put("Cipher.RIJNDAEL", "gnu.crypto.jce.cipher.RijndaelSpi");
  166. put("Cipher.RIJNDAEL ImplementedIn", "Software");
  167. put("Cipher.SERPENT", "gnu.crypto.jce.cipher.SerpentSpi");
  168. put("Cipher.SERPENT ImplementedIn", "Software");
  169. put("Cipher.SQUARE", "gnu.crypto.jce.cipher.SquareSpi");
  170. put("Cipher.SQUARE ImplementedIn", "Software");
  171. put("Cipher.TRIPLEDES", "gnu.crypto.jce.cipher.TripleDESSpi");
  172. put("Cipher.TRIPLEDES ImplementedIn", "Software");
  173. put("Cipher.TWOFISH", "gnu.crypto.jce.cipher.TwofishSpi");
  174. put("Cipher.TWOFISH ImplementedIn", "Software");
  175. put("Cipher.CAST5", "gnu.crypto.jce.cipher.Cast5Spi");
  176. put("Cipher.CAST5 ImplementedIn", "Software");
  177. // PBES2 ciphers.
  178. put("Cipher.PBEWithHMacHavalAndAES",
  179. "gnu.crypto.jce.cipher.PBES2$HMacHaval$AES");
  180. put("Cipher.PBEWithHMacHavalAndAnubis",
  181. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Anubis");
  182. put("Cipher.PBEWithHMacHavalAndBlowfish",
  183. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Blowfish");
  184. put("Cipher.PBEWithHMacHavalAndCast5",
  185. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Cast5");
  186. put("Cipher.PBEWithHMacHavalAndDES",
  187. "gnu.crypto.jce.cipher.PBES2$HMacHaval$DES");
  188. put("Cipher.PBEWithHMacHavalAndKhazad",
  189. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Khazad");
  190. put("Cipher.PBEWithHMacHavalAndSerpent",
  191. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Serpent");
  192. put("Cipher.PBEWithHMacHavalAndSquare",
  193. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Square");
  194. put("Cipher.PBEWithHMacHavalAndTripleDES",
  195. "gnu.crypto.jce.cipher.PBES2$HMacHaval$TripleDES");
  196. put("Cipher.PBEWithHMacHavalAndTwofish",
  197. "gnu.crypto.jce.cipher.PBES2$HMacHaval$Twofish");
  198. put("Cipher.PBEWithHMacMD2AndAES",
  199. "gnu.crypto.jce.cipher.PBES2$HMacMD2$AES");
  200. put("Cipher.PBEWithHMacMD2AndAnubis",
  201. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Anubis");
  202. put("Cipher.PBEWithHMacMD2AndBlowfish",
  203. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Blowfish");
  204. put("Cipher.PBEWithHMacMD2AndCast5",
  205. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Cast5");
  206. put("Cipher.PBEWithHMacMD2AndDES",
  207. "gnu.crypto.jce.cipher.PBES2$HMacMD2$DES");
  208. put("Cipher.PBEWithHMacMD2AndKhazad",
  209. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Khazad");
  210. put("Cipher.PBEWithHMacMD2AndSerpent",
  211. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Serpent");
  212. put("Cipher.PBEWithHMacMD2AndSquare",
  213. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Square");
  214. put("Cipher.PBEWithHMacMD2AndTripleDES",
  215. "gnu.crypto.jce.cipher.PBES2$HMacMD2$TripleDES");
  216. put("Cipher.PBEWithHMacMD2AndTwofish",
  217. "gnu.crypto.jce.cipher.PBES2$HMacMD2$Twofish");
  218. put("Cipher.PBEWithHMacMD4AndAES",
  219. "gnu.crypto.jce.cipher.PBES2$HMacMD4$AES");
  220. put("Cipher.PBEWithHMacMD4AndAnubis",
  221. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Anubis");
  222. put("Cipher.PBEWithHMacMD4AndBlowfish",
  223. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Blowfish");
  224. put("Cipher.PBEWithHMacMD4AndCast5",
  225. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Cast5");
  226. put("Cipher.PBEWithHMacMD4AndDES",
  227. "gnu.crypto.jce.cipher.PBES2$HMacMD4$DES");
  228. put("Cipher.PBEWithHMacMD4AndKhazad",
  229. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Khazad");
  230. put("Cipher.PBEWithHMacMD4AndSerpent",
  231. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Serpent");
  232. put("Cipher.PBEWithHMacMD4AndSquare",
  233. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Square");
  234. put("Cipher.PBEWithHMacMD4AndTripleDES",
  235. "gnu.crypto.jce.cipher.PBES2$HMacMD4$TripleDES");
  236. put("Cipher.PBEWithHMacMD4AndTwofish",
  237. "gnu.crypto.jce.cipher.PBES2$HMacMD4$Twofish");
  238. put("Cipher.PBEWithHMacMD5AndAES",
  239. "gnu.crypto.jce.cipher.PBES2$HMacMD5$AES");
  240. put("Cipher.PBEWithHMacMD5AndAnubis",
  241. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Anubis");
  242. put("Cipher.PBEWithHMacMD5AndBlowfish",
  243. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Blowfish");
  244. put("Cipher.PBEWithHMacMD5AndCast5",
  245. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Cast5");
  246. put("Cipher.PBEWithHMacMD5AndDES",
  247. "gnu.crypto.jce.cipher.PBES2$HMacMD5$DES");
  248. put("Cipher.PBEWithHMacMD5AndKhazad",
  249. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Khazad");
  250. put("Cipher.PBEWithHMacMD5AndSerpent",
  251. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Serpent");
  252. put("Cipher.PBEWithHMacMD5AndSquare",
  253. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Square");
  254. put("Cipher.PBEWithHMacMD5AndTripleDES",
  255. "gnu.crypto.jce.cipher.PBES2$HMacMD5$TripleDES");
  256. put("Cipher.PBEWithHMacMD5AndTwofish",
  257. "gnu.crypto.jce.cipher.PBES2$HMacMD5$Twofish");
  258. put("Cipher.PBEWithHMacSHA1AndAES",
  259. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$AES");
  260. put("Cipher.PBEWithHMacSHA1AndAnubis",
  261. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Anubis");
  262. put("Cipher.PBEWithHMacSHA1AndBlowfish",
  263. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Blowfish");
  264. put("Cipher.PBEWithHMacSHA1AndCast5",
  265. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Cast5");
  266. put("Cipher.PBEWithHMacSHA1AndDES",
  267. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$DES");
  268. put("Cipher.PBEWithHMacSHA1AndKhazad",
  269. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Khazad");
  270. put("Cipher.PBEWithHMacSHA1AndSerpent",
  271. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Serpent");
  272. put("Cipher.PBEWithHMacSHA1AndSquare",
  273. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Square");
  274. put("Cipher.PBEWithHMacSHA1AndTripleDES",
  275. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$TripleDES");
  276. put("Cipher.PBEWithHMacSHA1AndTwofish",
  277. "gnu.crypto.jce.cipher.PBES2$HMacSHA1$Twofish");
  278. put("Cipher.PBEWithHMacSHA256AndAES",
  279. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$AES");
  280. put("Cipher.PBEWithHMacSHA256AndAnubis",
  281. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Anubis");
  282. put("Cipher.PBEWithHMacSHA256AndBlowfish",
  283. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Blowfish");
  284. put("Cipher.PBEWithHMacSHA256AndCast5",
  285. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Cast5");
  286. put("Cipher.PBEWithHMacSHA256AndDES",
  287. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$DES");
  288. put("Cipher.PBEWithHMacSHA256AndKhazad",
  289. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Khazad");
  290. put("Cipher.PBEWithHMacSHA256AndSerpent",
  291. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Serpent");
  292. put("Cipher.PBEWithHMacSHA256AndSquare",
  293. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Square");
  294. put("Cipher.PBEWithHMacSHA256AndTripleDES",
  295. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$TripleDES");
  296. put("Cipher.PBEWithHMacSHA256AndTwofish",
  297. "gnu.crypto.jce.cipher.PBES2$HMacSHA256$Twofish");
  298. put("Cipher.PBEWithHMacSHA384AndAES",
  299. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$AES");
  300. put("Cipher.PBEWithHMacSHA384AndAnubis",
  301. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Anubis");
  302. put("Cipher.PBEWithHMacSHA384AndBlowfish",
  303. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Blowfish");
  304. put("Cipher.PBEWithHMacSHA384AndCast5",
  305. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Cast5");
  306. put("Cipher.PBEWithHMacSHA384AndDES",
  307. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$DES");
  308. put("Cipher.PBEWithHMacSHA384AndKhazad",
  309. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Khazad");
  310. put("Cipher.PBEWithHMacSHA384AndSerpent",
  311. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Serpent");
  312. put("Cipher.PBEWithHMacSHA384AndSquare",
  313. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Square");
  314. put("Cipher.PBEWithHMacSHA384AndTripleDES",
  315. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$TripleDES");
  316. put("Cipher.PBEWithHMacSHA384AndTwofish",
  317. "gnu.crypto.jce.cipher.PBES2$HMacSHA384$Twofish");
  318. put("Cipher.PBEWithHMacSHA512AndAES",
  319. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$AES");
  320. put("Cipher.PBEWithHMacSHA512AndAnubis",
  321. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Anubis");
  322. put("Cipher.PBEWithHMacSHA512AndBlowfish",
  323. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Blowfish");
  324. put("Cipher.PBEWithHMacSHA512AndCast5",
  325. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Cast5");
  326. put("Cipher.PBEWithHMacSHA512AndDES",
  327. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$DES");
  328. put("Cipher.PBEWithHMacSHA512AndKhazad",
  329. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Khazad");
  330. put("Cipher.PBEWithHMacSHA512AndSerpent",
  331. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Serpent");
  332. put("Cipher.PBEWithHMacSHA512AndSquare",
  333. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Square");
  334. put("Cipher.PBEWithHMacSHA512AndTripleDES",
  335. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$TripleDES");
  336. put("Cipher.PBEWithHMacSHA512AndTwofish",
  337. "gnu.crypto.jce.cipher.PBES2$HMacSHA512$Twofish");
  338. put("Cipher.PBEWithHMacTigerAndAES",
  339. "gnu.crypto.jce.cipher.PBES2$HMacTiger$AES");
  340. put("Cipher.PBEWithHMacTigerAndAnubis",
  341. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Anubis");
  342. put("Cipher.PBEWithHMacTigerAndBlowfish",
  343. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Blowfish");
  344. put("Cipher.PBEWithHMacTigerAndCast5",
  345. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Cast5");
  346. put("Cipher.PBEWithHMacTigerAndDES",
  347. "gnu.crypto.jce.cipher.PBES2$HMacTiger$DES");
  348. put("Cipher.PBEWithHMacTigerAndKhazad",
  349. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Khazad");
  350. put("Cipher.PBEWithHMacTigerAndSerpent",
  351. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Serpent");
  352. put("Cipher.PBEWithHMacTigerAndSquare",
  353. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Square");
  354. put("Cipher.PBEWithHMacTigerAndTripleDES",
  355. "gnu.crypto.jce.cipher.PBES2$HMacTiger$TripleDES");
  356. put("Cipher.PBEWithHMacTigerAndTwofish",
  357. "gnu.crypto.jce.cipher.PBES2$HMacTiger$Twofish");
  358. put("Cipher.PBEWithHMacWhirlpoolAndAES",
  359. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$AES");
  360. put("Cipher.PBEWithHMacWhirlpoolAndAnubis",
  361. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Anubis");
  362. put("Cipher.PBEWithHMacWhirlpoolAndBlowfish",
  363. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Blowfish");
  364. put("Cipher.PBEWithHMacWhirlpoolAndCast5",
  365. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Cast5");
  366. put("Cipher.PBEWithHMacWhirlpoolAndDES",
  367. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$DES");
  368. put("Cipher.PBEWithHMacWhirlpoolAndKhazad",
  369. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Khazad");
  370. put("Cipher.PBEWithHMacWhirlpoolAndSerpent",
  371. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Serpent");
  372. put("Cipher.PBEWithHMacWhirlpoolAndSquare",
  373. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Square");
  374. put("Cipher.PBEWithHMacWhirlpoolAndTripleDES",
  375. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$TripleDES");
  376. put("Cipher.PBEWithHMacWhirlpoolAndTwofish",
  377. "gnu.crypto.jce.cipher.PBES2$HMacWhirlpool$Twofish");
  378. // SecretKeyFactory interface to PBKDF2.
  379. put("SecretKeyFactory.PBKDF2WithHMacHaval",
  380. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacHaval");
  381. put("SecretKeyFactory.PBKDF2WithHMacMD2",
  382. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacMD2");
  383. put("SecretKeyFactory.PBKDF2WithHMacMD4",
  384. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacMD4");
  385. put("SecretKeyFactory.PBKDF2WithHMacMD5",
  386. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacMD5");
  387. put("SecretKeyFactory.PBKDF2WithHMacSHA1",
  388. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacSHA1");
  389. put("SecretKeyFactory.PBKDF2WithHMacSHA256",
  390. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacSHA256");
  391. put("SecretKeyFactory.PBKDF2WithHMacSHA384",
  392. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacSHA384");
  393. put("SecretKeyFactory.PBKDF2WithHMacSHA512",
  394. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacSHA512");
  395. put("SecretKeyFactory.PBKDF2WithHMacTiger",
  396. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacTiger");
  397. put("SecretKeyFactory.PBKDF2WithHMacWhirlpool",
  398. "gnu.crypto.jce.PBKDF2SecretKeyFactory$HMacWhirlpool");
  399. put("AlgorithmParameters.BlockCipherParameters",
  400. "gnu.crypto.jce.params.BlockCipherParameters");
  401. // MAC
  402. put("Mac.HMAC-MD2", "gnu.crypto.jce.mac.HMacMD2Spi");
  403. put("Mac.HMAC-MD4", "gnu.crypto.jce.mac.HMacMD4Spi");
  404. put("Mac.HMAC-MD5", "gnu.crypto.jce.mac.HMacMD5Spi");
  405. put("Mac.HMAC-RIPEMD128", "gnu.crypto.jce.mac.HMacRipeMD128Spi");
  406. put("Mac.HMAC-RIPEMD160", "gnu.crypto.jce.mac.HMacRipeMD160Spi");
  407. put("Mac.HMAC-SHA160", "gnu.crypto.jce.mac.HMacSHA160Spi");
  408. put("Mac.HMAC-SHA256", "gnu.crypto.jce.mac.HMacSHA256Spi");
  409. put("Mac.HMAC-SHA384", "gnu.crypto.jce.mac.HMacSHA384Spi");
  410. put("Mac.HMAC-SHA512", "gnu.crypto.jce.mac.HMacSHA512Spi");
  411. put("Mac.HMAC-TIGER", "gnu.crypto.jce.mac.HMacTigerSpi");
  412. put("Mac.HMAC-HAVAL", "gnu.crypto.jce.mac.HMacHavalSpi");
  413. put("Mac.HMAC-WHIRLPOOL", "gnu.crypto.jce.mac.HMacWhirlpoolSpi");
  414. put("Mac.TMMH16", "gnu.crypto.jce.mac.TMMH16Spi");
  415. put("Mac.UHASH32", "gnu.crypto.jce.mac.UHash32Spi");
  416. put("Mac.UMAC32", "gnu.crypto.jce.mac.UMac32Spi");
  417. // KeyStore
  418. // put("KeyStore.GKR", gnu.crypto.jce.keyring.GnuKeyring.class.getName());
  419. put("KeyStore.GKR", "gnu.crypto.jce.keyring.GnuKeyring");
  420. // Aliases
  421. put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
  422. put("Alg.Alias.AlgorithmParameters.BLOWFISH", "BlockCipherParameters");
  423. put("Alg.Alias.AlgorithmParameters.ANUBIS", "BlockCipherParameters");
  424. put("Alg.Alias.AlgorithmParameters.KHAZAD", "BlockCipherParameters");
  425. put("Alg.Alias.AlgorithmParameters.NULL", "BlockCipherParameters");
  426. put("Alg.Alias.AlgorithmParameters.RIJNDAEL", "BlockCipherParameters");
  427. put("Alg.Alias.AlgorithmParameters.SERPENT", "BlockCipherParameters");
  428. put("Alg.Alias.AlgorithmParameters.SQUARE", "BlockCipherParameters");
  429. put("Alg.Alias.AlgorithmParameters.TWOFISH", "BlockCipherParameters");
  430. put("Alg.Alias.Cipher.RC4", "ARCFOUR");
  431. put("Alg.Alias.Cipher.3-DES", "TRIPLEDES");
  432. put("Alg.Alias.Cipher.3DES", "TRIPLEDES");
  433. put("Alg.Alias.Cipher.DES-EDE", "TRIPLEDES");
  434. put("Alg.Alias.Cipher.DESede", "TRIPLEDES");
  435. put("Alg.Alias.Cipher.CAST128", "CAST5");
  436. put("Alg.Alias.Cipher.CAST-128", "CAST5");
  437. put("Alg.Alias.MessageDigest.SHS", "SHA-160");
  438. put("Alg.Alias.MessageDigest.SHA", "SHA-160");
  439. put("Alg.Alias.MessageDigest.SHA1", "SHA-160");
  440. put("Alg.Alias.MessageDigest.SHA-1", "SHA-160");
  441. put("Alg.Alias.MessageDigest.SHA2-256", "SHA-256");
  442. put("Alg.Alias.MessageDigest.SHA2-384", "SHA-384");
  443. put("Alg.Alias.MessageDigest.SHA2-512", "SHA-512");
  444. put("Alg.Alias.MessageDigest.SHA256", "SHA-256");
  445. put("Alg.Alias.MessageDigest.SHA384", "SHA-384");
  446. put("Alg.Alias.MessageDigest.SHA512", "SHA-512");
  447. put("Alg.Alias.MessageDigest.RIPEMD-160", "RIPEMD160");
  448. put("Alg.Alias.MessageDigest.RIPEMD-128", "RIPEMD128");
  449. put("Alg.Alias.Mac.HMAC-SHS", "HMAC-SHA160");
  450. put("Alg.Alias.Mac.HMAC-SHA", "HMAC-SHA160");
  451. put("Alg.Alias.Mac.HMAC-SHA1", "HMAC-SHA160");
  452. put("Alg.Alias.Mac.HMAC-SHA-160", "HMAC-SHA160");
  453. put("Alg.Alias.Mac.HMAC-SHA-256", "HMAC-SHA256");
  454. put("Alg.Alias.Mac.HMAC-SHA-384", "HMAC-SHA384");
  455. put("Alg.Alias.Mac.HMAC-SHA-512", "HMAC-SHA512");
  456. put("Alg.Alias.Mac.HMAC-RIPEMD-160", "HMAC-RIPEMD160");
  457. put("Alg.Alias.Mac.HMAC-RIPEMD-128", "HMAC-RIPEMD128");
  458. put("Alg.Alias.SecureRandom.RC4", "ARCFOUR");
  459. put("Alg.Alias.SecureRandom.SHA-1PRNG", "SHA-160PRNG");
  460. put("Alg.Alias.SecureRandom.SHA1PRNG", "SHA-160PRNG");
  461. put("Alg.Alias.SecureRandom.SHAPRNG", "SHA-160PRNG");
  462. put("Alg.Alias.SecureRandom.SHA-256PRNG", "SHA-256PRNG");
  463. put("Alg.Alias.SecureRandom.SHA-2-1PRNG", "SHA-256PRNG");
  464. put("Alg.Alias.SecureRandom.SHA-384PRNG", "SHA-384PRNG");
  465. put("Alg.Alias.SecureRandom.SHA-2-2PRNG", "SHA-384PRNG");
  466. put("Alg.Alias.SecureRandom.SHA-512PRNG", "SHA-512PRNG");
  467. put("Alg.Alias.SecureRandom.SHA-2-3PRNG", "SHA-512PRNG");
  468. put("Alg.Alias.KeyPairGenerator.DSA", "DSS");
  469. put("Alg.Alias.Signature.DSA", "DSS/RAW");
  470. put("Alg.Alias.Signature.SHAwithDSA", "DSS/RAW");
  471. put("Alg.Alias.Signature.SHA1withDSA", "DSS/RAW");
  472. put("Alg.Alias.Signature.SHA160withDSA", "DSS/RAW");
  473. put("Alg.Alias.Signature.SHA/DSA", "DSS/RAW");
  474. put("Alg.Alias.Signature.SHA1/DSA", "DSS/RAW");
  475. put("Alg.Alias.Signature.SHA-1/DSA", "DSS/RAW");
  476. put("Alg.Alias.Signature.SHA-160/DSA", "DSS/RAW");
  477. put("Alg.Alias.Signature.DSAwithSHA", "DSS/RAW");
  478. put("Alg.Alias.Signature.DSAwithSHA1", "DSS/RAW");
  479. put("Alg.Alias.Signature.DSAwithSHA160", "DSS/RAW");
  480. put("Alg.Alias.Signature.RSA-PSS", "RSA-PSS/RAW");
  481. put("Alg.Alias.Signature.RSAPSS", "RSA-PSS/RAW");
  482. put("Alg.Alias.KeyStore.GnuKeyring", "GKR");
  483. // put("Alg.Alias.Signature.OID.1.2.840.10040.4.3", "DSS");
  484. // put("Alg.Alias.Signature.1.2.840.10040.4.3", "DSS");
  485. // put("Alg.Alias.Signature.1.3.14.3.2.13", "DSS");
  486. // put("Alg.Alias.Signature.1.3.14.3.2.27", "DSS");
  487. // SASL Client and Server mechanisms
  488. put("SaslClientFactory.ANONYMOUS", "gnu.crypto.sasl.ClientFactory");
  489. put("SaslClientFactory.PLAIN", "gnu.crypto.sasl.ClientFactory");
  490. put("SaslClientFactory.CRAM-MD5", "gnu.crypto.sasl.ClientFactory");
  491. put("SaslClientFactory.SRP", "gnu.crypto.sasl.ClientFactory");
  492. put("SaslServerFactory.ANONYMOUS", "gnu.crypto.sasl.ServerFactory");
  493. put("SaslServerFactory.PLAIN", "gnu.crypto.sasl.ServerFactory");
  494. put("SaslServerFactory.CRAM-MD5", "gnu.crypto.sasl.ServerFactory");
  495. put("SaslServerFactory.SRP-MD5", "gnu.crypto.sasl.ServerFactory");
  496. put("SaslServerFactory.SRP-SHA-160", "gnu.crypto.sasl.ServerFactory");
  497. put("SaslServerFactory.SRP-RIPEMD128", "gnu.crypto.sasl.ServerFactory");
  498. put("SaslServerFactory.SRP-RIPEMD160", "gnu.crypto.sasl.ServerFactory");
  499. put("SaslServerFactory.SRP-TIGER", "gnu.crypto.sasl.ServerFactory");
  500. put("SaslServerFactory.SRP-WHIRLPOOL", "gnu.crypto.sasl.ServerFactory");
  501. put("Alg.Alias.SaslServerFactory.SRP-SHS", "SRP-SHA-160");
  502. put("Alg.Alias.SaslServerFactory.SRP-SHA", "SRP-SHA-160");
  503. put("Alg.Alias.SaslServerFactory.SRP-SHA1", "SRP-SHA-160");
  504. put("Alg.Alias.SaslServerFactory.SRP-SHA-1", "SRP-SHA-160");
  505. put("Alg.Alias.SaslServerFactory.SRP-SHA160", "SRP-SHA-160");
  506. put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-128", "SRP-RIPEMD128");
  507. put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-160", "SRP-RIPEMD160");
  508. return null;
  509. }
  510. }
  511. );
  512. }
  513. // Class methods
  514. // -------------------------------------------------------------------------
  515. /**
  516. * <p>Returns a {@link Set} of names of message digest algorithms available
  517. * from this {@link Provider}.</p>
  518. *
  519. * @return a {@link Set} of hash names (Strings).
  520. */
  521. public static final Set getMessageDigestNames() {
  522. return HashFactory.getNames();
  523. }
  524. /**
  525. * <p>Returns a {@link Set} of names of secure random implementations
  526. * available from this {@link Provider}.</p>
  527. *
  528. * @return a {@link Set} of secure random names (Strings).
  529. */
  530. public static final Set getSecureRandomNames() {
  531. Set result = new HashSet();
  532. // do all the hash-based prng algorithms
  533. Set md = gnu.crypto.hash.HashFactory.getNames();
  534. for (Iterator it = md.iterator(); it.hasNext();) {
  535. result.add(((String) it.next()).toUpperCase() + "PRNG");
  536. }
  537. // add ICM and UMAC based generators
  538. result.add(Registry.ICM_PRNG.toUpperCase());
  539. result.add(Registry.UMAC_PRNG.toUpperCase());
  540. result.add(Registry.ARCFOUR_PRNG.toUpperCase());
  541. return Collections.unmodifiableSet(result);
  542. }
  543. /**
  544. * <p>Returns a {@link Set} of names of keypair generator implementations
  545. * available from this {@link Provider}.</p>
  546. *
  547. * @return a {@link Set} of key pair generator names (Strings).
  548. */
  549. public static final Set getKeyPairGeneratorNames() {
  550. return KeyPairGeneratorFactory.getNames();
  551. }
  552. /**
  553. * <p>Returns a {@link Set} of names of signature scheme implementations
  554. * available from this {@link Provider}.</p>
  555. *
  556. * @return a {@link Set} of signature names (Strings).
  557. */
  558. public static final Set getSignatureNames() {
  559. return SignatureFactory.getNames();
  560. }
  561. /**
  562. * <p>Returns a {@link Set} of names of symmetric key block cipher algorithms
  563. * available from this {@link Provider}.</p>
  564. *
  565. * @return a {@link Set} of cipher names (Strings).
  566. */
  567. public static final Set getCipherNames() {
  568. HashSet s = new HashSet();
  569. s.addAll(CipherFactory.getNames());
  570. s.add(Registry.ARCFOUR_PRNG);
  571. return s;
  572. }
  573. /**
  574. * <p>Returns a {@link Set} of names of MAC algorithms available from
  575. * this {@link Provider}.</p>
  576. *
  577. * @return a {@link Set} of MAC names (Strings).
  578. */
  579. public static final Set getMacNames() {
  580. return MacFactory.getNames();
  581. }
  582. /**
  583. * <p>Returns a {@link Set} of names of SASL Client mechanisms available from
  584. * this {@link Provider}.</p>
  585. *
  586. * @return a {@link Set} of SASL Client mechanisms (Strings).
  587. */
  588. public static final Set getSaslClientMechanismNames() {
  589. return ClientFactory.getNames();
  590. }
  591. /**
  592. * <p>Returns a {@link Set} of names of SASL Server mechanisms available from
  593. * this {@link Provider}.</p>
  594. *
  595. * @return a {@link Set} of SASL Server mechanisms (Strings).
  596. */
  597. public static final Set getSaslServerMechanismNames() {
  598. return ServerFactory.getNames();
  599. }
  600. // Instance methods
  601. // -------------------------------------------------------------------------
  602. }