001    package org.apache.fulcrum.crypto.provider;
002    
003    
004    /*
005     * Licensed to the Apache Software Foundation (ASF) under one
006     * or more contributor license agreements.  See the NOTICE file
007     * distributed with this work for additional information
008     * regarding copyright ownership.  The ASF licenses this file
009     * to you under the Apache License, Version 2.0 (the
010     * "License"); you may not use this file except in compliance
011     * with the License.  You may obtain a copy of the License at
012     *
013     *   http://www.apache.org/licenses/LICENSE-2.0
014     *
015     * Unless required by applicable law or agreed to in writing,
016     * software distributed under the License is distributed on an
017     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018     * KIND, either express or implied.  See the License for the
019     * specific language governing permissions and limitations
020     * under the License.
021     */
022    
023    
024    import org.apache.fulcrum.crypto.CryptoAlgorithm;
025    
026    /**
027     * This is a dummy for "cleartext" encryption. It goes through
028     * the notions of the CryptoAlgorithm interface but actually does
029     * nothing. It can be used as a replacement for the "encrypt = no"
030     * setting in TurbineResources.
031     *
032     * Can be used as the default crypto algorithm
033     *
034     * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
035     * @version $Id: ClearCrypt.java 535465 2007-05-05 06:58:06Z tv $
036     */
037    
038    public class ClearCrypt
039        implements CryptoAlgorithm
040    {
041        /**
042         * C'tor
043         *
044         */
045    
046        public ClearCrypt()
047        {
048        }
049    
050        /**
051         * This class never uses an algorithm, so this is
052         * just a dummy.
053         *
054         * @param cipher    Cipher (ignored)
055         */
056    
057        public void setCipher(String cipher)
058        {
059            /* dummy */
060        }
061    
062        /**
063         * This class never uses a seed, so this is
064         * just a dummy.
065         *
066         * @param seed        Seed (ignored)
067         */
068    
069        public void setSeed(String seed)
070        {
071            /* dummy */
072        }
073    
074        /**
075         * encrypt the supplied string with the requested cipher
076         *
077         * @param value       The value to be encrypted
078         *
079         * @return The encrypted value
080         *
081         * @throws Exception An Exception of the underlying implementation.
082         *
083         */
084    
085        public String encrypt(String value)
086            throws Exception
087        {
088            /*
089             * Ultra-clever implementation. ;-)
090             */
091    
092            return value;
093        }
094    }