Source for javax.net.ssl.SSLSession

   1: /* SSLSession.java -- an SSL session.
   2:    Copyright (C) 2004 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.net.ssl;
  40: 
  41: import java.security.cert.Certificate;
  42: 
  43: import javax.security.cert.X509Certificate;
  44: 
  45: /**
  46:  * An SSL session is a mechanism through which connections can be established
  47:  * by re-using previously negotiated handshakes.
  48:  */
  49: public interface SSLSession
  50: {
  51:   /**
  52:    * Returns this session's cihper suite.
  53:    *
  54:    * @return The cipher suite.
  55:    */
  56:   String getCipherSuite();
  57: 
  58:   /**
  59:    * Returns the time in milliseconds since midnight GMT, 1 January 1970, that
  60:    * this session was created.
  61:    *
  62:    * @return The creation time.
  63:    */
  64:   long getCreationTime();
  65: 
  66:   /**
  67:    * Returns this session's unique identifier, a arbitrary byte array of up
  68:    * to 32 bytes.
  69:    *
  70:    * @return The session identifier.
  71:    */
  72:   byte[] getId();
  73: 
  74:   /**
  75:    * Returns the last time this session was accessed.
  76:    *
  77:    * @return The lest time this session was accessed.
  78:    */
  79:   long getLastAccessedTime();
  80: 
  81:   /**
  82:    * Returns the chain of certificates that the local side used in the
  83:    * handshake, or null if none were used.
  84:    *
  85:    * @return The local certificate chain.
  86:    */
  87:   Certificate[] getLocalCertificates();
  88: 
  89:   /**
  90:    * Returns the chain of certificates that the remote side used in
  91:    * the handshake, or null if none were used.
  92:    *
  93:    * @return The peer's certificate chain.
  94:    * @throws SSLPeerUnverifiedException If the identity of the peer has
  95:    *   not been verified.
  96:    */
  97:   Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException;
  98: 
  99:   /**
 100:    * Returns the chain of certificates that the remote side used in
 101:    * the handshake, or null if none were used.
 102:    *
 103:    * @return The peer's certificate chain.
 104:    * @throws SSLPeerUnverifiedException If the identity of the peer has
 105:    *   not been verified.
 106:    */
 107:   X509Certificate[] getPeerCertificateChain()
 108:     throws SSLPeerUnverifiedException;
 109: 
 110:   /**
 111:    * Returns the remote host's name.
 112:    *
 113:    * @return The name of the remote host.
 114:    */
 115:   String getPeerHost();
 116: 
 117:   /**
 118:    * Returns the protocol this session uses.
 119:    *
 120:    * @return The protocol.
 121:    */
 122:   String getProtocol();
 123: 
 124:   /**
 125:    * Returns this session's session context object.
 126:    *
 127:    * @return The session context.
 128:    * @throws SecurityException If the caller does not have the
 129:    *   {@link SSLPermission} "getSessionContext".
 130:    */
 131:   SSLSessionContext getSessionContext();
 132: 
 133:   /**
 134:    * Returns the names of all values bound to this session.
 135:    *
 136:    * @return The list of bound names.
 137:    */
 138:   String[] getValueNames();
 139: 
 140:   /**
 141:    * Returns the object bound to the given name.
 142:    *
 143:    * @param name The name of the value to get.
 144:    * @return The object bound by that name, or null.
 145:    */
 146:   Object getValue(String name);
 147: 
 148:   /**
 149:    * Invalidates this session, ensuring that it will not be continued by
 150:    * another socket.
 151:    */
 152:   void invalidate();
 153: 
 154:   /**
 155:    * Binds a value to this session, with the given name.
 156:    *
 157:    * @param name The name to bind the object with.
 158:    * @param value The value to bind.
 159:    */
 160:   void putValue(String name, Object value);
 161: 
 162:   /**
 163:    * Un-binds a value.
 164:    *
 165:    * @param name The name of the value to un-bind.
 166:    */
 167:   void removeValue(String name);
 168: }