public class ChannelBindings
extends java.lang.Object
implements java.lang.Cloneable
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 byadding 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()));
}
}
ChannelBinding,
ChannelBindingType,
TLSUniqueChannelBinding,
TLSServerEndPointChannelBinding| Constructor and Description |
|---|
ChannelBindings()
Default Constructor.
|
ChannelBindings(ChannelBinding[] channelBindings)
Creates an ChannelBindings for the given ChannelBindings.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public ChannelBindings()
ChannelBindings list.
Use method addChannelBinding
to add ChannelBindings to the list.public ChannelBindings(ChannelBinding[] channelBindings)
channelBindings - the ChannelBindings for this ChannelBindings listpublic ChannelBinding addChannelBinding(ChannelBinding channelBinding)
channelBinding - the ChannelBinding to be addednull if there has yet not been included any
ChannelBinding with the same typejava.lang.NullPointerException - if the given ChannelBinding is nullpublic ChannelBinding removeChannelBinding(ChannelBindingType channelBindingType)
channelBindingType - the type of the ChannelBinding to be removednull if no ChannelBinding with the given type
was includedpublic void removeAllChannelBindings()
public java.util.List listChannelBindings()
public boolean hasChannelBindings()
true if there are ChannelBinding objects included,
false if notpublic int countChannelBindings()
public ChannelBinding getChannelBinding(ChannelBindingType channelBindingType)
channelBindingType - the type of the ChannelBindingnull if no ChannelBinding
with the given type is included in this ChannelBindingspublic boolean containsChannelBinding(ChannelBindingType channelBindingType)
channelBindingType - the type of the ChannelBindingtrue if a ChannelBinding of the given type is
included, false if it is not includedpublic java.util.List getChannelBindingTypes()
public java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean detailed)
detailed - true to include the contents of the ChannelBindings
false to only dump the ChannelBinding types