001    package org.apache.fulcrum.crypto;
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 java.security.NoSuchAlgorithmException;
025    
026    /**
027     * An implementation of CryptoService that uses either supplied crypto
028     * Algorithms (provided in Fulcrum.properties) or tries to get them via
029     * the normal java mechanisms if this fails.
030     *
031     * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
032     * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
033     */
034    public interface CryptoService
035    {
036        String ROLE = CryptoService.class.getName();
037    
038      /**
039       * Returns a CryptoAlgorithm Object which represents the requested
040       * crypto algorithm.
041       *
042       * @param algo      Name of the requested algorithm
043       *
044       * @return An Object representing the algorithm
045       *
046       * @throws NoSuchAlgorithmException  Requested algorithm is not available
047       *
048       */
049      public CryptoAlgorithm getCryptoAlgorithm(String algo) throws NoSuchAlgorithmException;
050    }