From 1aa02e5207514d210e903d23e1d698b85fc29344 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Sat, 11 Aug 2012 09:47:39 -0500 Subject: Reorganized REST common classes. The common classes used by REST client and services have been moved into the com.netscape.certsrv. packages. Ticket #215 --- .../netscape/certsrv/key/KeyRecoveryRequest.java | 155 +++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java (limited to 'base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java') diff --git a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java new file mode 100644 index 000000000..d14f61241 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java @@ -0,0 +1,155 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2011 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +/** + * + */ +package com.netscape.certsrv.key; + +import javax.ws.rs.core.MultivaluedMap; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.dbs.keydb.KeyIdAdapter; +import com.netscape.certsrv.request.RequestId; +import com.netscape.certsrv.request.RequestIdAdapter; + +/** + * @author alee + * + */ +@XmlRootElement(name="KeyRecoveryRequest") +@XmlAccessorType(XmlAccessType.FIELD) +public class KeyRecoveryRequest { + + private static final String KEY_ID = "keyId"; + private static final String REQUEST_ID = "requestId"; + private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey"; + private static final String SESSION_WRAPPED_PASSPHRASE = "sessionWrappedPassphrase"; + private static final String NONCE_DATA = "nonceData"; + + @XmlElement + @XmlJavaTypeAdapter(KeyIdAdapter.class) + protected KeyId keyId; + + @XmlElement + @XmlJavaTypeAdapter(RequestIdAdapter.class) + protected RequestId requestId; + + @XmlElement + protected String transWrappedSessionKey; + + @XmlElement + protected String sessionWrappedPassphrase; + + @XmlElement + protected String nonceData; + + public KeyRecoveryRequest() { + // required for JAXB (defaults) + } + + public KeyRecoveryRequest(MultivaluedMap form) { + if (form.containsKey(KEY_ID)) { + keyId = new KeyId(form.getFirst(KEY_ID)); + } + if (form.containsKey(REQUEST_ID)) { + requestId = new RequestId(form.getFirst(REQUEST_ID)); + } + transWrappedSessionKey = form.getFirst(TRANS_WRAPPED_SESSION_KEY); + sessionWrappedPassphrase = form.getFirst(SESSION_WRAPPED_PASSPHRASE); + nonceData = form.getFirst(NONCE_DATA); + } + + /** + * @return the keyId + */ + public KeyId getKeyId() { + return keyId; + } + + /** + * @param keyId the keyId to set + */ + public void setKeyId(KeyId keyId) { + this.keyId = keyId; + } + + /** + * @return the requestId + */ + public RequestId getRequestId() { + return requestId; + } + + /** + * @param requestId the requestId to set + */ + public void setRequestId(RequestId requestId) { + this.requestId = requestId; + } + + /** + * @return the transWrappedSessionKey + */ + public String getTransWrappedSessionKey() { + return transWrappedSessionKey; + } + + /** + * @param transWrappedSessionKey the transWrappedSessionKey to set + */ + public void setTransWrappedSessionKey(String transWrappedSessionKey) { + this.transWrappedSessionKey = transWrappedSessionKey; + } + + /** + * @return the sessionWrappedPassphrase + */ + public String getSessionWrappedPassphrase() { + return sessionWrappedPassphrase; + } + + /** + * @param sessionWrappedPassphrase the sessionWrappedPassphrase to set + */ + public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) { + this.sessionWrappedPassphrase = sessionWrappedPassphrase; + } + + /** + * @return nonceData + */ + + public String getNonceData() { + return nonceData; + } + + /** + * @param nonceData the nonceData to set + */ + + public void setNonceData(String nonceData) { + this.nonceData = nonceData; + } + +} -- cgit