Class KeyRepository

  • All Implemented Interfaces:
    IKeyRepository, IRepository

    public class KeyRepository
    extends Repository
    implements IKeyRepository
    A class represents a Key repository. This is the container of archived keys.

    Version:
    $Revision$, $Date$
    Author:
    thomask
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mKeyStatusUpdateTask

        public com.netscape.cmscore.dbs.KeyStatusUpdateTask mKeyStatusUpdateTask
    • Constructor Detail

      • KeyRepository

        public KeyRepository​(IDBSubsystem service,
                             int increment,
                             java.lang.String baseDN)
                      throws EDBException
        Constructs a key repository. It checks if the key repository does exist. If not, it creates the repository.

        Parameters:
        service - db service
        Throws:
        EBaseException - failed to setup key repository
        EDBException
    • Method Detail

      • setKeyStatusUpdateInterval

        public void setKeyStatusUpdateInterval​(IRepository requestRepo,
                                               int interval)
      • updateKeyStatus

        public void updateKeyStatus()
        This method blocks when another thread is running
      • getDN

        public java.lang.String getDN()
        Retrieves the DN of this repository.
      • readKeyRecord

        public IKeyRecord readKeyRecord​(org.mozilla.jss.netscape.security.x509.X500Name ownerName)
                                 throws EBaseException
        Recovers an archived key by owner name.

        Specified by:
        readKeyRecord in interface IKeyRepository
        Parameters:
        ownerName - owner name
        Returns:
        key record
        Throws:
        EBaseException - failed to recover key
      • readKeyRecord

        public IKeyRecord readKeyRecord​(java.security.PublicKey publicKey)
                                 throws EBaseException
        Recovers archived key using public key.
        Specified by:
        readKeyRecord in interface IKeyRepository
        Parameters:
        publicKey - public key that is corresponding to the private key
        Returns:
        key record
        Throws:
        EBaseException - failed to read key
      • escapeBinaryData

        public static java.lang.String escapeBinaryData​(byte[] data)
        Read RFC-2254
      • searchKeys

        public java.util.Enumeration<IKeyRecord> searchKeys​(java.lang.String filter,
                                                            int maxSize)
                                                     throws EBaseException
        Description copied from interface: IKeyRepository
        Searches for private keys.
        Specified by:
        searchKeys in interface IKeyRepository
        Parameters:
        filter - LDAP filter for the search
        maxSize - maximium number of entries to be returned
        Returns:
        a list of private key records
        Throws:
        EBaseException - failed to search keys
      • searchKeys

        public java.util.Enumeration<IKeyRecord> searchKeys​(java.lang.String filter,
                                                            int maxSize,
                                                            int timeLimit)
                                                     throws EBaseException
        Description copied from interface: IKeyRepository
        Searches for private keys.
        Specified by:
        searchKeys in interface IKeyRepository
        Parameters:
        filter - LDAP filter for the search
        maxSize - maximium number of entries to be returned
        timeLimit - timeout value
        Returns:
        a list of private key records
        Throws:
        EBaseException - failed to search keys
      • findKeyRecordsInList

        public IKeyRecordList findKeyRecordsInList​(java.lang.String filter,
                                                   java.lang.String[] attrs,
                                                   int pageSize)
                                            throws EBaseException
        Retrieves key record list.
        Specified by:
        findKeyRecordsInList in interface IKeyRepository
        Parameters:
        filter - search filter
        attrs - list of attributes to be returned
        pageSize - virtual list page size
        Returns:
        list of key records
        Throws:
        EBaseException - failed to search key records
      • findKeyRecordsInList

        public IKeyRecordList findKeyRecordsInList​(java.lang.String filter,
                                                   java.lang.String[] attrs,
                                                   java.lang.String sortKey,
                                                   int pageSize)
                                            throws EBaseException
        Description copied from interface: IKeyRepository
        Searchs for a list of key records.
        Specified by:
        findKeyRecordsInList in interface IKeyRepository
        Parameters:
        filter - search filter
        attrs - list of attributes to be returned
        sortKey - name of attribute that the list should be sorted by
        pageSize - virtual list page size
        Returns:
        list of key records
        Throws:
        EBaseException - failed to search key records
      • findKeyRecordsInList

        public IKeyRecordList findKeyRecordsInList​(java.lang.String filter,
                                                   java.lang.String[] attrs,
                                                   java.lang.String jumpTo,
                                                   java.lang.String sortKey,
                                                   int pageSize)
                                            throws EBaseException
        Throws:
        EBaseException
      • shutdown

        public void shutdown()