summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/key
diff options
context:
space:
mode:
Diffstat (limited to 'base/common/src/com/netscape/certsrv/key')
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java32
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyClient.java3
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java56
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyRequest.java178
-rw-r--r--base/common/src/com/netscape/certsrv/key/KeyRequestResource.java8
-rw-r--r--base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java36
6 files changed, 77 insertions, 236 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
index 9a8d29131..c72bad4b9 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java
@@ -26,13 +26,15 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import com.netscape.certsrv.base.ResourceMessage;
+
/**
* @author alee
*
*/
@XmlRootElement(name="KeyArchivalRequest")
@XmlAccessorType(XmlAccessType.FIELD)
-public class KeyArchivalRequest extends KeyRequest {
+public class KeyArchivalRequest extends ResourceMessage {
private static final String CLIENT_ID = "clientID";
private static final String DATA_TYPE = "dataType";
@@ -40,12 +42,19 @@ public class KeyArchivalRequest extends KeyRequest {
public KeyArchivalRequest() {
// required for JAXB (defaults)
+ setClassName(getClass().getName());
}
public KeyArchivalRequest(MultivaluedMap<String, String> form) {
- this.properties.put(CLIENT_ID, form.getFirst(CLIENT_ID));
- this.properties.put(DATA_TYPE, form.getFirst(DATA_TYPE));
- this.properties.put(WRAPPED_PRIVATE_DATA, form.getFirst(WRAPPED_PRIVATE_DATA));
+ 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));
+ setClassName(getClass().getName());
+ }
+
+ public KeyArchivalRequest(ResourceMessage data) {
+ properties.putAll(data.getProperties());
+ setClassName(getClass().getName());
}
/**
@@ -59,40 +68,40 @@ public class KeyArchivalRequest extends KeyRequest {
* @param clientId the clientId to set
*/
public void setClientId(String clientId) {
- this.properties.put(CLIENT_ID, clientId);
+ properties.put(CLIENT_ID, clientId);
}
/**
* @return the dataType
*/
public String getDataType() {
- return this.properties.get(DATA_TYPE);
+ return properties.get(DATA_TYPE);
}
/**
* @param dataType the dataType to set
*/
public void setDataType(String dataType) {
- this.properties.put(DATA_TYPE, dataType);
+ properties.put(DATA_TYPE, dataType);
}
/**
* @return the wrappedPrivateData
*/
public String getWrappedPrivateData() {
- return this.properties.get(WRAPPED_PRIVATE_DATA);
+ return properties.get(WRAPPED_PRIVATE_DATA);
}
/**
* @param wrappedPrivateData the wrappedPrivateData to set
*/
public void setWrappedPrivateData(String wrappedPrivateData) {
- this.properties.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData);
+ properties.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData);
}
public String toString() {
try {
- return KeyRequest.marshal(this, KeyArchivalRequest.class);
+ return ResourceMessage.marshal(this, KeyArchivalRequest.class);
} catch (Exception e) {
return super.toString();
}
@@ -100,7 +109,7 @@ public class KeyArchivalRequest extends KeyRequest {
public static KeyArchivalRequest valueOf(String string) throws Exception {
try {
- return KeyRequest.unmarshal(string, KeyArchivalRequest.class);
+ return ResourceMessage.unmarshal(string, KeyArchivalRequest.class);
} catch (Exception e) {
return null;
}
@@ -111,7 +120,6 @@ public class KeyArchivalRequest extends KeyRequest {
KeyArchivalRequest before = new KeyArchivalRequest();
before.setClientId("vek 12345");
before.setDataType(KeyRequestResource.SYMMETRIC_KEY_TYPE);
- before.setRequestType(KeyRequestResource.ARCHIVAL_REQUEST);
before.setWrappedPrivateData("XXXXABCDEFXXX");
String string = before.toString();
diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java
index 5faab6faf..06c7cfd79 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyClient.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
import org.jboss.resteasy.client.ClientResponse;
+import com.netscape.certsrv.base.ResourceMessage;
import com.netscape.certsrv.client.Client;
import com.netscape.certsrv.client.PKIClient;
import com.netscape.certsrv.request.RequestId;
@@ -70,7 +71,7 @@ public class KeyClient extends Client {
maxTime);
}
- public KeyRequestInfo createRequest(KeyRequest data) {
+ public KeyRequestInfo createRequest(ResourceMessage data) {
@SuppressWarnings("unchecked")
ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>) keyRequestClient.createRequest(data);
return response.getEntity();
diff --git a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
index 74f4bcd44..4b521a57c 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import com.netscape.certsrv.base.ResourceMessage;
import com.netscape.certsrv.dbs.keydb.KeyId;
import com.netscape.certsrv.request.RequestId;
@@ -35,7 +36,7 @@ import com.netscape.certsrv.request.RequestId;
*/
@XmlRootElement(name="KeyRecoveryRequest")
@XmlAccessorType(XmlAccessType.FIELD)
-public class KeyRecoveryRequest extends KeyRequest {
+public class KeyRecoveryRequest extends ResourceMessage {
private static final String KEY_ID = "keyId";
private static final String REQUEST_ID = "requestId";
@@ -47,77 +48,83 @@ public class KeyRecoveryRequest extends KeyRequest {
public KeyRecoveryRequest() {
// required for JAXB (defaults)
+ setClassName(getClass().getName());
}
public KeyRecoveryRequest(MultivaluedMap<String, String> form) {
if (form.containsKey(KEY_ID)) {
- this.properties.put(KEY_ID, form.getFirst(KEY_ID));
+ properties.put(KEY_ID, form.getFirst(KEY_ID));
}
if (form.containsKey(REQUEST_ID)) {
- this.properties.put(REQUEST_ID, form.getFirst(REQUEST_ID));
+ properties.put(REQUEST_ID, form.getFirst(REQUEST_ID));
}
- this.properties.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY));
- this.properties.put(SESSION_WRAPPED_PASSPHRASE, form.getFirst(SESSION_WRAPPED_PASSPHRASE));
- this.properties.put(NONCE_DATA, form.getFirst(NONCE_DATA));
- this.properties.put(CERTIFICATE, form.getFirst(CERTIFICATE));
- this.properties.put(PASSPHRASE, form.getFirst(PASSPHRASE));
+ 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));
+ setClassName(getClass().getName());
+ }
+ public KeyRecoveryRequest(ResourceMessage data) {
+ properties.putAll(data.getProperties());
+ setClassName(getClass().getName());
}
/**
* @return the keyId
*/
public KeyId getKeyId() {
- return new KeyId(this.properties.get(KEY_ID));
+ return new KeyId(properties.get(KEY_ID));
}
/**
* @param keyId the keyId to set
*/
public void setKeyId(KeyId keyId) {
- this.properties.put(KEY_ID, keyId.toString());
+ properties.put(KEY_ID, keyId.toString());
}
/**
* @return the requestId
*/
public RequestId getRequestId() {
- return new RequestId(this.properties.get(REQUEST_ID));
+ return new RequestId(properties.get(REQUEST_ID));
}
/**
* @param requestId the requestId to set
*/
public void setRequestId(RequestId requestId) {
- this.properties.put(REQUEST_ID, requestId.toString());
+ properties.put(REQUEST_ID, requestId.toString());
}
/**
* @return the transWrappedSessionKey
*/
public String getTransWrappedSessionKey() {
- return this.properties.get(TRANS_WRAPPED_SESSION_KEY);
+ return properties.get(TRANS_WRAPPED_SESSION_KEY);
}
/**
* @param transWrappedSessionKey the transWrappedSessionKey to set
*/
public void setTransWrappedSessionKey(String transWrappedSessionKey) {
- this.properties.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey);
+ properties.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey);
}
/**
* @return the sessionWrappedPassphrase
*/
public String getSessionWrappedPassphrase() {
- return this.properties.get(SESSION_WRAPPED_PASSPHRASE);
+ return properties.get(SESSION_WRAPPED_PASSPHRASE);
}
/**
* @param sessionWrappedPassphrase the sessionWrappedPassphrase to set
*/
public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) {
- this.properties.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase);
+ properties.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase);
}
/**
@@ -125,7 +132,7 @@ public class KeyRecoveryRequest extends KeyRequest {
*/
public String getNonceData() {
- return this.properties.get(NONCE_DATA);
+ return properties.get(NONCE_DATA);
}
/**
@@ -133,41 +140,41 @@ public class KeyRecoveryRequest extends KeyRequest {
*/
public void setNonceData(String nonceData) {
- this.properties.put(NONCE_DATA, nonceData);
+ properties.put(NONCE_DATA, nonceData);
}
/**
* @return the certificate
*/
public String getCertificate() {
- return this.properties.get(CERTIFICATE);
+ return properties.get(CERTIFICATE);
}
/**
* @param certificate the certificate to set
*/
public void setCertificate(String certificate) {
- this.properties.put(CERTIFICATE, certificate);
+ properties.put(CERTIFICATE, certificate);
}
/**
* @return the passphrase
*/
public String getPassphrase() {
- return this.properties.get(PASSPHRASE);
+ return properties.get(PASSPHRASE);
}
/**
* @param passphrase the passphrase to set
*/
public void setPassphrase(String passphrase) {
- this.properties.put(PASSPHRASE, passphrase);
+ properties.put(PASSPHRASE, passphrase);
}
public static KeyRecoveryRequest valueOf(String string) throws Exception {
try {
- return KeyRequest.unmarshal(string, KeyRecoveryRequest.class);
+ return ResourceMessage.unmarshal(string, KeyRecoveryRequest.class);
} catch (Exception e) {
return null;
}
@@ -175,7 +182,7 @@ public class KeyRecoveryRequest extends KeyRequest {
public String toString() {
try {
- return KeyRequest.marshal(this, KeyRecoveryRequest.class);
+ return ResourceMessage.marshal(this, KeyRecoveryRequest.class);
} catch (Exception e) {
return super.toString();
}
@@ -191,7 +198,6 @@ public class KeyRecoveryRequest extends KeyRequest {
before.setCertificate("123ABCAAAA");
before.setSessionWrappedPassphrase("XXXXXXXX1234");
before.setTransWrappedSessionKey("124355AAA");
- before.setRequestType(KeyRequestResource.RECOVERY_REQUEST);
String string = before.toString();
System.out.println(string);
diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequest.java b/base/common/src/com/netscape/certsrv/key/KeyRequest.java
deleted file mode 100644
index 364136877..000000000
--- a/base/common/src/com/netscape/certsrv/key/KeyRequest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.netscape.certsrv.key;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.MultivaluedMap;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-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
- */
-public class KeyRequest {
-
- Map<String, String> properties = new LinkedHashMap<String, String>();
- Link link;
- String requestType;
-
- public KeyRequest() {
- // required for jax-b
- }
-
- public KeyRequest(MultivaluedMap<String, String> form) {
- for (Map.Entry<String, List<String>> entry: form.entrySet()) {
- properties.put(entry.getKey(), entry.getValue().get(0));
- }
- }
-
- @XmlElement(name = "RequestType")
- public String getRequestType() {
- return requestType;
- }
-
- public void setRequestType(String requestType) {
- this.requestType = requestType;
- }
-
- @XmlElement(name = "Properties")
- @XmlJavaTypeAdapter(MapAdapter.class)
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties.clear();
- this.properties.putAll(properties);
- }
-
- public Collection<String> getPropertyNames() {
- return properties.keySet();
- }
-
- public String getProperty(String name) {
- return properties.get(name);
- }
-
- public void setProperty(String name, String value) {
- properties.put(name, value);
- }
-
- public String removeProperty(String name) {
- return properties.remove(name);
- }
-
- public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> {
-
- public PropertyList marshal(Map<String, String> map) {
- PropertyList list = new PropertyList();
- for (Map.Entry<String, String> entry : map.entrySet()) {
- Property property = new Property();
- property.name = entry.getKey();
- property.value = entry.getValue();
- list.properties.add(property);
- }
- return list;
- }
-
- public Map<String, String> unmarshal(PropertyList list) {
- Map<String, String> map = new LinkedHashMap<String, String>();
- for (Property property : list.properties) {
- map.put(property.name, property.value);
- }
- return map;
- }
- }
-
- public static class PropertyList {
- @XmlElement(name = "Property")
- public List<Property> properties = new ArrayList<Property>();
- }
-
- public static class Property {
-
- @XmlAttribute
- public String name;
-
- @XmlValue
- 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 + ((requestType == null) ? 0 : requestType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- KeyRequest other = (KeyRequest) 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)
- return false;
- } else if (!properties.equals(other.properties))
- return false;
- if (requestType == null) {
- if (other.requestType != null)
- return false;
- } else if (!requestType.equals(other.requestType))
- return false;
- return true;
- }
-
- public static <T> String marshal(T object, Class<T> clazz) throws JAXBException {
- Marshaller marshaller = JAXBContext.newInstance(clazz).createMarshaller();
- StringWriter sw = new StringWriter();
- marshaller.marshal(object, sw);
- return sw.toString();
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T unmarshal(String string, Class<T> clazz) throws Exception {
- try {
- Unmarshaller unmarshaller = JAXBContext.newInstance(clazz).createUnmarshaller();
- return (T) unmarshaller.unmarshal(new StringReader(string));
- } catch (Exception e) {
- return null;
- }
- }
-
-}
diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java
index 7531a2425..27f0362a1 100644
--- a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java
+++ b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java
@@ -15,6 +15,7 @@ import org.jboss.resteasy.annotations.ClientResponseType;
import com.netscape.certsrv.acls.ACLMapping;
import com.netscape.certsrv.authentication.AuthMethodMapping;
+import com.netscape.certsrv.base.ResourceMessage;
import com.netscape.certsrv.request.RequestId;
@Path("agent/keyrequests")
@@ -27,11 +28,6 @@ public interface KeyRequestResource {
public static final String PASS_PHRASE_TYPE = "passPhrase";
public static final String ASYMMETRIC_KEY_TYPE = "asymmetricKey";
- /* Request types */
- public static final String ARCHIVAL_REQUEST = "archival";
- public static final String KEY_GENERATION_REQUEST = "keygen";
- public static final String RECOVERY_REQUEST = "recovery";
-
/**
* Used to generate list of key requests based on the search parameters
*/
@@ -55,7 +51,7 @@ public interface KeyRequestResource {
@ClientResponseType(entityType=KeyRequestInfo.class)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response createRequest(KeyRequest data);
+ public Response createRequest(ResourceMessage data);
/**
* Used to retrieve key request info for a specific request
diff --git a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
index ad6ad6b6a..88f3e2381 100644
--- a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
+++ b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java
@@ -14,13 +14,15 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.StringUtils;
import org.mozilla.jss.crypto.KeyGenAlgorithm;
+import com.netscape.certsrv.base.ResourceMessage;
+
/**
* @author alee
*
*/
@XmlRootElement(name="SymKeyGenerationRequest")
@XmlAccessorType(XmlAccessType.FIELD)
-public class SymKeyGenerationRequest extends KeyRequest {
+public class SymKeyGenerationRequest extends ResourceMessage {
private static final String CLIENT_ID = "clientID";
private static final String KEY_SIZE = "keySize";
@@ -55,7 +57,7 @@ public class SymKeyGenerationRequest extends KeyRequest {
}
public void setUsages(List<String> usages) {
- this.properties.put(KEY_USAGE, StringUtils.join(usages, ","));
+ properties.put(KEY_USAGE, StringUtils.join(usages, ","));
}
public void addUsage(String usage) {
@@ -69,18 +71,25 @@ public class SymKeyGenerationRequest extends KeyRequest {
public SymKeyGenerationRequest() {
// required for JAXB (defaults)
+ setClassName(getClass().getName());
}
public SymKeyGenerationRequest(MultivaluedMap<String, String> form) {
- this.properties.put(CLIENT_ID, form.getFirst(CLIENT_ID));
- this.properties.put(KEY_SIZE, form.getFirst(KEY_SIZE));
- this.properties.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM));
- this.properties.put(KEY_USAGE, form.getFirst(KEY_USAGE));
+ 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));
String usageString = properties.get(KEY_USAGE);
if (! StringUtils.isBlank(usageString)) {
setUsages(new ArrayList<String>(Arrays.asList(usageString.split(","))));
}
+ setClassName(getClass().getName());
+ }
+
+ public SymKeyGenerationRequest(ResourceMessage data) {
+ properties.putAll(data.getProperties());
+ setClassName(getClass().getName());
}
/**
@@ -94,40 +103,40 @@ public class SymKeyGenerationRequest extends KeyRequest {
* @param clientId the clientId to set
*/
public void setClientId(String clientId) {
- this.properties.put(CLIENT_ID, clientId);
+ properties.put(CLIENT_ID, clientId);
}
/**
* @return the keySize
*/
public int getKeySize() {
- return Integer.parseInt(this.properties.get(KEY_SIZE));
+ return Integer.parseInt(properties.get(KEY_SIZE));
}
/**
* @param keySize the key size to set
*/
public void setKeySize(int keySize) {
- this.properties.put(KEY_SIZE, Integer.toString(keySize));
+ properties.put(KEY_SIZE, Integer.toString(keySize));
}
/**
* @return the keyAlgorithm
*/
public String getKeyAlgorithm() {
- return this.properties.get(KEY_ALGORITHM);
+ return properties.get(KEY_ALGORITHM);
}
/**
* @param keyAlgorithm the key algorithm to set
*/
public void setKeyAlgorithm(String keyAlgorithm) {
- this.properties.put(KEY_ALGORITHM, keyAlgorithm);
+ properties.put(KEY_ALGORITHM, keyAlgorithm);
}
public String toString() {
try {
- return KeyRequest.marshal(this, SymKeyGenerationRequest.class);
+ return ResourceMessage.marshal(this, SymKeyGenerationRequest.class);
} catch (Exception e) {
return super.toString();
}
@@ -135,7 +144,7 @@ public class SymKeyGenerationRequest extends KeyRequest {
public static SymKeyGenerationRequest valueOf(String string) throws Exception {
try {
- return KeyRequest.unmarshal(string, SymKeyGenerationRequest.class);
+ return ResourceMessage.unmarshal(string, SymKeyGenerationRequest.class);
} catch (Exception e) {
return null;
}
@@ -147,7 +156,6 @@ public class SymKeyGenerationRequest extends KeyRequest {
before.setClientId("vek 12345");
before.setKeyAlgorithm("AES");
before.setKeySize(128);
- before.setRequestType(KeyRequestResource.KEY_GENERATION_REQUEST);
before.addUsage(SymKeyGenerationRequest.DECRYPT_USAGE);
before.addUsage(SymKeyGenerationRequest.ENCRYPT_USAGE);
before.addUsage(SymKeyGenerationRequest.SIGN_USAGE);