summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2014-02-03 13:19:46 -0500
committerAde Lee <alee@redhat.com>2014-02-04 13:37:57 -0500
commitcf425dfa25bccb467c63b9a966adf3a7eec791df (patch)
tree469ec668473730d9dc23e327ce444ee61373e702 /base
parentd33998c72a34dc9f04e29ce0248fc2b7b88e0fc5 (diff)
downloadpki-cf425dfa25bccb467c63b9a966adf3a7eec791df.tar.gz
pki-cf425dfa25bccb467c63b9a966adf3a7eec791df.tar.xz
pki-cf425dfa25bccb467c63b9a966adf3a7eec791df.zip
Address review comments
1. Remove Link attribute from ResourceMessage, 2. Rename KeyDataInfo and KeyDataInfoCollection. 3. Move KEYGEN_ALGORITHMS 4. Fix missing space in PKIException 5. Move properties to attributes in ResourceMessage 6. Add missing code to update the request and set IRequest.RESULT
Diffstat (limited to 'base')
-rw-r--r--base/common/src/com/netscape/certsrv/base/PKIException.java6
-rw-r--r--base/common/src/com/netscape/certsrv/base/ResourceMessage.java86
-rw-r--r--base/common/src/com/netscape/certsrv/base/UserNotFoundException.java4
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java4
-rw-r--r--base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java4
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java20
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyClient.java2
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyInfo.java (renamed from base/common/src/com/netscape/certsrv/key/KeyDataInfo.java)6
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyInfoCollection.java (renamed from base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java)6
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java44
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyResource.java2
-rw-r--r--base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java52
-rw-r--r--base/common/src/com/netscape/certsrv/kra/KRAClient.java14
-rw-r--r--base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java4
-rw-r--r--base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java4
-rw-r--r--base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java4
-rw-r--r--base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java10
-rw-r--r--base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java6
-rw-r--r--base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java5
-rw-r--r--base/kra/src/com/netscape/kra/SecurityDataService.java2
-rw-r--r--base/kra/src/com/netscape/kra/SymKeyGenService.java6
-rw-r--r--base/server/cms/src/com/netscape/cms/servlet/key/KeyRequestDAO.java3
-rw-r--r--base/server/cms/src/com/netscape/cms/servlet/key/KeyService.java14
-rw-r--r--base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java16
24 files changed, 163 insertions, 161 deletions
diff --git a/base/common/src/com/netscape/certsrv/base/PKIException.java b/base/common/src/com/netscape/certsrv/base/PKIException.java
index 65ff6db8e..f1f377352 100644
--- a/base/common/src/com/netscape/certsrv/base/PKIException.java
+++ b/base/common/src/com/netscape/certsrv/base/PKIException.java
@@ -84,7 +84,7 @@ public class PKIException extends RuntimeException {
}
@XmlRootElement(name="PKIException")
- public static class Data extends ResourceMessage{
+ public static class Data extends ResourceMessage {
@XmlElement(name="Code")
public int code;
@@ -111,8 +111,8 @@ public class PKIException extends RuntimeException {
data.className = PKIException.class.getName();
data.code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
data.message = "An error has occured";
- data.setProperty("attr1", "value1");
- data.setProperty("attr2", "value2");
+ data.setAttribute("attr1", "value1");
+ data.setAttribute("attr2", "value2");
JAXBContext context = JAXBContext.newInstance(Data.class);
Marshaller marshaller = context.createMarshaller();
diff --git a/base/common/src/com/netscape/certsrv/base/ResourceMessage.java b/base/common/src/com/netscape/certsrv/base/ResourceMessage.java
index dd2f48078..57b5539b8 100644
--- a/base/common/src/com/netscape/certsrv/base/ResourceMessage.java
+++ b/base/common/src/com/netscape/certsrv/base/ResourceMessage.java
@@ -20,16 +20,13 @@ import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.jboss.resteasy.plugins.providers.atom.Link;
-
/**
* @author Ade Lee
*/
@XmlRootElement(name="ResourceMessage")
public class ResourceMessage {
- protected Map<String, String> properties = new LinkedHashMap<String, String>();
- Link link;
+ protected Map<String, String> attributes = new LinkedHashMap<String, String>();
String className;
public ResourceMessage() {
@@ -38,7 +35,7 @@ public class ResourceMessage {
public ResourceMessage(MultivaluedMap<String, String> form) {
for (Map.Entry<String, List<String>> entry: form.entrySet()) {
- properties.put(entry.getKey(), entry.getValue().get(0));
+ attributes.put(entry.getKey(), entry.getValue().get(0));
}
}
@@ -51,61 +48,61 @@ public class ResourceMessage {
this.className = className;
}
- @XmlElement(name = "Properties")
+ @XmlElement(name = "Attributes")
@XmlJavaTypeAdapter(MapAdapter.class)
- public Map<String, String> getProperties() {
- return properties;
+ public Map<String, String> getAttributes() {
+ return attributes;
}
- public void setProperties(Map<String, String> properties) {
- this.properties.clear();
- this.properties.putAll(properties);
+ public void setAttributes(Map<String, String> attributes) {
+ this.attributes.clear();
+ this.attributes.putAll(attributes);
}
- public Collection<String> getPropertyNames() {
- return properties.keySet();
+ public Collection<String> getAttributeNames() {
+ return attributes.keySet();
}
- public String getProperty(String name) {
- return properties.get(name);
+ public String getAttribute(String name) {
+ return attributes.get(name);
}
- public void setProperty(String name, String value) {
- properties.put(name, value);
+ public void setAttribute(String name, String value) {
+ attributes.put(name, value);
}
- public String removeProperty(String name) {
- return properties.remove(name);
+ public String removeAttribute(String name) {
+ return attributes.remove(name);
}
- public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> {
+ public static class MapAdapter extends XmlAdapter<AttributeList, Map<String, String>> {
- public PropertyList marshal(Map<String, String> map) {
- PropertyList list = new PropertyList();
+ public AttributeList marshal(Map<String, String> map) {
+ AttributeList list = new AttributeList();
for (Map.Entry<String, String> entry : map.entrySet()) {
- Property property = new Property();
- property.name = entry.getKey();
- property.value = entry.getValue();
- list.properties.add(property);
+ Attribute attribute = new Attribute();
+ attribute.name = entry.getKey();
+ attribute.value = entry.getValue();
+ list.attrs.add(attribute);
}
return list;
}
- public Map<String, String> unmarshal(PropertyList list) {
+ public Map<String, String> unmarshal(AttributeList list) {
Map<String, String> map = new LinkedHashMap<String, String>();
- for (Property property : list.properties) {
- map.put(property.name, property.value);
+ for (Attribute attribute : list.attrs) {
+ map.put(attribute.name, attribute.value);
}
return map;
}
}
- public static class PropertyList {
- @XmlElement(name = "Property")
- public List<Property> properties = new ArrayList<Property>();
+ public static class AttributeList {
+ @XmlElement(name = "Attribute")
+ public List<Attribute> attrs = new ArrayList<Attribute>();
}
- public static class Property {
+ public static class Attribute {
@XmlAttribute
public String name;
@@ -114,21 +111,11 @@ public class ResourceMessage {
public String value;
}
- @XmlElement(name = "Link")
- public Link getLink() {
- return link;
- }
-
- public void setLink(Link link) {
- this.link = link;
- }
-
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((link == null) ? 0 : link.hashCode());
- result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ result = prime * result + ((attributes == null) ? 0 : attributes.hashCode());
result = prime * result + ((className == null) ? 0 : className.hashCode());
return result;
}
@@ -142,15 +129,10 @@ public class ResourceMessage {
if (getClass() != obj.getClass())
return false;
ResourceMessage other = (ResourceMessage) obj;
- if (link == null) {
- if (other.link != null)
- return false;
- } else if (!link.equals(other.link))
- return false;
- if (properties == null) {
- if (other.properties != null)
+ if (attributes == null) {
+ if (other.attributes != null)
return false;
- } else if (!properties.equals(other.properties))
+ } else if (!attributes.equals(other.attributes))
return false;
if (className == null) {
if (other.className != null)
diff --git a/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java b/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java
index ec14b59aa..63df7067a 100644
--- a/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java
+++ b/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java
@@ -21,12 +21,12 @@ public class UserNotFoundException extends ResourceNotFoundException {
public UserNotFoundException(Data data) {
super(data);
- userId = data.getProperty("userId");
+ userId = data.getAttribute("userId");
}
public Data getData() {
Data data = super.getData();
- data.setProperty("userId", userId);
+ data.setAttribute("userId", userId);
return data;
}
diff --git a/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java b/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java
index 5b694ad15..171c2763d 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java
@@ -42,12 +42,12 @@ public class CertNotFoundException extends ResourceNotFoundException {
public CertNotFoundException(Data data) {
super(data);
- certId = new CertId(data.getProperty("certId"));
+ certId = new CertId(data.getAttribute("certId"));
}
public Data getData() {
Data data = super.getData();
- data.setProperty("certId", certId.toString());
+ data.setAttribute("certId", certId.toString());
return data;
}
diff --git a/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java b/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java
index c5167db8f..3bd9241b6 100644
--- a/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java
+++ b/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java
@@ -23,12 +23,12 @@ public class GroupNotFoundException extends ResourceNotFoundException {
public GroupNotFoundException(Data data) {
super(data);
- groupId = data.getProperty("groupId");
+ groupId = data.getAttribute("groupId");
}
public Data getData() {
Data data = super.getData();
- data.setProperty("groupId", groupId);
+ data.setAttribute("groupId", groupId);
return data;
}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
index c72bad4b9..1655fdb28 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
@@ -46,14 +46,14 @@ public class KeyArchivalRequest extends ResourceMessage {
}
public KeyArchivalRequest(MultivaluedMap<String, String> form) {
- properties.put(CLIENT_ID, form.getFirst(CLIENT_ID));
- properties.put(DATA_TYPE, form.getFirst(DATA_TYPE));
- properties.put(WRAPPED_PRIVATE_DATA, form.getFirst(WRAPPED_PRIVATE_DATA));
+ attributes.put(CLIENT_ID, form.getFirst(CLIENT_ID));
+ attributes.put(DATA_TYPE, form.getFirst(DATA_TYPE));
+ attributes.put(WRAPPED_PRIVATE_DATA, form.getFirst(WRAPPED_PRIVATE_DATA));
setClassName(getClass().getName());
}
public KeyArchivalRequest(ResourceMessage data) {
- properties.putAll(data.getProperties());
+ attributes.putAll(data.getAttributes());
setClassName(getClass().getName());
}
@@ -61,42 +61,42 @@ public class KeyArchivalRequest extends ResourceMessage {
* @return the clientId
*/
public String getClientId() {
- return properties.get(CLIENT_ID);
+ return attributes.get(CLIENT_ID);
}
/**
* @param clientId the clientId to set
*/
public void setClientId(String clientId) {
- properties.put(CLIENT_ID, clientId);
+ attributes.put(CLIENT_ID, clientId);
}
/**
* @return the dataType
*/
public String getDataType() {
- return properties.get(DATA_TYPE);
+ return attributes.get(DATA_TYPE);
}
/**
* @param dataType the dataType to set
*/
public void setDataType(String dataType) {
- properties.put(DATA_TYPE, dataType);
+ attributes.put(DATA_TYPE, dataType);
}
/**
* @return the wrappedPrivateData
*/
public String getWrappedPrivateData() {
- return properties.get(WRAPPED_PRIVATE_DATA);
+ return attributes.get(WRAPPED_PRIVATE_DATA);
}
/**
* @param wrappedPrivateData the wrappedPrivateData to set
*/
public void setWrappedPrivateData(String wrappedPrivateData) {
- properties.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData);
+ attributes.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData);
}
public String toString() {
diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java
index 06c7cfd79..280b10c49 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyClient.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java
@@ -44,7 +44,7 @@ public class KeyClient extends Client {
keyRequestClient = createProxy(KeyRequestResource.class);
}
- public KeyDataInfoCollection findKeys(String clientID, String status, Integer maxSize, Integer maxTime,
+ public KeyInfoCollection findKeys(String clientID, String status, Integer maxSize, Integer maxTime,
Integer start, Integer size) {
return keyClient.listKeys(clientID, status, maxSize, maxTime, start, size);
}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfo.java b/base/common/src/com/netscape/certsrv/key/KeyInfo.java
index 09d228718..a4f4e62f3 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyDataInfo.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyInfo.java
@@ -32,9 +32,9 @@ import com.netscape.certsrv.dbs.keydb.KeyId;
* @author alee
*
*/
-@XmlRootElement(name="KeyDataInfo")
+@XmlRootElement(name="KeyInfo")
@XmlAccessorType(XmlAccessType.FIELD)
-public class KeyDataInfo {
+public class KeyInfo {
@XmlElement
protected String keyURL;
@@ -54,7 +54,7 @@ public class KeyDataInfo {
@XmlElement
protected String ownerName;
- public KeyDataInfo() {
+ public KeyInfo() {
// required for JAXB (defaults)
}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java b/base/common/src/com/netscape/certsrv/key/KeyInfoCollection.java
index 4e67e2a44..3d411da69 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyInfoCollection.java
@@ -24,11 +24,11 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.netscape.certsrv.base.DataCollection;
-@XmlRootElement(name = "KeyDataInfos")
-public class KeyDataInfoCollection extends DataCollection<KeyDataInfo> {
+@XmlRootElement(name = "KeyInfoCollection")
+public class KeyInfoCollection extends DataCollection<KeyInfo> {
@XmlElementRef
- public Collection<KeyDataInfo> getEntries() {
+ public Collection<KeyInfo> getEntries() {
return super.getEntries();
}
}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
index 4b521a57c..e12b414b1 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
@@ -53,21 +53,21 @@ public class KeyRecoveryRequest extends ResourceMessage {
public KeyRecoveryRequest(MultivaluedMap<String, String> form) {
if (form.containsKey(KEY_ID)) {
- properties.put(KEY_ID, form.getFirst(KEY_ID));
+ attributes.put(KEY_ID, form.getFirst(KEY_ID));
}
if (form.containsKey(REQUEST_ID)) {
- properties.put(REQUEST_ID, form.getFirst(REQUEST_ID));
+ attributes.put(REQUEST_ID, form.getFirst(REQUEST_ID));
}
- properties.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY));
- properties.put(SESSION_WRAPPED_PASSPHRASE, form.getFirst(SESSION_WRAPPED_PASSPHRASE));
- properties.put(NONCE_DATA, form.getFirst(NONCE_DATA));
- properties.put(CERTIFICATE, form.getFirst(CERTIFICATE));
- properties.put(PASSPHRASE, form.getFirst(PASSPHRASE));
+ attributes.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY));
+ attributes.put(SESSION_WRAPPED_PASSPHRASE, form.getFirst(SESSION_WRAPPED_PASSPHRASE));
+ attributes.put(NONCE_DATA, form.getFirst(NONCE_DATA));
+ attributes.put(CERTIFICATE, form.getFirst(CERTIFICATE));
+ attributes.put(PASSPHRASE, form.getFirst(PASSPHRASE));
setClassName(getClass().getName());
}
public KeyRecoveryRequest(ResourceMessage data) {
- properties.putAll(data.getProperties());
+ attributes.putAll(data.getAttributes());
setClassName(getClass().getName());
}
@@ -75,56 +75,56 @@ public class KeyRecoveryRequest extends ResourceMessage {
* @return the keyId
*/
public KeyId getKeyId() {
- return new KeyId(properties.get(KEY_ID));
+ return new KeyId(attributes.get(KEY_ID));
}
/**
* @param keyId the keyId to set
*/
public void setKeyId(KeyId keyId) {
- properties.put(KEY_ID, keyId.toString());
+ attributes.put(KEY_ID, keyId.toString());
}
/**
* @return the requestId
*/
public RequestId getRequestId() {
- return new RequestId(properties.get(REQUEST_ID));
+ return new RequestId(attributes.get(REQUEST_ID));
}
/**
* @param requestId the requestId to set
*/
public void setRequestId(RequestId requestId) {
- properties.put(REQUEST_ID, requestId.toString());
+ attributes.put(REQUEST_ID, requestId.toString());
}
/**
* @return the transWrappedSessionKey
*/
public String getTransWrappedSessionKey() {
- return properties.get(TRANS_WRAPPED_SESSION_KEY);
+ return attributes.get(TRANS_WRAPPED_SESSION_KEY);
}
/**
* @param transWrappedSessionKey the transWrappedSessionKey to set
*/
public void setTransWrappedSessionKey(String transWrappedSessionKey) {
- properties.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey);
+ attributes.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey);
}
/**
* @return the sessionWrappedPassphrase
*/
public String getSessionWrappedPassphrase() {
- return properties.get(SESSION_WRAPPED_PASSPHRASE);
+ return attributes.get(SESSION_WRAPPED_PASSPHRASE);
}
/**
* @param sessionWrappedPassphrase the sessionWrappedPassphrase to set
*/
public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) {
- properties.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase);
+ attributes.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase);
}
/**
@@ -132,7 +132,7 @@ public class KeyRecoveryRequest extends ResourceMessage {
*/
public String getNonceData() {
- return properties.get(NONCE_DATA);
+ return attributes.get(NONCE_DATA);
}
/**
@@ -140,35 +140,35 @@ public class KeyRecoveryRequest extends ResourceMessage {
*/
public void setNonceData(String nonceData) {
- properties.put(NONCE_DATA, nonceData);
+ attributes.put(NONCE_DATA, nonceData);
}
/**
* @return the certificate
*/
public String getCertificate() {
- return properties.get(CERTIFICATE);
+ return attributes.get(CERTIFICATE);
}
/**
* @param certificate the certificate to set
*/
public void setCertificate(String certificate) {
- properties.put(CERTIFICATE, certificate);
+ attributes.put(CERTIFICATE, certificate);
}
/**
* @return the passphrase
*/
public String getPassphrase() {
- return properties.get(PASSPHRASE);
+ return attributes.get(PASSPHRASE);
}
/**
* @param passphrase the passphrase to set
*/
public void setPassphrase(String passphrase) {
- properties.put(PASSPHRASE, passphrase);
+ attributes.put(PASSPHRASE, passphrase);
}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyResource.java b/base/common/src/com/netscape/certsrv/key/KeyResource.java
index 68efb7770..04d57fd2b 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyResource.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyResource.java
@@ -20,7 +20,7 @@ public interface KeyResource {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public KeyDataInfoCollection listKeys(@QueryParam("clientID") String clientID,
+ public KeyInfoCollection listKeys(@QueryParam("clientID") String clientID,
@QueryParam("status") String status,
@QueryParam("maxResults") Integer maxResults,
@QueryParam("maxTime") Integer maxTime,
diff --git a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
index 88f3e2381..f9feb6410 100644
--- a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
@@ -2,9 +2,7 @@ package com.netscape.certsrv.key;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.ws.rs.core.MultivaluedMap;
import javax.xml.bind.annotation.XmlAccessType;
@@ -12,7 +10,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.StringUtils;
-import org.mozilla.jss.crypto.KeyGenAlgorithm;
import com.netscape.certsrv.base.ResourceMessage;
@@ -29,6 +26,14 @@ public class SymKeyGenerationRequest extends ResourceMessage {
private static final String KEY_ALGORITHM = "keyAlgorithm";
private static final String KEY_USAGE = "keyUsage";
+ /* Symmetric Key Algorithms */
+ public static final String DES_ALGORITHM = "DES";
+ public static final String DESEDE_ALGORITHM = "DESede";
+ public static final String DES3_ALGORITHM = "DES3";
+ public static final String RC2_ALGORITHM = "RC2";
+ public static final String RC4_ALGORITHM = "RC4";
+ public static final String AES_ALGORITHM = "AES";
+
/* Symmetric Key usages */
public static final String UWRAP_USAGE = "unwrap";
public static final String WRAP_USAGE = "wrap";
@@ -37,19 +42,8 @@ public class SymKeyGenerationRequest extends ResourceMessage {
public static final String DECRYPT_USAGE = "decrypt";
public static final String ENCRYPT_USAGE = "encrypt";
- public static final Map<String, KeyGenAlgorithm> KEYGEN_ALGORITHMS;
- static {
- KEYGEN_ALGORITHMS = new HashMap<String, KeyGenAlgorithm>();
- KEYGEN_ALGORITHMS.put("DES", KeyGenAlgorithm.DES);
- KEYGEN_ALGORITHMS.put("DESede", KeyGenAlgorithm.DESede);
- KEYGEN_ALGORITHMS.put("DES3", KeyGenAlgorithm.DES3);
- KEYGEN_ALGORITHMS.put("RC2", KeyGenAlgorithm.RC2);
- KEYGEN_ALGORITHMS.put("RC4", KeyGenAlgorithm.RC4);
- KEYGEN_ALGORITHMS.put("AES", KeyGenAlgorithm.AES);
- }
-
public List<String> getUsages() {
- String usageString = properties.get(KEY_USAGE);
+ String usageString = attributes.get(KEY_USAGE);
if (! StringUtils.isBlank(usageString)) {
return new ArrayList<String>(Arrays.asList(usageString.split(",")));
}
@@ -57,7 +51,7 @@ public class SymKeyGenerationRequest extends ResourceMessage {
}
public void setUsages(List<String> usages) {
- properties.put(KEY_USAGE, StringUtils.join(usages, ","));
+ attributes.put(KEY_USAGE, StringUtils.join(usages, ","));
}
public void addUsage(String usage) {
@@ -75,12 +69,12 @@ public class SymKeyGenerationRequest extends ResourceMessage {
}
public SymKeyGenerationRequest(MultivaluedMap<String, String> form) {
- properties.put(CLIENT_ID, form.getFirst(CLIENT_ID));
- properties.put(KEY_SIZE, form.getFirst(KEY_SIZE));
- properties.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM));
- properties.put(KEY_USAGE, form.getFirst(KEY_USAGE));
+ attributes.put(CLIENT_ID, form.getFirst(CLIENT_ID));
+ attributes.put(KEY_SIZE, form.getFirst(KEY_SIZE));
+ attributes.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM));
+ attributes.put(KEY_USAGE, form.getFirst(KEY_USAGE));
- String usageString = properties.get(KEY_USAGE);
+ String usageString = attributes.get(KEY_USAGE);
if (! StringUtils.isBlank(usageString)) {
setUsages(new ArrayList<String>(Arrays.asList(usageString.split(","))));
}
@@ -88,7 +82,7 @@ public class SymKeyGenerationRequest extends ResourceMessage {
}
public SymKeyGenerationRequest(ResourceMessage data) {
- properties.putAll(data.getProperties());
+ attributes.putAll(data.getAttributes());
setClassName(getClass().getName());
}
@@ -96,42 +90,42 @@ public class SymKeyGenerationRequest extends ResourceMessage {
* @return the clientId
*/
public String getClientId() {
- return properties.get(CLIENT_ID);
+ return attributes.get(CLIENT_ID);
}
/**
* @param clientId the clientId to set
*/
public void setClientId(String clientId) {
- properties.put(CLIENT_ID, clientId);
+ attributes.put(CLIENT_ID, clientId);
}
/**
* @return the keySize
*/
public int getKeySize() {
- return Integer.parseInt(properties.get(KEY_SIZE));
+ return Integer.parseInt(attributes.get(KEY_SIZE));
}
/**
* @param keySize the key size to set
*/
public void setKeySize(int keySize) {
- properties.put(KEY_SIZE, Integer.toString(keySize));
+ attributes.put(KEY_SIZE, Integer.toString(keySize));
}
/**
* @return the keyAlgorithm
*/
public String getKeyAlgorithm() {
- return properties.get(KEY_ALGORITHM);
+ return attributes.get(KEY_ALGORITHM);
}
/**
* @param keyAlgorithm the key algorithm to set
*/
public void setKeyAlgorithm(String keyAlgorithm) {
- properties.put(KEY_ALGORITHM, keyAlgorithm);
+ attributes.put(KEY_ALGORITHM, keyAlgorithm);
}
public String toString() {
@@ -154,7 +148,7 @@ public class SymKeyGenerationRequest extends ResourceMessage {
SymKeyGenerationRequest before = new SymKeyGenerationRequest();
before.setClientId("vek 12345");
- before.setKeyAlgorithm("AES");
+ before.setKeyAlgorithm(SymKeyGenerationRequest.AES_ALGORITHM);
before.setKeySize(128);
before.addUsage(SymKeyGenerationRequest.DECRYPT_USAGE);
before.addUsage(SymKeyGenerationRequest.ENCRYPT_USAGE);
diff --git a/base/common/src/com/netscape/certsrv/kra/KRAClient.java b/base/common/src/com/netscape/certsrv/kra/KRAClient.java
index 2522820f4..943a6f21f 100644
--- a/base/common/src/com/netscape/certsrv/kra/KRAClient.java
+++ b/base/common/src/com/netscape/certsrv/kra/KRAClient.java
@@ -14,8 +14,8 @@ import com.netscape.certsrv.dbs.keydb.KeyId;
import com.netscape.certsrv.group.GroupClient;
import com.netscape.certsrv.key.KeyArchivalRequest;
import com.netscape.certsrv.key.KeyData;
-import com.netscape.certsrv.key.KeyDataInfo;
-import com.netscape.certsrv.key.KeyDataInfoCollection;
+import com.netscape.certsrv.key.KeyInfo;
+import com.netscape.certsrv.key.KeyInfoCollection;
import com.netscape.certsrv.key.KeyRecoveryRequest;
import com.netscape.certsrv.key.KeyRequestInfo;
import com.netscape.certsrv.key.KeyRequestInfoCollection;
@@ -83,13 +83,13 @@ public class KRAClient extends SubsystemClient {
return client.getEntity(response);
}
- public KeyDataInfo getKeyData(String clientId, String status) {
- KeyDataInfoCollection infos = keyClient.listKeys(clientId, status, null, null, null, null);
- Collection<KeyDataInfo> list = infos.getEntries();
- Iterator<KeyDataInfo> iter = list.iterator();
+ public KeyInfo getKeyData(String clientId, String status) {
+ KeyInfoCollection infos = keyClient.listKeys(clientId, status, null, null, null, null);
+ Collection<KeyInfo> list = infos.getEntries();
+ Iterator<KeyInfo> iter = list.iterator();
while (iter.hasNext()) {
- KeyDataInfo info = iter.next();
+ KeyInfo info = iter.next();
if (info != null) {
// return the first one
return info;
diff --git a/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java b/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java
index 25c6d4bfd..c6a549b07 100644
--- a/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java
+++ b/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java
@@ -41,12 +41,12 @@ public class ProfileNotFoundException extends ResourceNotFoundException {
public ProfileNotFoundException(Data data) {
super(data);
- profileId = data.getProperty("profileId");
+ profileId = data.getAttribute("profileId");
}
public Data getData() {
Data data = super.getData();
- data.setProperty("profileId", profileId);
+ data.setAttribute("profileId", profileId);
return data;
}
diff --git a/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java b/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java
index d1032dc2b..478675ab0 100644
--- a/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java
+++ b/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java
@@ -24,12 +24,12 @@ public class RequestNotFoundException extends ResourceNotFoundException {
public RequestNotFoundException(Data data) {
super(data);
- requestId = new RequestId(data.getProperty("requestId"));
+ requestId = new RequestId(data.getAttribute("requestId"));
}
public Data getData() {
Data data = super.getData();
- data.setProperty("requestId", requestId.toString());
+ data.setAttribute("requestId", requestId.toString());
return data;
}
diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java
index e93cc32f0..f205506aa 100644
--- a/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java
@@ -19,7 +19,7 @@
package com.netscape.cmstools.key;
import com.netscape.certsrv.key.KeyClient;
-import com.netscape.certsrv.key.KeyDataInfo;
+import com.netscape.certsrv.key.KeyInfo;
import com.netscape.certsrv.key.KeyRequestInfo;
import com.netscape.cmstools.cli.CLI;
import com.netscape.cmstools.cli.MainCLI;
@@ -61,7 +61,7 @@ public class KeyCLI extends CLI {
super.execute(args);
}
- public static void printKeyInfo(KeyDataInfo info) {
+ public static void printKeyInfo(KeyInfo info) {
System.out.println(" Key ID: "+info.getKeyId().toHexString());
if (info.getClientID() != null) System.out.println(" Client ID: "+info.getClientID());
if (info.getStatus() != null) System.out.println(" Status: "+info.getStatus());
diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java
index b2eb0ce38..f3c9badbd 100644
--- a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java
@@ -24,8 +24,8 @@ import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.ParseException;
-import com.netscape.certsrv.key.KeyDataInfo;
-import com.netscape.certsrv.key.KeyDataInfoCollection;
+import com.netscape.certsrv.key.KeyInfo;
+import com.netscape.certsrv.key.KeyInfoCollection;
import com.netscape.cmstools.cli.CLI;
import com.netscape.cmstools.cli.MainCLI;
@@ -97,15 +97,15 @@ public class KeyFindCLI extends CLI {
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- KeyDataInfoCollection keys = keyCLI.keyClient.findKeys(clientID, status, maxResults, maxTime, start, size);
+ KeyInfoCollection keys = keyCLI.keyClient.findKeys(clientID, status, maxResults, maxTime, start, size);
- Collection<KeyDataInfo> entries = keys.getEntries();
+ Collection<KeyInfo> entries = keys.getEntries();
MainCLI.printMessage(entries.size() + " key(s) matched");
boolean first = true;
- for (KeyDataInfo info : entries) {
+ for (KeyInfo info : entries) {
if (first) {
first = false;
diff --git a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
index d0773950f..e1e730d82 100644
--- a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
+++ b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
@@ -43,7 +43,7 @@ import com.netscape.certsrv.client.ClientConfig;
import com.netscape.certsrv.client.PKIClient;
import com.netscape.certsrv.dbs.keydb.KeyId;
import com.netscape.certsrv.key.KeyData;
-import com.netscape.certsrv.key.KeyDataInfo;
+import com.netscape.certsrv.key.KeyInfo;
import com.netscape.certsrv.key.KeyRequestInfo;
import com.netscape.certsrv.key.KeyRequestResource;
import com.netscape.certsrv.key.SymKeyGenerationRequest;
@@ -168,7 +168,7 @@ public class DRMTest {
// Variables for data structures from calls
KeyRequestInfo requestInfo = null;
KeyData keyData = null;
- KeyDataInfo keyInfo = null;
+ KeyInfo keyInfo = null;
// Initialize token
try {
@@ -560,7 +560,7 @@ public class DRMTest {
List<String> usages = new ArrayList<String>();
usages.add(SymKeyGenerationRequest.DECRYPT_USAGE);
usages.add(SymKeyGenerationRequest.ENCRYPT_USAGE);
- KeyRequestInfo genKeyInfo = client.generateKey(clientId, "AES", 128, usages);
+ KeyRequestInfo genKeyInfo = client.generateKey(clientId, SymKeyGenerationRequest.AES_ALGORITHM, 128, usages);
printRequestInfo(genKeyInfo);
keyId = genKeyInfo.getKeyId();
diff --git a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
index 0ec4ed335..50f163dfa 100644
--- a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
+++ b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
@@ -264,7 +264,10 @@ public class SecurityDataRecoveryService implements IService {
params.put(IRequest.SECURITY_DATA_IV_STRING_OUT, ivStr);
}
- auditRecoveryRequestProcessed(subjectID, ILogger.SUCCESS, requestID, serialno.toString(), "None");
+ auditRecoveryRequestProcessed(subjectID, ILogger.SUCCESS, requestID, serialno.toString(),
+ "None");
+ request.setExtData(IRequest.RESULT, IRequest.RES_SUCCESS);
+ mKRA.getRequestQueue().updateRequest(request);
return false; //return true ? TODO
}
diff --git a/base/kra/src/com/netscape/kra/SecurityDataService.java b/base/kra/src/com/netscape/kra/SecurityDataService.java
index 9fc737529..428dd660b 100644
--- a/base/kra/src/com/netscape/kra/SecurityDataService.java
+++ b/base/kra/src/com/netscape/kra/SecurityDataService.java
@@ -183,6 +183,8 @@ public class SecurityDataService implements IService {
auditArchivalRequestProcessed(subjectID, ILogger.SUCCESS, request.getRequestId(),
clientId, serialNo.toString(), "None");
+ request.setExtData(IRequest.RESULT, IRequest.RES_SUCCESS);
+ mKRA.getRequestQueue().updateRequest(request);
return true;
diff --git a/base/kra/src/com/netscape/kra/SymKeyGenService.java b/base/kra/src/com/netscape/kra/SymKeyGenService.java
index 877d2ed06..3ebf1bed0 100644
--- a/base/kra/src/com/netscape/kra/SymKeyGenService.java
+++ b/base/kra/src/com/netscape/kra/SymKeyGenService.java
@@ -44,6 +44,7 @@ import com.netscape.certsrv.request.IRequest;
import com.netscape.certsrv.request.IService;
import com.netscape.certsrv.request.RequestId;
import com.netscape.certsrv.security.IStorageKeyUnit;
+import com.netscape.cms.servlet.request.KeyRequestService;
import com.netscape.cmscore.dbs.KeyRecord;
/**
@@ -110,7 +111,7 @@ public class SymKeyGenService implements IService {
}
CryptoToken token = mStorageUnit.getToken();
- KeyGenAlgorithm kgAlg = SymKeyGenerationRequest.KEYGEN_ALGORITHMS.get(algorithm);
+ KeyGenAlgorithm kgAlg = KeyRequestService.KEYGEN_ALGORITHMS.get(algorithm);
if (kgAlg == null) {
throw new EBaseException("Invalid algorithm");
}
@@ -216,6 +217,9 @@ public class SymKeyGenService implements IService {
auditSymKeyGenRequestProcessed(subjectID, ILogger.SUCCESS, request.getRequestId(),
clientId, serialNo.toString(), "None");
+ request.setExtData(IRequest.RESULT, IRequest.RES_SUCCESS);
+ mKRA.getRequestQueue().updateRequest(request);
+
return true;
}
diff --git a/base/server/cms/src/com/netscape/cms/servlet/key/KeyRequestDAO.java b/base/server/cms/src/com/netscape/cms/servlet/key/KeyRequestDAO.java
index 8ecf11074..536e43fc0 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/key/KeyRequestDAO.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/key/KeyRequestDAO.java
@@ -50,6 +50,7 @@ import com.netscape.certsrv.request.IRequest;
import com.netscape.certsrv.request.RequestId;
import com.netscape.certsrv.request.RequestStatus;
import com.netscape.cms.servlet.request.CMSRequestDAO;
+import com.netscape.cms.servlet.request.KeyRequestService;
/**
* @author alee
@@ -218,7 +219,7 @@ public class KeyRequestDAO extends CMSRequestDAO {
throw new BadRequestException("Can not archive already active existing key!");
}
- KeyGenAlgorithm alg = SymKeyGenerationRequest.KEYGEN_ALGORITHMS.get(algName);
+ KeyGenAlgorithm alg = KeyRequestService.KEYGEN_ALGORITHMS.get(algName);
if (alg == null) {
throw new BadRequestException("Invalid Algorithm");
}
diff --git a/base/server/cms/src/com/netscape/cms/servlet/key/KeyService.java b/base/server/cms/src/com/netscape/cms/servlet/key/KeyService.java
index fdcd7d7c5..56e4f3c4d 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/key/KeyService.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/key/KeyService.java
@@ -47,8 +47,8 @@ import com.netscape.certsrv.dbs.keydb.IKeyRecord;
import com.netscape.certsrv.dbs.keydb.IKeyRepository;
import com.netscape.certsrv.dbs.keydb.KeyId;
import com.netscape.certsrv.key.KeyData;
-import com.netscape.certsrv.key.KeyDataInfo;
-import com.netscape.certsrv.key.KeyDataInfoCollection;
+import com.netscape.certsrv.key.KeyInfo;
+import com.netscape.certsrv.key.KeyInfoCollection;
import com.netscape.certsrv.key.KeyRecoveryRequest;
import com.netscape.certsrv.key.KeyRequestInfo;
import com.netscape.certsrv.key.KeyResource;
@@ -312,7 +312,7 @@ public class KeyService extends PKIService implements KeyResource {
* Used to generate list of key infos based on the search parameters
*/
@Override
- public KeyDataInfoCollection listKeys(String clientID, String status, Integer maxResults, Integer maxTime,
+ public KeyInfoCollection listKeys(String clientID, String status, Integer maxResults, Integer maxTime,
Integer start, Integer size) {
start = start == null ? 0 : start;
@@ -325,7 +325,7 @@ public class KeyService extends PKIService implements KeyResource {
maxResults = maxResults == null ? DEFAULT_MAXRESULTS : maxResults;
maxTime = maxTime == null ? DEFAULT_MAXTIME : maxTime;
- KeyDataInfoCollection infos = new KeyDataInfoCollection();
+ KeyInfoCollection infos = new KeyInfoCollection();
try {
Enumeration<IKeyRecord> e = repo.searchKeys(filter, maxResults, maxTime);
if (e == null) {
@@ -333,7 +333,7 @@ public class KeyService extends PKIService implements KeyResource {
}
// store non-null results in a list
- List<KeyDataInfo> results = new ArrayList<KeyDataInfo>();
+ List<KeyInfo> results = new ArrayList<KeyInfo>();
while (e.hasMoreElements()) {
IKeyRecord rec = e.nextElement();
if (rec == null) continue;
@@ -367,8 +367,8 @@ public class KeyService extends PKIService implements KeyResource {
}
- public KeyDataInfo createKeyDataInfo(IKeyRecord rec) throws EBaseException {
- KeyDataInfo ret = new KeyDataInfo();
+ public KeyInfo createKeyDataInfo(IKeyRecord rec) throws EBaseException {
+ KeyInfo ret = new KeyInfo();
ret.setClientID(rec.getClientId());
ret.setStatus(rec.getKeyStatus());
ret.setAlgorithm(rec.getAlgorithm());
diff --git a/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java b/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java
index dc24a4c0e..fccfaaab4 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java
@@ -23,6 +23,8 @@ import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.cert.CertificateException;
+import java.util.HashMap;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;
@@ -35,6 +37,8 @@ import javax.ws.rs.core.UriInfo;
import netscape.security.x509.X509CertImpl;
+import org.mozilla.jss.crypto.KeyGenAlgorithm;
+
import com.netscape.certsrv.apps.CMS;
import com.netscape.certsrv.base.BadRequestException;
import com.netscape.certsrv.base.EBaseException;
@@ -98,6 +102,18 @@ public class KeyRequestService extends PKIService implements KeyRequestResource
private IRequestQueue queue;
private IKeyService service;
+ public static final Map<String, KeyGenAlgorithm> KEYGEN_ALGORITHMS;
+
+ static {
+ KEYGEN_ALGORITHMS = new HashMap<String, KeyGenAlgorithm>();
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.DES_ALGORITHM, KeyGenAlgorithm.DES);
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.DESEDE_ALGORITHM, KeyGenAlgorithm.DESede);
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.DES3_ALGORITHM, KeyGenAlgorithm.DES3);
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.RC2_ALGORITHM, KeyGenAlgorithm.RC2);
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.RC4_ALGORITHM, KeyGenAlgorithm.RC4);
+ KEYGEN_ALGORITHMS.put(SymKeyGenerationRequest.AES_ALGORITHM, KeyGenAlgorithm.AES);
+ }
+
public KeyRequestService() {
kra = ( IKeyRecoveryAuthority ) CMS.getSubsystem( "kra" );
queue = kra.getRequestQueue();