summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/key
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2014-02-21 21:24:39 -0500
committerAde Lee <alee@redhat.com>2014-02-26 01:18:25 -0500
commitee472461f594706b40cedb39e55f167a034c13ee (patch)
tree4b0a800571713e6f6e9ebc88d978d9bab780fb92 /base/common/src/com/netscape/certsrv/key
parent7add259c1220ca4f6fa55ae64447812fdbf83132 (diff)
downloadpki-ee472461f594706b40cedb39e55f167a034c13ee.tar.gz
pki-ee472461f594706b40cedb39e55f167a034c13ee.tar.xz
pki-ee472461f594706b40cedb39e55f167a034c13ee.zip
Added error checking in python client calls
1) Added error checking in python client calls. 2) Allow symmetric key generation with default params. Fix bug for when usages is not defined. 3) Fix bug when requesting key recovery - must check if key exists. 4) Extend key gen to allow for providing trans_wrapped_session_key 5) added constants to python client for key status
Diffstat (limited to 'base/common/src/com/netscape/certsrv/key')
-rw-r--r--base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
index 01326442f..27dc69fd5 100644
--- a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
@@ -25,6 +25,7 @@ public class SymKeyGenerationRequest extends ResourceMessage {
private static final String KEY_SIZE = "keySize";
private static final String KEY_ALGORITHM = "keyAlgorithm";
private static final String KEY_USAGE = "keyUsage";
+ private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey";
/* Symmetric Key usages */
public static final String UWRAP_USAGE = "unwrap";
@@ -65,6 +66,7 @@ public class SymKeyGenerationRequest extends ResourceMessage {
attributes.put(KEY_SIZE, form.getFirst(KEY_SIZE));
attributes.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM));
attributes.put(KEY_USAGE, form.getFirst(KEY_USAGE));
+ attributes.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY));
String usageString = attributes.get(KEY_USAGE);
if (! StringUtils.isBlank(usageString)) {
@@ -96,7 +98,11 @@ public class SymKeyGenerationRequest extends ResourceMessage {
* @return the keySize
*/
public Integer getKeySize() {
- return new Integer(attributes.get(KEY_SIZE));
+ try {
+ return new Integer(attributes.get(KEY_SIZE));
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
/**
@@ -120,6 +126,20 @@ public class SymKeyGenerationRequest extends ResourceMessage {
attributes.put(KEY_ALGORITHM, keyAlgorithm);
}
+ /**
+ * @return the transWrappedSessionKey
+ */
+ public String getTransWrappedSessionKey() {
+ return attributes.get(TRANS_WRAPPED_SESSION_KEY);
+ }
+
+ /**
+ * @param transWrappedSessionKey the wrapped seesion key to set
+ */
+ public void setTransWrappedSessionKey(String transWrappedSessionKey) {
+ attributes.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey);
+ }
+
public String toString() {
try {
return ResourceMessage.marshal(this, SymKeyGenerationRequest.class);