iaik.security.ssl.chb
Class ChannelBindings

java.lang.Object
  extended by iaik.security.ssl.chb.ChannelBindings
All Implemented Interfaces:
java.lang.Cloneable

public class ChannelBindings
extends java.lang.Object
implements java.lang.Cloneable

This class represents a list of ChannelBindings.

Currently two channel bindings are implemented according to RFC 5929:

An application that is interested to capture some particular channel binding value(s) has to announce its interest by adding a list of channel bindings to the SSLContext object, e.g.:
 ChannelBindings channelBindings = new ChannelBindings();
 channelBindings.addChannelBinding(new TLSUniqueChannelBinding());
 channelBindings.addChannelBinding(new TLSServerEndPointChannelBinding());
 context.setChannelBindings(channelBindings);
 
After having completed the handshake the channel binding values can be obtained from the SSLSocket:
 ChannelBindings chBndgs = socket.getChannelBindings();
 if (chBndgs != null) {
   TLSUniqueChannelBinding tlsUnique = (TLSUniqueChannelBinding)chBndgs.getChannelBinding(TLSUniqueChannelBinding.TYPE);
   if (tlsUnique != null) {
     System.out.println("tls-unique: " + Util.toString(tlsUnique.getData()));
   }
   TLSServerEndPointChannelBinding tlsServerEndPoint = (TLSServerEndPointChannelBinding)chBndgs.getChannelBinding(TLSServerEndPointChannelBinding.TYPE);
   if (tlsServerEndPoint != null) {
     System.out.println("tls-server-end-point: " + Util.toString(tlsServerEndPoint.getData()));
   }
 }  
 

Version:
File Revision 26
See Also:
ChannelBinding, ChannelBindingType, TLSUniqueChannelBinding, TLSServerEndPointChannelBinding

Constructor Summary
ChannelBindings()
          Default Constructor.
ChannelBindings(ChannelBinding[] channelBindings)
          Creates an ChannelBindings for the given ChannelBindings.
 
Method Summary
 ChannelBinding addChannelBinding(ChannelBinding channelBinding)
          Adds an ChannelBinding to this ChannelBindings.
 java.lang.Object clone()
          Gets a clone of this ChannelBinding.
 boolean containsChannelBinding(ChannelBindingType channelBindingType)
          Checks whether a ChannelBinding of the given type is included.
 int countChannelBindings()
          Gets the number of ChannelBinding objects included in this ChannelBindings.
 ChannelBinding getChannelBinding(ChannelBindingType channelBindingType)
          Gets a particular ChannelBinding, specified by its type.
 java.util.List getChannelBindingTypes()
          Gets list containing the types of the ChannelBinding objects contained in this ChannelBindings.
 boolean hasChannelBindings()
          Checks, if there are any ChannelBinding objects included in this ChannelBindings.
 java.util.List listChannelBindings()
          Returns a List of all ChannelBinding objects included in this ChannelBindings.
 void removeAllChannelBindings()
          Removes all ChannelBindings currently included in this ChannelBindings.
 ChannelBinding removeChannelBinding(ChannelBindingType channelBindingType)
          Removes an ChannelBinding, identified by its type.
 java.lang.String toString()
          Gets a string that represents the contents of the ChannelBindings.
 java.lang.String toString(boolean detailed)
          Gets a string that represents the contents of the ChannelBindings.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChannelBindings

public ChannelBindings()
Default Constructor. Creates an empty ChannelBindings list. Use method addChannelBinding to add ChannelBindings to the list.


ChannelBindings

public ChannelBindings(ChannelBinding[] channelBindings)
Creates an ChannelBindings for the given ChannelBindings.

Parameters:
channelBindings - the ChannelBindings for this ChannelBindings list
Method Detail

addChannelBinding

public ChannelBinding addChannelBinding(ChannelBinding channelBinding)
Adds an ChannelBinding to this ChannelBindings.
If there already exists an ChannelBinding with the same type it is replaced by the new ChannelBinding.

Parameters:
channelBinding - the ChannelBinding to be added
Returns:
the old ChannelBinding if an ChannelBinding with the same type has been replaced, or null if there has yet not been included any ChannelBinding with the same type
Throws:
java.lang.NullPointerException - if the given ChannelBinding is null

removeChannelBinding

public ChannelBinding removeChannelBinding(ChannelBindingType channelBindingType)
Removes an ChannelBinding, identified by its type.

Parameters:
channelBindingType - the type of the ChannelBinding to be removed
Returns:
the ChannelBinding that has been removed, or null if no ChannelBinding with the given type was included

removeAllChannelBindings

public void removeAllChannelBindings()
Removes all ChannelBindings currently included in this ChannelBindings.


listChannelBindings

public java.util.List listChannelBindings()
Returns a List of all ChannelBinding objects included in this ChannelBindings.

Returns:
an List of the included ChannelBindings; the List maybe empty if no ChannelBinding objects are included in this ChannelBindings

hasChannelBindings

public boolean hasChannelBindings()
Checks, if there are any ChannelBinding objects included in this ChannelBindings.

Returns:
true if there are ChannelBinding objects included, false if not

countChannelBindings

public int countChannelBindings()
Gets the number of ChannelBinding objects included in this ChannelBindings.

Returns:
the number of ChannelBinding objects

getChannelBinding

public ChannelBinding getChannelBinding(ChannelBindingType channelBindingType)
Gets a particular ChannelBinding, specified by its type.

Parameters:
channelBindingType - the type of the ChannelBinding
Returns:
the ChannelBinding, or null if no ChannelBinding with the given type is included in this ChannelBindings

containsChannelBinding

public boolean containsChannelBinding(ChannelBindingType channelBindingType)
Checks whether a ChannelBinding of the given type is included.

Parameters:
channelBindingType - the type of the ChannelBinding
Returns:
true if a ChannelBinding of the given type is included, false if it is not included

getChannelBindingTypes

public java.util.List getChannelBindingTypes()
Gets list containing the types of the ChannelBinding objects contained in this ChannelBindings.

Returns:
list containing the types of the ChannelBinding objects contained in this ChannelBindings; the list maybe empty if no ChannelBinding objects are included in this ChannelBindings

clone

public java.lang.Object clone()
Gets a clone of this ChannelBinding.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this ChannelBinding

toString

public java.lang.String toString()
Gets a string that represents the contents of the ChannelBindings.

Overrides:
toString in class java.lang.Object
Returns:
the string representation

toString

public java.lang.String toString(boolean detailed)
Gets a string that represents the contents of the ChannelBindings.

Parameters:
detailed - true to include the contents of the ChannelBindings false to only dump the ChannelBinding types
Returns:
the string representation

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

iSaSiLk 6.0, (c) 2002 IAIK, (c) 2003 - 2015 SIC