diff options
Diffstat (limited to 'base/common/src/com/netscape/certsrv/key/KeyClient.java')
-rw-r--r-- | base/common/src/com/netscape/certsrv/key/KeyClient.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java index 97793ab39..9363a6a8c 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyClient.java +++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java @@ -195,7 +195,8 @@ public class KeyClient extends Client { if (id == null || status == null) { throw new IllegalArgumentException("Key Id and status must be specified."); } - if ((!status.equalsIgnoreCase(KeyResource.KEY_STATUS_ACTIVE)) && (!status.equalsIgnoreCase(KeyResource.KEY_STATUS_INACTIVE))) { + if (!status.equalsIgnoreCase(KeyResource.KEY_STATUS_ACTIVE) + && !status.equalsIgnoreCase(KeyResource.KEY_STATUS_INACTIVE)) { throw new IllegalArgumentException("Invalid status value."); } Response response = keyClient.modifyKeyStatus(id, status); @@ -670,7 +671,15 @@ public class KeyClient extends Client { if (clientKeyId == null) { throw new IllegalArgumentException("Client Key Identifier must be specified."); } - + //Validate the usages list + List<String> validUsages = SymKeyGenerationRequest.getValidUsagesList(); + if (usages != null) { + for (String usage : usages) { + if (!validUsages.contains(usage)) { + throw new IllegalArgumentException("Invalid usage \"" + usage + "\" specified."); + } + } + } SymKeyGenerationRequest data = new SymKeyGenerationRequest(); data.setClientKeyId(clientKeyId); data.setKeyAlgorithm(keyAlgorithm); |