View Javadoc

1   package org.apache.turbine.services.crypto.provider;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.turbine.services.crypto.CryptoAlgorithm;
20  
21  /***
22   * This is a dummy for "cleartext" encryption. It goes through
23   * the notions of the CryptoAlgorithm interface but actually does
24   * nothing. It can be used as a replacement for the "encrypt = no"
25   * setting in the TR.props.
26   *
27   * Can be used as the default crypto algorithm
28   *
29   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
30   * @version $Id: ClearCrypt.java 264148 2005-08-29 14:21:04Z henning $
31   */
32  public class ClearCrypt
33          implements CryptoAlgorithm
34  {
35      /***
36       * C'tor
37       */
38      public ClearCrypt()
39      {
40      }
41  
42      /***
43       * This class never uses an algorithm, so this is
44       * just a dummy.
45       *
46       * @param cipher    Cipher (ignored)
47       */
48      public void setCipher(String cipher)
49      {
50          /* dummy */
51      }
52  
53      /***
54       * This class never uses a seed, so this is
55       * just a dummy.
56       *
57       * @param seed        Seed (ignored)
58       */
59      public void setSeed(String seed)
60      {
61          /* dummy */
62      }
63  
64      /***
65       * encrypt the supplied string with the requested cipher
66       *
67       * @param value       The value to be encrypted
68       * @return The encrypted value
69       * @throws Exception An Exception of the underlying implementation.
70       */
71      public String encrypt(String value)
72              throws Exception
73      {
74          /*
75           * Ultra-clever implementation. ;-)
76           */
77  
78          return value;
79      }
80  
81  }