001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.management.geronimo;
018    
019    import java.math.BigInteger;
020    import java.security.cert.Certificate;
021    
022    /**
023     * Management interface for dealing with a specific Certificate Store
024     *
025     * @version $Rev: 487175 $ $Date: 2006-12-14 03:10:31 -0800 (Thu, 14 Dec 2006) $
026     */
027    public interface CertificateStore {
028        /**
029         * This method stores a given certificate.
030         * 
031         * @param cert Certificate to be stored
032         */
033        public void storeCertificate(Certificate cert) throws CertificateStoreException;
034    
035        /**
036         * This method returns a Certificate with a given serial number (if it exists in the store)
037         * 
038         * @param sNo Serial Number of the certificate to be retrieved.
039         */
040        public Certificate getCertificate(BigInteger sNo) throws CertificateStoreException;
041    
042        /**
043         * This method returns base64 encoded certificate with a given serial number (if it exists in the store)
044         * 
045         * @param sNo Serial Number of the certificate to be retrieved.
046         */
047        public String getCertificateBase64Text(BigInteger sNo) throws CertificateStoreException;
048    
049        /**
050         * This method returns the highest certificate serial number in the store.
051         */
052        public BigInteger getHighestSerialNumber() throws CertificateStoreException;
053    
054        /**
055         * This method returns the 'highest certificate serial number plus ONE' and increments the highest
056         * serial number in the store.
057         */
058        public BigInteger getNextSerialNumber() throws CertificateStoreException;
059    
060        /**
061         * This method checks if a certificate with a given serial number exists in the store.
062         * 
063         * @param sNo Serial number of the certificate to be checked
064         */
065        public boolean containsCertificate(BigInteger sNo);
066    
067        /**
068         * This method stores the CA's certificate in the store.
069         * @param cert CA's certificate
070         */
071        public boolean storeCACertificate(Certificate cert) throws CertificateStoreException;
072    
073        /**
074         * This method returns the CA's certificate stored in the store.
075         */
076        public Certificate getCACertificate() throws CertificateStoreException;
077    
078        /**
079         * This method stores the challenge phrase against the specified certificate serial number
080         * @param sNo  Serial number of the certificate
081         * @param challenge Challenge phrase
082         */
083        public boolean setCertificateChallenge(BigInteger sNo, String challenge) throws CertificateStoreException;
084    }