Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: cryptix/jce/provider/key/SerpentKeyGenerator.java


1   /* $Id: SerpentKeyGenerator.java,v 1.1 2000/02/10 08:31:17 gelderen Exp $
2    *
3    * Copyright (C) 2000 The Cryptix Foundation Limited.
4    * All rights reserved.
5    * 
6    * Use, modification, copying and distribution of this software is subject 
7    * the terms and conditions of the Cryptix General Licence. You should have 
8    * received a copy of the Cryptix General Licence along with this library; 
9    * if not, you can download a copy from http://www.cryptix.org/ .
10   */
11  package cryptix.jce.provider.key;
12  
13  
14  /**
15   * Key generator for Serpent.
16   *
17   * @version $Revision: 1.1 $
18   * @author  Jeroen C. van Gelderen (gelderen@cryptix.org)
19   */
20  public final class SerpentKeyGenerator 
21  extends RawKeyGenerator
22  {
23      public SerpentKeyGenerator() 
24      {
25          super("Serpent", 256); // conservative: use 256-bit keys by default
26      }
27  
28  
29      /**
30       * Tests the given key for weaknesses
31       */
32      protected boolean isWeak( byte[] key ) 
33      {
34          return false; // Serpent doesn't have weak keys
35      }
36      
37  
38      /**
39       * @param size  Keysize in bits (128, 192 and 256 accepted)
40       */
41      protected boolean isValidSize( int size ) 
42      {
43          return (size==128 || size==192 || size==256) ? true : false;
44      }
45  }