// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs.certdb;
import java.math.BigInteger;
import java.security.cert.Certificate;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import netscape.ldap.LDAPEntry;
import netscape.security.x509.X509CertImpl;
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.MetaInfo;
import com.netscape.certsrv.dbs.ModificationSet;
import com.netscape.certsrv.dbs.repository.IRepository;
import com.netscape.cmscore.dbs.CertificateRepository.RenewableCertificateCollection;
/**
* An interface represents a CMS certificate repository.
* It stores all the issued certificate.
*
*
* @version $Revision$, $Date$
*/
public interface ICertificateRepository extends IRepository {
/**
* Adds a certificate record to the repository. Each certificate
* record contains four parts: certificate, meta-attributes,
* issue information and reovcation information.
*
*
* @param record X.509 certificate
* @exception EBaseException failed to add new certificate to
* the repository
*/
public void addCertificateRecord(ICertRecord record)
throws EBaseException;
/**
* Reads the certificate identified by the given serial no.
*
* @param serialNo serial number of certificate
* @return certificate
* @exception EBaseException failed to retrieve certificate
*/
public X509CertImpl getX509Certificate(BigInteger serialNo)
throws EBaseException;
/**
* Reads certificate from repository.
*
* @param serialNo serial number of certificate
* @return certificate record
* @exception EBaseException failed to retrieve certificate
*/
public ICertRecord readCertificateRecord(BigInteger serialNo)
throws EBaseException;
/**
* Sets certificate status update internal
*
* @param requestRepo request repository
* @param interval update interval
* @param listenToCloneModifications enable listening to clone modifications
*/
public void setCertStatusUpdateInterval(IRepository requestRepo,
int interval,
boolean listenToCloneModifications);
/**
* Updates certificate status now. This is a blocking method.
*
* @exception EBaseException failed to update
*/
public void updateCertStatus() throws EBaseException;
/**
* Modifies certificate record.
*
* @param serialNo serial number of record
* @param mods modifications
* @exception EBaseException failed to modify
*/
public void modifyCertificateRecord(BigInteger serialNo,
ModificationSet mods) throws EBaseException;
/**
* Checks if the certificate exists in this repository.
*
* @param serialNo serial number of certificate
* @return true if it exists
* @exception EBaseException failed to check
*/
public boolean containsCertificate(BigInteger serialNo)
throws EBaseException;
/**
* Deletes certificate from this repository.
*
* @param serialNo serial number of certificate
* @exception EBaseException failed to delete
*/
public void deleteCertificateRecord(BigInteger serialNo)
throws EBaseException;
/**
* Marks certificate as revoked.
*
* @param id serial number
* @param info revocation information
* @exception EBaseException failed to mark
*/
public void markAsRevoked(BigInteger id, IRevocationInfo info)
throws EBaseException;
/**
* Updates certificate status.
*
* @param id serial number
* @param status certificate status
* @exception EBaseException failed to update status
*/
public void updateStatus(BigInteger id, String status)
throws EBaseException;
/**
* Marks certificate as renewable.
*
* @param record certificate record to modify
* @exception EBaseException failed to update
*/
public void markCertificateAsRenewable(ICertRecord record)
throws EBaseException;
/**
* Marks certificate as not renewable.
*
* @param record certificate record to modify
* @exception EBaseException failed to update
*/
public void markCertificateAsNotRenewable(ICertRecord record)
throws EBaseException;
/**
* Marks certificate as renewed.
*
* @param serialNo certificate record to modify
* @exception EBaseException failed to update
*/
public void markCertificateAsRenewed(String serialNo)
throws EBaseException;
/**
* Marks certificate as renewed and notified.
*
* @param serialNo certificate record to modify
* @exception EBaseException failed to update
*/
public void markCertificateAsRenewalNotified(String serialNo)
throws EBaseException;
/**
* Finds a list of certificate records that satisifies
* the filter.
* Here is a list of filter
* attribute can be used:
*
*
*
* @param filter search filter
* @param maxSize max size to return
* @return a list of certificates
* @exception EBaseException failed to search
*/
public Enumeration