diff options
author | Jack Magne <jmagne@redhat.com> | 2012-01-21 17:39:26 -0800 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-13 15:48:20 -0600 |
commit | a9680c7b7097c6b715c57c6581d4f24a5e4ee8b8 (patch) | |
tree | 8403b15a424a112f4209cba8e78f358bbbfd271e /pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java | |
parent | 2181aa4dbc4f04cb58af4dcc0f827d30f1526d4c (diff) | |
download | pki-a9680c7b7097c6b715c57c6581d4f24a5e4ee8b8.tar.gz pki-a9680c7b7097c6b715c57c6581d4f24a5e4ee8b8.tar.xz pki-a9680c7b7097c6b715c57c6581d4f24a5e4ee8b8.zip |
KRA changes for archiving and recovering symmetric keys and passphrases.
Ticket #66 and #68.
Add ability to archive and recover symmetric keys and passphrases using rest interface.
Enhanced test client to test out new functionality.
Provided support to return recovered data either wrapped by symmetric key or wrapped in PBE password based encryption blob.
DRM symmetric key support cleanup changes.
Consists of suggested cleanup measures based on review comments.
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java b/pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java index 887820c3f..4888d609f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java @@ -18,6 +18,7 @@ package com.netscape.cms.servlet.key; + import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.MultivaluedMap; @@ -73,11 +74,6 @@ public class KeyResourceService extends CMSResourceService implements KeyResourc } private String validateRequest(RecoveryRequestData data) { - // confirm that at least one wrapping method exists - if ((data.getTransWrappedSessionKey() == null) && (data.getTransWrappedSessionKey() == null)) { - // log error - throw new WebApplicationException(Response.Status.BAD_REQUEST); - } // confirm request exists String reqId = data.getRequestId(); @@ -85,6 +81,14 @@ public class KeyResourceService extends CMSResourceService implements KeyResourc // log error throw new WebApplicationException(Response.Status.BAD_REQUEST); } + + // confirm that at least one wrapping method exists + // There must be at least the wrapped session key method. + if ((data.getTransWrappedSessionKey() == null)) { + // log error + throw new WebApplicationException(Response.Status.BAD_REQUEST); + } + KeyRequestDAO reqDAO = new KeyRequestDAO(); KeyRequestInfo reqInfo; try { @@ -117,7 +121,7 @@ public class KeyResourceService extends CMSResourceService implements KeyResourc } String keyURL = reqInfo.getKeyURL(); - return keyURL.substring(keyURL.lastIndexOf("/")); + return keyURL.substring(keyURL.lastIndexOf("/") + 1); } } |