summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/dbs/keydb
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/certsrv/dbs/keydb')
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecord.java44
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java12
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java70
-rw-r--r--pki/base/common/src/com/netscape/certsrv/dbs/keydb/KeyState.java49
4 files changed, 92 insertions, 83 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecord.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecord.java
index 010661d8..0edcc187 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecord.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecord.java
@@ -17,14 +17,16 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs.keydb;
+
import java.math.BigInteger;
import java.util.Date;
import com.netscape.certsrv.base.EBaseException;
+
/**
* An interface contains constants for key record.
- *
+ *
* @version $Revision$, $Date$
*/
public interface IKeyRecord {
@@ -40,15 +42,15 @@ public interface IKeyRecord {
public static final String ATTR_MODIFY_TIME = "keyModifyTime";
public static final String ATTR_META_INFO = "keyMetaInfo";
public static final String ATTR_ARCHIVED_BY = "keyArchivedBy";
-
+
// key state
public static final String STATUS_ANY = "ANY";
public static final String STATUS_VALID = "VALID";
public static final String STATUS_INVALID = "INVALID";
-
+
/**
* Retrieves the state of the key.
- *
+ *
* @return key state
* @exception EBaseException failed to retrieve state of the key
*/
@@ -56,15 +58,15 @@ public interface IKeyRecord {
/**
* Retrieves key identifier.
- *
+ *
* @return key id
* @exception EBaseException failed to retrieve key id
*/
- public BigInteger getSerialNumber() throws EBaseException;
+ public BigInteger getSerialNumber() throws EBaseException;
/**
* Retrieves key owner name.
- *
+ *
* @return key owner name
* @exception EBaseException failed to retrieve key owner name
*/
@@ -72,53 +74,53 @@ public interface IKeyRecord {
/**
* Retrieves key algorithm.
- *
+ *
* @return key algorithm
*/
- public String getAlgorithm();
+ public String getAlgorithm();
/**
* Retrieves key length.
- *
+ *
* @return key length
* @exception EBaseException failed to retrieve key length
*/
- public Integer getKeySize() throws EBaseException;
+ public Integer getKeySize() throws EBaseException;
/**
* Retrieves archiver identifier.
- *
+ *
* @return archiver uid
*/
- public String getArchivedBy();
+ public String getArchivedBy();
/**
* Retrieves creation time.
- *
+ *
* @return creation time
*/
- public Date getCreateTime();
+ public Date getCreateTime();
/**
* Retrieves last modification time.
- *
+ *
* @return modification time
*/
- public Date getModifyTime();
+ public Date getModifyTime();
/**
* Retrieves dates of recovery.
- *
+ *
* @return recovery history
* @exception EBaseException failed to retrieve recovery history
*/
- public Date[] getDateOfRevocation() throws EBaseException;
+ public Date[] getDateOfRevocation() throws EBaseException;
/**
* Retrieves public key data.
- *
+ *
* @return public key data
* @exception EBaseException failed to retrieve public key data
*/
public byte[] getPublicKeyData() throws EBaseException;
-}
+}
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
index 60c2b37d..2bc9f57b 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRecordList.java
@@ -17,33 +17,35 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs.keydb;
+
import java.util.Enumeration;
import com.netscape.certsrv.base.EBaseException;
+
/**
* A class represents a list of key records.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public interface IKeyRecordList {
/**
- * Retrieves the size of key list.
- *
+ * Retrieves the size of key list.
+ *
* @return size of key list
*/
public int getSize();
/**
* Retrieves key records.
- *
+ *
* @param startidx start index
* @param endidx end index
* @return key records
* @exception EBaseException failed to retrieve key records
*/
public Enumeration getKeyRecords(int startidx, int endidx)
- throws EBaseException;
+ throws EBaseException;
}
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java
index de48dac1..093bea25 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs.keydb;
+
import java.math.BigInteger;
import java.security.PublicKey;
import java.util.Enumeration;
@@ -27,11 +28,12 @@ import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.dbs.ModificationSet;
import com.netscape.certsrv.dbs.repository.IRepository;
+
/**
- * An interface represents a Key repository. This is the container of archived
- * keys.
+ * An interface represents a Key repository. This is the
+ * container of archived keys.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public interface IKeyRepository extends IRepository {
@@ -39,7 +41,7 @@ public interface IKeyRepository extends IRepository {
/**
* Archives a key to the repository.
* <P>
- *
+ *
* @param record key record
* @exception EBaseException failed to archive key
*/
@@ -48,56 +50,61 @@ public interface IKeyRepository extends IRepository {
/**
* Reads an archived key by serial number.
* <P>
- *
+ *
* @param serialNo serial number
* @return key record
* @exception EBaseException failed to recover key
*/
- public IKeyRecord readKeyRecord(BigInteger serialNo) throws EBaseException;
+ public IKeyRecord readKeyRecord(BigInteger serialNo)
+ throws EBaseException;
/**
* Reads an archived key by b64 encoded cert.
* <P>
- *
+ *
* @param cert b64 encoded cert
* @return key record
* @exception EBaseException failed to recover key
*/
- public IKeyRecord readKeyRecord(String cert) throws EBaseException;
+ public IKeyRecord readKeyRecord(String cert)
+ throws EBaseException;
/**
* Reads an archived key by owner name.
* <P>
- *
+ *
* @param ownerName owner name
* @return key record
* @exception EBaseException failed to recover key
*/
- public IKeyRecord readKeyRecord(X500Name ownerName) throws EBaseException;
+ public IKeyRecord readKeyRecord(X500Name ownerName)
+ throws EBaseException;
/**
* Reads archived key using public key.
- *
- * @param publicKey public key that is corresponding to the private key
+ *
+ * @param publicKey public key that is corresponding
+ * to the private key
* @return key record
* @exception EBaseException failed to read key
*/
- public IKeyRecord readKeyRecord(PublicKey publicKey) throws EBaseException;
+ public IKeyRecord readKeyRecord(PublicKey publicKey)
+ throws EBaseException;
/**
* Searches for private keys.
- *
+ *
* @param filter LDAP filter for the search
* @param maxSize maximium number of entries to be returned
* @return a list of private key records
* @exception EBaseException failed to search keys
*/
public Enumeration searchKeys(String filter, int maxSize)
- throws EBaseException;
+ throws EBaseException;
/**
* Searches for private keys.
- *
+ *
* @param filter LDAP filter for the search
* @param maxSize maximium number of entries to be returned
* @param timeLimt timeout value
@@ -105,30 +112,30 @@ public interface IKeyRepository extends IRepository {
* @exception EBaseException failed to search keys
*/
public Enumeration searchKeys(String filter, int maxSize, int timeLimt)
- throws EBaseException;
+ throws EBaseException;
/**
* Deletes a key record.
- *
+ *
* @param serialno key identifier
* @exception EBaseException failed to delete key record
*/
- public void deleteKeyRecord(BigInteger serialno) throws EBaseException;
+ public void deleteKeyRecord(BigInteger serialno)
+ throws EBaseException;
/**
* Modifies key record in this repository.
- *
+ *
* @param serialNo key identifier
* @param mods modification of key records
* @exception EBaseException failed to modify key record
*/
- public void modifyKeyRecord(BigInteger serialNo, ModificationSet mods)
- throws EBaseException;
+ public void modifyKeyRecord(BigInteger serialNo,
+ ModificationSet mods) throws EBaseException;
/**
- * Searchs for a list of key records. Here is a list of supported filter
- * attributes:
- *
+ * Searchs for a list of key records.
+ * Here is a list of supported filter attributes:
* <pre>
* keySerialNumber
* keyState
@@ -142,19 +149,19 @@ public interface IKeyRepository extends IRepository {
* keyModifyTime
* keyMetaInfo
* </pre>
- *
+ *
* @param filter search filter
* @param attrs list of attributes to be returned
* @param pageSize virtual list page size
* @return list of key records
* @exception EBaseException failed to search key records
*/
- public IKeyRecordList findKeyRecordsInList(String filter, String attrs[],
- int pageSize) throws EBaseException;
+ public IKeyRecordList findKeyRecordsInList(String filter,
+ String attrs[], int pageSize) throws EBaseException;
/**
* Searchs for a list of key records.
- *
+ *
* @param filter search filter
* @param attrs list of attributes to be returned
* @param sortKey name of attribute that the list should be sorted by
@@ -162,6 +169,7 @@ public interface IKeyRepository extends IRepository {
* @return list of key records
* @exception EBaseException failed to search key records
*/
- public IKeyRecordList findKeyRecordsInList(String filter, String attrs[],
- String sortKey, int pageSize) throws EBaseException;
+ public IKeyRecordList findKeyRecordsInList(String filter,
+ String attrs[], String sortKey, int pageSize)
+ throws EBaseException;
}
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/KeyState.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/KeyState.java
index 3ab0bd3a..e4baf91e 100644
--- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/KeyState.java
+++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/KeyState.java
@@ -17,13 +17,15 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs.keydb;
+
import java.io.Serializable;
+
/**
- * A class represents key state. This object is to encapsulate the life cycle of
- * a key.
+ * A class represents key state. This object is to
+ * encapsulate the life cycle of a key.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public final class KeyState implements Serializable {
@@ -40,67 +42,62 @@ public final class KeyState implements Serializable {
private KeyState(int code) {
mStateCode = code;
}
-
+
/**
* Request state.
*/
- public final static KeyState ANY = new KeyState(-1);
+ public final static KeyState ANY = new KeyState(-1);
public final static KeyState VALID = new KeyState(0);
public final static KeyState INVALID = new KeyState(1);
-
+
/**
* Checks if the given object equals to this object.
- *
+ *
* @param other object to be compared
* @return true if both objects are the same
*/
public boolean equals(Object other) {
- if (this == other)
+ if (this == other)
return true;
else if (other instanceof KeyState)
return ((KeyState) other).mStateCode == mStateCode;
- else
+ else
return false;
}
/**
* Returns the hash code.
- *
+ *
* @return hash code
*/
public int hashCode() {
return mStateCode;
}
-
+
/**
* Return the string-representation of this object.
- *
+ *
* @return string value
*/
public String toString() {
- if (mStateCode == -1)
- return "ANY";
- if (mStateCode == 0)
- return "VALID";
- if (mStateCode == 1)
- return "INVAILD";
+ if (mStateCode == -1) return "ANY";
+ if (mStateCode == 0) return "VALID";
+ if (mStateCode == 1) return "INVAILD";
return "[UNDEFINED]";
-
+
}
/**
* Converts a string into a key state object.
- *
+ *
* @param state state in string-representation
* @return key state object
*/
public static KeyState toKeyState(String state) {
- if (state.equalsIgnoreCase("ANY"))
- return ANY;
- if (state.equalsIgnoreCase("VALID"))
- return VALID;
- if (state.equalsIgnoreCase("INVALID"))
- return INVALID;
+ if (state.equalsIgnoreCase("ANY")) return ANY;
+ if (state.equalsIgnoreCase("VALID")) return VALID;
+ if (state.equalsIgnoreCase("INVALID")) return INVALID;
return null;
}
}
+