Source for gnu.javax.crypto.jce.cipher.PBES2

   1: /* PBES2.java --
   2:    Copyright (C) 2003, 2006  Free Software Foundation, Inc.
   3: 
   4: This file is a part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2 of the License, or (at
   9: your option) any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; if not, write to the Free Software
  18: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  19: USA
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version.  */
  37: 
  38: 
  39: package gnu.javax.crypto.jce.cipher;
  40: 
  41: import gnu.javax.crypto.prng.IPBE;
  42: import gnu.java.security.prng.IRandom;
  43: import gnu.java.security.prng.LimitReachedException;
  44: import gnu.javax.crypto.prng.PRNGFactory;
  45: 
  46: import java.security.AlgorithmParameters;
  47: import java.security.InvalidAlgorithmParameterException;
  48: import java.security.InvalidKeyException;
  49: import java.security.Key;
  50: import java.security.SecureRandom;
  51: import java.security.spec.AlgorithmParameterSpec;
  52: import java.util.HashMap;
  53: 
  54: import javax.crypto.interfaces.PBEKey;
  55: import javax.crypto.spec.SecretKeySpec;
  56: 
  57: /**
  58:  */
  59: public abstract class PBES2
  60:     extends CipherAdapter
  61: {
  62:   /** The HMac (PRF) algorithm name. */
  63:   protected String macName;
  64: 
  65:   protected PBES2(String cipherName, int blockLen, String macName)
  66:   {
  67:     super(cipherName, blockLen);
  68:     this.macName = macName;
  69:   }
  70: 
  71:   protected PBES2(String cipherName, String macName)
  72:   {
  73:     super(cipherName);
  74:     this.macName = macName;
  75:   }
  76: 
  77:   protected void engineInit(int opmode, Key key, SecureRandom random)
  78:       throws InvalidKeyException
  79:   {
  80:     if (! (key instanceof PBEKey))
  81:       throw new InvalidKeyException("not a PBE key");
  82:     super.engineInit(opmode, genkey((PBEKey) key), random);
  83:   }
  84: 
  85:   protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params,
  86:                             SecureRandom random) throws InvalidKeyException,
  87:       InvalidAlgorithmParameterException
  88:   {
  89:     if (! (key instanceof PBEKey))
  90:       throw new InvalidKeyException("not a PBE key");
  91:     super.engineInit(opmode, genkey((PBEKey) key), params, random);
  92:   }
  93: 
  94:   protected void engineInit(int opmode, Key key, AlgorithmParameters params,
  95:                             SecureRandom random) throws InvalidKeyException,
  96:       InvalidAlgorithmParameterException
  97:   {
  98:     if (! (key instanceof PBEKey))
  99:       throw new InvalidKeyException("not a PBE key");
 100:     super.engineInit(opmode, genkey((PBEKey) key), params, random);
 101:   }
 102: 
 103:   private SecretKeySpec genkey(PBEKey key) throws InvalidKeyException
 104:   {
 105:     IRandom kdf = PRNGFactory.getInstance("PBKDF2-" + macName);
 106:     if (kdf == null)
 107:       throw new IllegalArgumentException("no such KDF: PBKDF2-" + macName);
 108:     HashMap attrib = new HashMap();
 109:     attrib.put(IPBE.ITERATION_COUNT, Integer.valueOf(key.getIterationCount()));
 110:     attrib.put(IPBE.PASSWORD, key.getPassword());
 111:     attrib.put(IPBE.SALT, key.getSalt());
 112:     try
 113:       {
 114:         kdf.init(attrib);
 115:       }
 116:     catch (IllegalArgumentException iae)
 117:       {
 118:         throw new InvalidKeyException(iae.toString());
 119:       }
 120:     byte[] dk = new byte[mode.defaultKeySize()];
 121:     try
 122:       {
 123:         kdf.nextBytes(dk, 0, dk.length);
 124:       }
 125:     catch (LimitReachedException shouldNotHappen)
 126:       {
 127:         throw new Error(String.valueOf(shouldNotHappen));
 128:       }
 129:     return new SecretKeySpec(dk, cipher.name());
 130:   }
 131: 
 132:   public static class HMacSHA1
 133:       extends PBES2
 134:   {
 135:     public HMacSHA1(String cipher, int blockLen)
 136:     {
 137:       super(cipher, blockLen, "HMAC-SHA1");
 138:     }
 139: 
 140:     public HMacSHA1(String cipher)
 141:     {
 142:       super(cipher, "HMAC-SHA1");
 143:     }
 144: 
 145:     public static class AES
 146:         extends HMacSHA1
 147:     {
 148:       public AES()
 149:       {
 150:         super("AES");
 151:       }
 152:     }
 153: 
 154:     public static class Anubis
 155:         extends HMacSHA1
 156:     {
 157:       public Anubis()
 158:       {
 159:         super("Anubis");
 160:       }
 161:     }
 162: 
 163:     public static class Blowfish
 164:         extends HMacSHA1
 165:     {
 166:       public Blowfish()
 167:       {
 168:         super("Blowfish");
 169:       }
 170:     }
 171: 
 172:     public static class Cast5
 173:         extends HMacSHA1
 174:     {
 175:       public Cast5()
 176:       {
 177:         super("Cast5");
 178:       }
 179:     }
 180: 
 181:     public static class DES
 182:         extends HMacSHA1
 183:     {
 184:       public DES()
 185:       {
 186:         super("DES");
 187:       }
 188:     }
 189: 
 190:     public static class Khazad
 191:         extends HMacSHA1
 192:     {
 193:       public Khazad()
 194:       {
 195:         super("Khazad");
 196:       }
 197:     }
 198: 
 199:     public static class Serpent
 200:         extends HMacSHA1
 201:     {
 202:       public Serpent()
 203:       {
 204:         super("Serpent");
 205:       }
 206:     }
 207: 
 208:     public static class Square
 209:         extends HMacSHA1
 210:     {
 211:       public Square()
 212:       {
 213:         super("Square");
 214:       }
 215:     }
 216: 
 217:     public static class TripleDES
 218:         extends HMacSHA1
 219:     {
 220:       public TripleDES()
 221:       {
 222:         super("TripleDES");
 223:       }
 224:     }
 225: 
 226:     public static class Twofish
 227:         extends HMacSHA1
 228:     {
 229:       public Twofish()
 230:       {
 231:         super("Twofish");
 232:       }
 233:     }
 234:   }
 235: 
 236:   public static class HMacMD5
 237:       extends PBES2
 238:   {
 239:     public HMacMD5(String cipher, int blockLen)
 240:     {
 241:       super(cipher, blockLen, "HMAC-MD5");
 242:     }
 243: 
 244:     public HMacMD5(String cipher)
 245:     {
 246:       super(cipher, "HMAC-MD5");
 247:     }
 248: 
 249:     public static class AES
 250:         extends HMacMD5
 251:     {
 252:       public AES()
 253:       {
 254:         super("AES");
 255:       }
 256:     }
 257: 
 258:     public static class Anubis
 259:         extends HMacMD5
 260:     {
 261:       public Anubis()
 262:       {
 263:         super("Anubis");
 264:       }
 265:     }
 266: 
 267:     public static class Blowfish
 268:         extends HMacMD5
 269:     {
 270:       public Blowfish()
 271:       {
 272:         super("Blowfish");
 273:       }
 274:     }
 275: 
 276:     public static class Cast5
 277:         extends HMacMD5
 278:     {
 279:       public Cast5()
 280:       {
 281:         super("Cast5");
 282:       }
 283:     }
 284: 
 285:     public static class DES
 286:         extends HMacMD5
 287:     {
 288:       public DES()
 289:       {
 290:         super("DES");
 291:       }
 292:     }
 293: 
 294:     public static class Khazad
 295:         extends HMacMD5
 296:     {
 297:       public Khazad()
 298:       {
 299:         super("Khazad");
 300:       }
 301:     }
 302: 
 303:     public static class Serpent
 304:         extends HMacMD5
 305:     {
 306:       public Serpent()
 307:       {
 308:         super("Serpent");
 309:       }
 310:     }
 311: 
 312:     public static class Square
 313:         extends HMacMD5
 314:     {
 315:       public Square()
 316:       {
 317:         super("Square");
 318:       }
 319:     }
 320: 
 321:     public static class TripleDES
 322:         extends HMacMD5
 323:     {
 324:       public TripleDES()
 325:       {
 326:         super("TripleDES");
 327:       }
 328:     }
 329: 
 330:     public static class Twofish
 331:         extends HMacMD5
 332:     {
 333:       public Twofish()
 334:       {
 335:         super("Twofish");
 336:       }
 337:     }
 338:   }
 339: 
 340:   public static class HMacMD2
 341:       extends PBES2
 342:   {
 343:     public HMacMD2(String cipher, int blockLen)
 344:     {
 345:       super(cipher, blockLen, "HMAC-MD2");
 346:     }
 347: 
 348:     public HMacMD2(String cipher)
 349:     {
 350:       super(cipher, "HMAC-MD2");
 351:     }
 352: 
 353:     public static class AES
 354:         extends HMacMD2
 355:     {
 356:       public AES()
 357:       {
 358:         super("AES");
 359:       }
 360:     }
 361: 
 362:     public static class Anubis
 363:         extends HMacMD2
 364:     {
 365:       public Anubis()
 366:       {
 367:         super("Anubis");
 368:       }
 369:     }
 370: 
 371:     public static class Blowfish
 372:         extends HMacMD2
 373:     {
 374:       public Blowfish()
 375:       {
 376:         super("Blowfish");
 377:       }
 378:     }
 379: 
 380:     public static class Cast5
 381:         extends HMacMD2
 382:     {
 383:       public Cast5()
 384:       {
 385:         super("Cast5");
 386:       }
 387:     }
 388: 
 389:     public static class DES
 390:         extends HMacMD2
 391:     {
 392:       public DES()
 393:       {
 394:         super("DES");
 395:       }
 396:     }
 397: 
 398:     public static class Khazad
 399:         extends HMacMD2
 400:     {
 401:       public Khazad()
 402:       {
 403:         super("Khazad");
 404:       }
 405:     }
 406: 
 407:     public static class Serpent
 408:         extends HMacMD2
 409:     {
 410:       public Serpent()
 411:       {
 412:         super("Serpent");
 413:       }
 414:     }
 415: 
 416:     public static class Square
 417:         extends HMacMD2
 418:     {
 419:       public Square()
 420:       {
 421:         super("Square");
 422:       }
 423:     }
 424: 
 425:     public static class TripleDES
 426:         extends HMacMD2
 427:     {
 428:       public TripleDES()
 429:       {
 430:         super("TripleDES");
 431:       }
 432:     }
 433: 
 434:     public static class Twofish
 435:         extends HMacMD2
 436:     {
 437:       public Twofish()
 438:       {
 439:         super("Twofish");
 440:       }
 441:     }
 442:   }
 443: 
 444:   public static class HMacMD4
 445:       extends PBES2
 446:   {
 447:     public HMacMD4(String cipher, int blockLen)
 448:     {
 449:       super(cipher, blockLen, "HMAC-MD4");
 450:     }
 451: 
 452:     public HMacMD4(String cipher)
 453:     {
 454:       super(cipher, "HMAC-MD4");
 455:     }
 456: 
 457:     public static class AES
 458:         extends HMacMD4
 459:     {
 460:       public AES()
 461:       {
 462:         super("AES");
 463:       }
 464:     }
 465: 
 466:     public static class Anubis
 467:         extends HMacMD4
 468:     {
 469:       public Anubis()
 470:       {
 471:         super("Anubis");
 472:       }
 473:     }
 474: 
 475:     public static class Blowfish
 476:         extends HMacMD4
 477:     {
 478:       public Blowfish()
 479:       {
 480:         super("Blowfish");
 481:       }
 482:     }
 483: 
 484:     public static class Cast5
 485:         extends HMacMD4
 486:     {
 487:       public Cast5()
 488:       {
 489:         super("Cast5");
 490:       }
 491:     }
 492: 
 493:     public static class DES
 494:         extends HMacMD4
 495:     {
 496:       public DES()
 497:       {
 498:         super("DES");
 499:       }
 500:     }
 501: 
 502:     public static class Khazad
 503:         extends HMacMD4
 504:     {
 505:       public Khazad()
 506:       {
 507:         super("Khazad");
 508:       }
 509:     }
 510: 
 511:     public static class Serpent
 512:         extends HMacMD4
 513:     {
 514:       public Serpent()
 515:       {
 516:         super("Serpent");
 517:       }
 518:     }
 519: 
 520:     public static class Square
 521:         extends HMacMD4
 522:     {
 523:       public Square()
 524:       {
 525:         super("Square");
 526:       }
 527:     }
 528: 
 529:     public static class TripleDES
 530:         extends HMacMD4
 531:     {
 532:       public TripleDES()
 533:       {
 534:         super("TripleDES");
 535:       }
 536:     }
 537: 
 538:     public static class Twofish
 539:         extends HMacMD4
 540:     {
 541:       public Twofish()
 542:       {
 543:         super("Twofish");
 544:       }
 545:     }
 546:   }
 547: 
 548:   public static class HMacHaval
 549:       extends PBES2
 550:   {
 551:     public HMacHaval(String cipher, int blockLen)
 552:     {
 553:       super(cipher, blockLen, "HMAC-HAVAL");
 554:     }
 555: 
 556:     public HMacHaval(String cipher)
 557:     {
 558:       super(cipher, "HMAC-HAVAL");
 559:     }
 560: 
 561:     public static class AES
 562:         extends HMacHaval
 563:     {
 564:       public AES()
 565:       {
 566:         super("AES");
 567:       }
 568:     }
 569: 
 570:     public static class Anubis
 571:         extends HMacHaval
 572:     {
 573:       public Anubis()
 574:       {
 575:         super("Anubis");
 576:       }
 577:     }
 578: 
 579:     public static class Blowfish
 580:         extends HMacHaval
 581:     {
 582:       public Blowfish()
 583:       {
 584:         super("Blowfish");
 585:       }
 586:     }
 587: 
 588:     public static class Cast5
 589:         extends HMacHaval
 590:     {
 591:       public Cast5()
 592:       {
 593:         super("Cast5");
 594:       }
 595:     }
 596: 
 597:     public static class DES
 598:         extends HMacHaval
 599:     {
 600:       public DES()
 601:       {
 602:         super("DES");
 603:       }
 604:     }
 605: 
 606:     public static class Khazad
 607:         extends HMacHaval
 608:     {
 609:       public Khazad()
 610:       {
 611:         super("Khazad");
 612:       }
 613:     }
 614: 
 615:     public static class Serpent
 616:         extends HMacHaval
 617:     {
 618:       public Serpent()
 619:       {
 620:         super("Serpent");
 621:       }
 622:     }
 623: 
 624:     public static class Square
 625:         extends HMacHaval
 626:     {
 627:       public Square()
 628:       {
 629:         super("Square");
 630:       }
 631:     }
 632: 
 633:     public static class TripleDES
 634:         extends HMacHaval
 635:     {
 636:       public TripleDES()
 637:       {
 638:         super("TripleDES");
 639:       }
 640:     }
 641: 
 642:     public static class Twofish
 643:         extends HMacHaval
 644:     {
 645:       public Twofish()
 646:       {
 647:         super("Twofish");
 648:       }
 649:     }
 650:   }
 651: 
 652:   public static class HMacRipeMD128
 653:       extends PBES2
 654:   {
 655:     public HMacRipeMD128(String cipher, int blockLen)
 656:     {
 657:       super(cipher, blockLen, "HMAC-RIPEMD128");
 658:     }
 659: 
 660:     public HMacRipeMD128(String cipher)
 661:     {
 662:       super(cipher, "HMAC-RIPEMD128");
 663:     }
 664: 
 665:     public static class AES
 666:         extends HMacRipeMD128
 667:     {
 668:       public AES()
 669:       {
 670:         super("AES");
 671:       }
 672:     }
 673: 
 674:     public static class Anubis
 675:         extends HMacRipeMD128
 676:     {
 677:       public Anubis()
 678:       {
 679:         super("Anubis");
 680:       }
 681:     }
 682: 
 683:     public static class Blowfish
 684:         extends HMacRipeMD128
 685:     {
 686:       public Blowfish()
 687:       {
 688:         super("Blowfish");
 689:       }
 690:     }
 691: 
 692:     public static class Cast5
 693:         extends HMacRipeMD128
 694:     {
 695:       public Cast5()
 696:       {
 697:         super("Cast5");
 698:       }
 699:     }
 700: 
 701:     public static class DES
 702:         extends HMacRipeMD128
 703:     {
 704:       public DES()
 705:       {
 706:         super("DES");
 707:       }
 708:     }
 709: 
 710:     public static class Khazad
 711:         extends HMacRipeMD128
 712:     {
 713:       public Khazad()
 714:       {
 715:         super("Khazad");
 716:       }
 717:     }
 718: 
 719:     public static class Serpent
 720:         extends HMacRipeMD128
 721:     {
 722:       public Serpent()
 723:       {
 724:         super("Serpent");
 725:       }
 726:     }
 727: 
 728:     public static class Square
 729:         extends HMacRipeMD128
 730:     {
 731:       public Square()
 732:       {
 733:         super("Square");
 734:       }
 735:     }
 736: 
 737:     public static class TripleDES
 738:         extends HMacRipeMD128
 739:     {
 740:       public TripleDES()
 741:       {
 742:         super("TripleDES");
 743:       }
 744:     }
 745: 
 746:     public static class Twofish
 747:         extends HMacRipeMD128
 748:     {
 749:       public Twofish()
 750:       {
 751:         super("Twofish");
 752:       }
 753:     }
 754:   }
 755: 
 756:   public static class HMacRipeMD160
 757:       extends PBES2
 758:   {
 759:     public HMacRipeMD160(String cipher, int blockLen)
 760:     {
 761:       super(cipher, blockLen, "HMAC-RIPEMD160");
 762:     }
 763: 
 764:     public HMacRipeMD160(String cipher)
 765:     {
 766:       super(cipher, "HMAC-RIPEMD160");
 767:     }
 768: 
 769:     public static class AES
 770:         extends HMacRipeMD160
 771:     {
 772:       public AES()
 773:       {
 774:         super("AES");
 775:       }
 776:     }
 777: 
 778:     public static class Anubis
 779:         extends HMacRipeMD160
 780:     {
 781:       public Anubis()
 782:       {
 783:         super("Anubis");
 784:       }
 785:     }
 786: 
 787:     public static class Blowfish
 788:         extends HMacRipeMD160
 789:     {
 790:       public Blowfish()
 791:       {
 792:         super("Blowfish");
 793:       }
 794:     }
 795: 
 796:     public static class Cast5
 797:         extends HMacRipeMD160
 798:     {
 799:       public Cast5()
 800:       {
 801:         super("Cast5");
 802:       }
 803:     }
 804: 
 805:     public static class DES
 806:         extends HMacRipeMD160
 807:     {
 808:       public DES()
 809:       {
 810:         super("DES");
 811:       }
 812:     }
 813: 
 814:     public static class Khazad
 815:         extends HMacRipeMD160
 816:     {
 817:       public Khazad()
 818:       {
 819:         super("Khazad");
 820:       }
 821:     }
 822: 
 823:     public static class Serpent
 824:         extends HMacRipeMD160
 825:     {
 826:       public Serpent()
 827:       {
 828:         super("Serpent");
 829:       }
 830:     }
 831: 
 832:     public static class Square
 833:         extends HMacRipeMD160
 834:     {
 835:       public Square()
 836:       {
 837:         super("Square");
 838:       }
 839:     }
 840: 
 841:     public static class TripleDES
 842:         extends HMacRipeMD160
 843:     {
 844:       public TripleDES()
 845:       {
 846:         super("TripleDES");
 847:       }
 848:     }
 849: 
 850:     public static class Twofish
 851:         extends HMacRipeMD160
 852:     {
 853:       public Twofish()
 854:       {
 855:         super("Twofish");
 856:       }
 857:     }
 858:   }
 859: 
 860:   public static class HMacSHA256
 861:       extends PBES2
 862:   {
 863:     public HMacSHA256(String cipher, int blockLen)
 864:     {
 865:       super(cipher, blockLen, "HMAC-SHA-256");
 866:     }
 867: 
 868:     public HMacSHA256(String cipher)
 869:     {
 870:       super(cipher, "HMAC-SHA-256");
 871:     }
 872: 
 873:     public static class AES
 874:         extends HMacSHA256
 875:     {
 876:       public AES()
 877:       {
 878:         super("AES");
 879:       }
 880:     }
 881: 
 882:     public static class Anubis
 883:         extends HMacSHA256
 884:     {
 885:       public Anubis()
 886:       {
 887:         super("Anubis");
 888:       }
 889:     }
 890: 
 891:     public static class Blowfish
 892:         extends HMacSHA256
 893:     {
 894:       public Blowfish()
 895:       {
 896:         super("Blowfish");
 897:       }
 898:     }
 899: 
 900:     public static class Cast5
 901:         extends HMacSHA256
 902:     {
 903:       public Cast5()
 904:       {
 905:         super("Cast5");
 906:       }
 907:     }
 908: 
 909:     public static class DES
 910:         extends HMacSHA256
 911:     {
 912:       public DES()
 913:       {
 914:         super("DES");
 915:       }
 916:     }
 917: 
 918:     public static class Khazad
 919:         extends HMacSHA256
 920:     {
 921:       public Khazad()
 922:       {
 923:         super("Khazad");
 924:       }
 925:     }
 926: 
 927:     public static class Serpent
 928:         extends HMacSHA256
 929:     {
 930:       public Serpent()
 931:       {
 932:         super("Serpent");
 933:       }
 934:     }
 935: 
 936:     public static class Square
 937:         extends HMacSHA256
 938:     {
 939:       public Square()
 940:       {
 941:         super("Square");
 942:       }
 943:     }
 944: 
 945:     public static class TripleDES
 946:         extends HMacSHA256
 947:     {
 948:       public TripleDES()
 949:       {
 950:         super("TripleDES");
 951:       }
 952:     }
 953: 
 954:     public static class Twofish
 955:         extends HMacSHA256
 956:     {
 957:       public Twofish()
 958:       {
 959:         super("Twofish");
 960:       }
 961:     }
 962:   }
 963: 
 964:   public static class HMacSHA384
 965:       extends PBES2
 966:   {
 967:     public HMacSHA384(String cipher, int blockLen)
 968:     {
 969:       super(cipher, blockLen, "HMAC-SHA-384");
 970:     }
 971: 
 972:     public HMacSHA384(String cipher)
 973:     {
 974:       super(cipher, "HMAC-SHA-384");
 975:     }
 976: 
 977:     public static class AES
 978:         extends HMacSHA384
 979:     {
 980:       public AES()
 981:       {
 982:         super("AES");
 983:       }
 984:     }
 985: 
 986:     public static class Anubis
 987:         extends HMacSHA384
 988:     {
 989:       public Anubis()
 990:       {
 991:         super("Anubis");
 992:       }
 993:     }
 994: 
 995:     public static class Blowfish
 996:         extends HMacSHA384
 997:     {
 998:       public Blowfish()
 999:       {
1000:         super("Blowfish");
1001:       }
1002:     }
1003: 
1004:     public static class Cast5
1005:         extends HMacSHA384
1006:     {
1007:       public Cast5()
1008:       {
1009:         super("Cast5");
1010:       }
1011:     }
1012: 
1013:     public static class DES
1014:         extends HMacSHA384
1015:     {
1016:       public DES()
1017:       {
1018:         super("DES");
1019:       }
1020:     }
1021: 
1022:     public static class Khazad
1023:         extends HMacSHA384
1024:     {
1025:       public Khazad()
1026:       {
1027:         super("Khazad");
1028:       }
1029:     }
1030: 
1031:     public static class Serpent
1032:         extends HMacSHA384
1033:     {
1034:       public Serpent()
1035:       {
1036:         super("Serpent");
1037:       }
1038:     }
1039: 
1040:     public static class Square
1041:         extends HMacSHA384
1042:     {
1043:       public Square()
1044:       {
1045:         super("Square");
1046:       }
1047:     }
1048: 
1049:     public static class TripleDES
1050:         extends HMacSHA384
1051:     {
1052:       public TripleDES()
1053:       {
1054:         super("TripleDES");
1055:       }
1056:     }
1057: 
1058:     public static class Twofish
1059:         extends HMacSHA384
1060:     {
1061:       public Twofish()
1062:       {
1063:         super("Twofish");
1064:       }
1065:     }
1066:   }
1067: 
1068:   public static class HMacSHA512
1069:       extends PBES2
1070:   {
1071:     public HMacSHA512(String cipher, int blockLen)
1072:     {
1073:       super(cipher, blockLen, "HMAC-SHA-512");
1074:     }
1075: 
1076:     public HMacSHA512(String cipher)
1077:     {
1078:       super(cipher, "HMAC-SHA-512");
1079:     }
1080: 
1081:     public static class AES
1082:         extends HMacSHA512
1083:     {
1084:       public AES()
1085:       {
1086:         super("AES");
1087:       }
1088:     }
1089: 
1090:     public static class Anubis
1091:         extends HMacSHA512
1092:     {
1093:       public Anubis()
1094:       {
1095:         super("Anubis");
1096:       }
1097:     }
1098: 
1099:     public static class Blowfish
1100:         extends HMacSHA512
1101:     {
1102:       public Blowfish()
1103:       {
1104:         super("Blowfish");
1105:       }
1106:     }
1107: 
1108:     public static class Cast5
1109:         extends HMacSHA512
1110:     {
1111:       public Cast5()
1112:       {
1113:         super("Cast5");
1114:       }
1115:     }
1116: 
1117:     public static class DES
1118:         extends HMacSHA512
1119:     {
1120:       public DES()
1121:       {
1122:         super("DES");
1123:       }
1124:     }
1125: 
1126:     public static class Khazad
1127:         extends HMacSHA512
1128:     {
1129:       public Khazad()
1130:       {
1131:         super("Khazad");
1132:       }
1133:     }
1134: 
1135:     public static class Serpent
1136:         extends HMacSHA512
1137:     {
1138:       public Serpent()
1139:       {
1140:         super("Serpent");
1141:       }
1142:     }
1143: 
1144:     public static class Square
1145:         extends HMacSHA512
1146:     {
1147:       public Square()
1148:       {
1149:         super("Square");
1150:       }
1151:     }
1152: 
1153:     public static class TripleDES
1154:         extends HMacSHA512
1155:     {
1156:       public TripleDES()
1157:       {
1158:         super("TripleDES");
1159:       }
1160:     }
1161: 
1162:     public static class Twofish
1163:         extends HMacSHA512
1164:     {
1165:       public Twofish()
1166:       {
1167:         super("Twofish");
1168:       }
1169:     }
1170:   }
1171: 
1172:   public static class HMacTiger
1173:       extends PBES2
1174:   {
1175:     public HMacTiger(String cipher, int blockLen)
1176:     {
1177:       super(cipher, blockLen, "HMAC-TIGER");
1178:     }
1179: 
1180:     public HMacTiger(String cipher)
1181:     {
1182:       super(cipher, "HMAC-TIGER");
1183:     }
1184: 
1185:     public static class AES
1186:         extends HMacTiger
1187:     {
1188:       public AES()
1189:       {
1190:         super("AES");
1191:       }
1192:     }
1193: 
1194:     public static class Anubis
1195:         extends HMacTiger
1196:     {
1197:       public Anubis()
1198:       {
1199:         super("Anubis");
1200:       }
1201:     }
1202: 
1203:     public static class Blowfish
1204:         extends HMacTiger
1205:     {
1206:       public Blowfish()
1207:       {
1208:         super("Blowfish");
1209:       }
1210:     }
1211: 
1212:     public static class Cast5
1213:         extends HMacTiger
1214:     {
1215:       public Cast5()
1216:       {
1217:         super("Cast5");
1218:       }
1219:     }
1220: 
1221:     public static class DES
1222:         extends HMacTiger
1223:     {
1224:       public DES()
1225:       {
1226:         super("DES");
1227:       }
1228:     }
1229: 
1230:     public static class Khazad
1231:         extends HMacTiger
1232:     {
1233:       public Khazad()
1234:       {
1235:         super("Khazad");
1236:       }
1237:     }
1238: 
1239:     public static class Serpent
1240:         extends HMacTiger
1241:     {
1242:       public Serpent()
1243:       {
1244:         super("Serpent");
1245:       }
1246:     }
1247: 
1248:     public static class Square
1249:         extends HMacTiger
1250:     {
1251:       public Square()
1252:       {
1253:         super("Square");
1254:       }
1255:     }
1256: 
1257:     public static class TripleDES
1258:         extends HMacTiger
1259:     {
1260:       public TripleDES()
1261:       {
1262:         super("TripleDES");
1263:       }
1264:     }
1265: 
1266:     public static class Twofish
1267:         extends HMacTiger
1268:     {
1269:       public Twofish()
1270:       {
1271:         super("Twofish");
1272:       }
1273:     }
1274:   }
1275: 
1276:   public static class HMacWhirlpool
1277:       extends PBES2
1278:   {
1279:     public HMacWhirlpool(String cipher, int blockLen)
1280:     {
1281:       super(cipher, blockLen, "HMAC-WHIRLPOOL");
1282:     }
1283: 
1284:     public HMacWhirlpool(String cipher)
1285:     {
1286:       super(cipher, "HMAC-WHIRLPOOL");
1287:     }
1288: 
1289:     public static class AES
1290:         extends HMacWhirlpool
1291:     {
1292:       public AES()
1293:       {
1294:         super("AES");
1295:       }
1296:     }
1297: 
1298:     public static class Anubis
1299:         extends HMacWhirlpool
1300:     {
1301:       public Anubis()
1302:       {
1303:         super("Anubis");
1304:       }
1305:     }
1306: 
1307:     public static class Blowfish
1308:         extends HMacWhirlpool
1309:     {
1310:       public Blowfish()
1311:       {
1312:         super("Blowfish");
1313:       }
1314:     }
1315: 
1316:     public static class Cast5
1317:         extends HMacWhirlpool
1318:     {
1319:       public Cast5()
1320:       {
1321:         super("Cast5");
1322:       }
1323:     }
1324: 
1325:     public static class DES
1326:         extends HMacWhirlpool
1327:     {
1328:       public DES()
1329:       {
1330:         super("DES");
1331:       }
1332:     }
1333: 
1334:     public static class Khazad
1335:         extends HMacWhirlpool
1336:     {
1337:       public Khazad()
1338:       {
1339:         super("Khazad");
1340:       }
1341:     }
1342: 
1343:     public static class Serpent
1344:         extends HMacWhirlpool
1345:     {
1346:       public Serpent()
1347:       {
1348:         super("Serpent");
1349:       }
1350:     }
1351: 
1352:     public static class Square
1353:         extends HMacWhirlpool
1354:     {
1355:       public Square()
1356:       {
1357:         super("Square");
1358:       }
1359:     }
1360: 
1361:     public static class TripleDES
1362:         extends HMacWhirlpool
1363:     {
1364:       public TripleDES()
1365:       {
1366:         super("TripleDES");
1367:       }
1368:     }
1369: 
1370:     public static class Twofish
1371:         extends HMacWhirlpool
1372:     {
1373:       public Twofish()
1374:       {
1375:         super("Twofish");
1376:       }
1377:     }
1378:   }
1379: }