1   /* $RCSfile: DES1KeyCipherImpl.java,v $
2    * $Revision: 1.6 $
3    * $Date: 2002/01/04 20:21:42 $
4    * $Author: uwe $
5    * $State: Exp $
6    *
7    * Created on January 2, 2002 1:36 PM
8    *
9    * Copyright (C) 2001 Uwe Guenther <uwe@cscc.de>
10   *
11   * This file is part of the jhbci JCE-ServiceProvider. The jhbci JCE-
12   * ServiceProvider is a library, written in JavaTM, that should be 
13   * used in HBCI banking applications (clients and may be servers),
14   * to do cryptographic operations.
15   *
16   * The jhbci library is free software; you can redistribute it and/or
17   * modify it under the terms of the GNU Lesser General Public
18   * License as published by the Free Software Foundation; either
19   * version 2.1 of the License, or (at your option) any later version.
20   *
21   * The jhbci library is distributed in the hope that it will be useful,
22   * but WITHOUT ANY WARRANTY; without even the implied warranty of
23   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24   * Lesser General Public License for more details.
25   *
26   * You should have received a copy of the GNU Lesser General Public
27   * License along with this library; if not, write to the Free Software
28   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29   *
30   */
31  
32  package de.cscc.crypto.provider;
33  
34  import javax.crypto.IllegalBlockSizeException;
35  
36  /**
37   * This is the concret DES1Key algorithm class,
38   * it subclasses DESBaseCipherImpl, because in JCE is no
39   * possiblity to set a cipher.
40   */
41  final class DES1KeyCipherImpl extends DESBaseCipherImpl {
42      
43      /** The default key to initialize the cipher algorithm object.  */
44      private static final byte[] DEFAULT_KEY = {
45          (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
46          (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01
47      };
48      
49      /**
50       * Creates a new DES1KeyCipherImpl object.
51       *
52       * @throws SecurityException if the provider self integrity check fails.
53       */
54      DES1KeyCipherImpl() {
55          
56          this.cipherAlgorithm = "DES1Key";
57          
58          try{
59              this.cipher = new DESCore1KeyBlockCipher(DEFAULT_KEY);
60          } catch (IllegalBlockSizeException cannothappen) {
61              throw new Error("Can not happen.", cannothappen);
62          }
63          
64          //mode has default iv 0x0000000000000000
65          this.mode = new OperationModeCBC(this.cipher);
66          
67          this.padding = new PaddingISO10126OctetPadding(this.mode);
68      }
69      
70  }
71  
72