View Javadoc

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