001 /* 002 * Cumulus4j - Securing your data in the cloud - http://cumulus4j.org 003 * Copyright (C) 2011 NightLabs Consulting GmbH 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 package org.cumulus4j.keymanager.front.shared; 019 020 import java.io.Serializable; 021 import java.util.Date; 022 023 import javax.xml.bind.annotation.XmlRootElement; 024 025 /** 026 * Response sent back from the key-server to the client after it requested opening a session. 027 * This might not necessarily 028 * represent a new session as a previously opened session might just be refreshed and reused. 029 * 030 * @author Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de 031 */ 032 @XmlRootElement 033 public class AcquireCryptoSessionResponse implements Serializable 034 { 035 private static final long serialVersionUID = 1L; 036 037 private String cryptoSessionID; 038 039 private Date expiry; 040 041 /** 042 * <p> 043 * Get the crypto-session's unique identifier. 044 * </p> 045 * <p> 046 * This identifier is composed of 3 parts: 047 * </p> 048 * <ul> 049 * <li><code>cryptoSessionIDPrefix</code>: A random ID of the key server. This is used to optimize communication between app-server 050 * and key server. A new prefix is generated at every startup of the key server. 051 * </li> 052 * <li>Separator '.': A dot is used as separator.</li> 053 * <li>The rest of the cryptoSessionID, which is unique within the scope of the prefix.</li> 054 * </ul> 055 * <p> 056 * Note, that this identifier is structurally the same, no matter if the key-manager is embedded in the client 057 * or separate in a key-server. 058 * </p> 059 * 060 * @return the crypto-session's unique identifier. 061 * @see #setCryptoSessionID(String) 062 */ 063 public String getCryptoSessionID() { 064 return cryptoSessionID; 065 } 066 /** 067 * Set the crypto-session's unique identifier. See {@link #getCryptoSessionID()} for 068 * how such an identifier must look like. 069 * @param cryptoSessionID the crypto-session's unique identifier. 070 * @see #getCryptoSessionID() 071 */ 072 public void setCryptoSessionID(String cryptoSessionID) { 073 this.cryptoSessionID = cryptoSessionID; 074 } 075 076 /** 077 * Get the timestamp, when this session expires. The session expires only, if it is not refreshed 078 * before this date (refreshing postpones the expiry). 079 * @return the timestamp, when this session expires. 080 * @see #setExpiry(Date) 081 */ 082 public Date getExpiry() { 083 return expiry; 084 } 085 /** 086 * Set the timestamp, when this session expires. 087 * @param expiry the timestamp, when this session expires. 088 * @see #getExpiry() 089 */ 090 public void setExpiry(Date expiry) { 091 this.expiry = expiry; 092 } 093 094 }