Package com.netscape.cmscore.dbs
Class KeyRepository
- java.lang.Object
-
- com.netscape.cmscore.dbs.Repository
-
- com.netscape.cmscore.dbs.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 Summary
Fields Modifier and Type Field Description protected DBSubsystemdbSubsystemstatic org.slf4j.Loggerloggercom.netscape.cmscore.dbs.KeyStatusUpdateTaskmKeyStatusUpdateTask-
Fields inherited from class com.netscape.cmscore.dbs.Repository
mCounter, mEnableRandomSerialNumbers, mMaxSerialNo, mMinSerialNo, PROP_BASE_DN
-
-
Constructor Summary
Constructors Constructor Description KeyRepository(DBSubsystem dbSubsystem, int increment, java.lang.String baseDN)Constructs a key repository.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddKeyRecord(IKeyRecord record)Archives a key to the repository.voiddeleteKeyRecord(java.math.BigInteger serialNo)Deletes a key record.static java.lang.StringescapeBinaryData(byte[] data)Read RFC-2254IKeyRecordListfindKeyRecordsInList(java.lang.String filter, java.lang.String[] attrs, int pageSize)Retrieves key record list.IKeyRecordListfindKeyRecordsInList(java.lang.String filter, java.lang.String[] attrs, java.lang.String sortKey, int pageSize)Searchs for a list of key records.IKeyRecordListfindKeyRecordsInList(java.lang.String filter, java.lang.String[] attrs, java.lang.String jumpTo, java.lang.String sortKey, int pageSize)DBSubsystemgetDBSubsystem()java.lang.StringgetDN()Retrieves the DN of this repository.java.math.BigIntegergetLastSerialNumberInRange(java.math.BigInteger serial_low_bound, java.math.BigInteger serial_upper_bound)voidmodifyKeyRecord(java.math.BigInteger serialNo, ModificationSet mods)Modifies key record.IKeyRecordreadKeyRecord(java.lang.String cert)Recovers archived key using b64 encoded certIKeyRecordreadKeyRecord(java.math.BigInteger serialNo)Recovers an archived key by serial number.IKeyRecordreadKeyRecord(java.security.PublicKey publicKey)Recovers archived key using public key.IKeyRecordreadKeyRecord(org.mozilla.jss.netscape.security.x509.X500Name ownerName)Recovers an archived key by owner name.voidremoveAllObjects()Removes all objects with this repository.java.util.Enumeration<IKeyRecord>searchKeys(java.lang.String filter, int maxSize)Searches for private keys.java.util.Enumeration<IKeyRecord>searchKeys(java.lang.String filter, int maxSize, int timeLimit)Searches for private keys.voidsetKeyStatusUpdateInterval(IRepository requestRepo, int interval)voidshutdown()voidupdateKeyStatus()This method blocks when another thread is running-
Methods inherited from class com.netscape.cmscore.dbs.Repository
checkRange, checkRanges, getMaxSerial, getMinSerial, getNextMaxSerial, getNextSerialNumber, getSerialNumber, initCacheIfNeeded, peekNextSerialNumber, resetSerialNumber, setEnableSerialMgmt, setLastSerialNo, setMaxSerial, setNextMaxSerial, setSerialNumber, setTheSerialNumber
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.netscape.certsrv.dbs.repository.IRepository
checkRanges, getNextSerialNumber, peekNextSerialNumber, resetSerialNumber, setEnableSerialMgmt, setMaxSerial, setNextMaxSerial
-
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
mKeyStatusUpdateTask
public com.netscape.cmscore.dbs.KeyStatusUpdateTask mKeyStatusUpdateTask
-
dbSubsystem
protected DBSubsystem dbSubsystem
-
-
Constructor Detail
-
KeyRepository
public KeyRepository(DBSubsystem dbSubsystem, 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 repositoryEDBException
-
-
Method Detail
-
setKeyStatusUpdateInterval
public void setKeyStatusUpdateInterval(IRepository requestRepo, int interval)
-
updateKeyStatus
public void updateKeyStatus()
This method blocks when another thread is running
-
getDBSubsystem
public DBSubsystem getDBSubsystem()
-
getDN
public java.lang.String getDN()
Retrieves the DN of this repository.
-
removeAllObjects
public void removeAllObjects() throws EBaseExceptionRemoves all objects with this repository.- Throws:
EBaseException
-
addKeyRecord
public void addKeyRecord(IKeyRecord record) throws EBaseException
Archives a key to the repository.- Specified by:
addKeyRecordin interfaceIKeyRepository- Parameters:
record- key record- Throws:
EBaseException- failed to archive key
-
readKeyRecord
public IKeyRecord readKeyRecord(java.math.BigInteger serialNo) throws EBaseException
Recovers an archived key by serial number.- Specified by:
readKeyRecordin interfaceIKeyRepository- Parameters:
serialNo- serial number- Returns:
- key record
- Throws:
EBaseException- failed to recover key
-
readKeyRecord
public IKeyRecord readKeyRecord(org.mozilla.jss.netscape.security.x509.X500Name ownerName) throws EBaseException
Recovers an archived key by owner name.- Specified by:
readKeyRecordin interfaceIKeyRepository- 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:
readKeyRecordin interfaceIKeyRepository- Parameters:
publicKey- public key that is corresponding to the private key- Returns:
- key record
- Throws:
EBaseException- failed to read key
-
readKeyRecord
public IKeyRecord readKeyRecord(java.lang.String cert) throws EBaseException
Recovers archived key using b64 encoded cert- Specified by:
readKeyRecordin interfaceIKeyRepository- Parameters:
cert- b64 encoded cert- Returns:
- key record
- Throws:
EBaseException- failed to recover key
-
modifyKeyRecord
public void modifyKeyRecord(java.math.BigInteger serialNo, ModificationSet mods) throws EBaseExceptionModifies key record.- Specified by:
modifyKeyRecordin interfaceIKeyRepository- Parameters:
serialNo- key identifiermods- modification of key records- Throws:
EBaseException- failed to modify key record
-
deleteKeyRecord
public void deleteKeyRecord(java.math.BigInteger serialNo) throws EBaseExceptionDescription copied from interface:IKeyRepositoryDeletes a key record.- Specified by:
deleteKeyRecordin interfaceIKeyRepository- Parameters:
serialNo- key identifier- Throws:
EBaseException- failed to delete key record
-
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:IKeyRepositorySearches for private keys.- Specified by:
searchKeysin interfaceIKeyRepository- Parameters:
filter- LDAP filter for the searchmaxSize- 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:IKeyRepositorySearches for private keys.- Specified by:
searchKeysin interfaceIKeyRepository- Parameters:
filter- LDAP filter for the searchmaxSize- maximium number of entries to be returnedtimeLimit- 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:
findKeyRecordsInListin interfaceIKeyRepository- Parameters:
filter- search filterattrs- list of attributes to be returnedpageSize- 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:IKeyRepositorySearchs for a list of key records.- Specified by:
findKeyRecordsInListin interfaceIKeyRepository- Parameters:
filter- search filterattrs- list of attributes to be returnedsortKey- name of attribute that the list should be sorted bypageSize- 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
-
getLastSerialNumberInRange
public java.math.BigInteger getLastSerialNumberInRange(java.math.BigInteger serial_low_bound, java.math.BigInteger serial_upper_bound) throws EBaseException- Specified by:
getLastSerialNumberInRangein classRepository- Throws:
EBaseException
-
shutdown
public void shutdown()
-
-