public abstract class ChannelBinding
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()));
}
}
ChannelBindings,
ChannelBindingType,
TLSUniqueChannelBinding,
TLSServerEndPointChannelBinding| Constructor and Description |
|---|
ChannelBinding(ChannelBindingType type)
Creates a new ChannelBinding for the given type.
|
ChannelBinding(ChannelBindingType type,
byte[] data)
Creates a new ChannelBinding for given type and data.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Gets a clone of this ChannelBinding.
|
boolean |
equals(java.lang.Object obj)
Checks if this channel binding is equal to the given object.
|
ChannelBindingType |
getChannelBindingType()
Gets the type of the channel binding.
|
byte[] |
getData()
Gets the data of this channel binding.
|
java.lang.String |
getName()
Gets the type name of the channel binding.
|
int |
getType()
Gets the type of the channel binding as int.
|
int |
hashCode()
Gets a hash code of the channel binding.
|
java.lang.String |
toString()
Gets a String representation of the channel binding.
|
java.lang.String |
toString(boolean detailed)
Gets a String representation of the channel binding.
|
public ChannelBinding(ChannelBindingType type)
type - the type of the ChannelBindingpublic ChannelBinding(ChannelBindingType type, byte[] data)
type - the type of the ChannelBindingdata - the channel binding data (will not be cloned!)public ChannelBindingType getChannelBindingType()
public int getType()
public java.lang.String getName()
public byte[] getData()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objecttrue if this channel binding is equal to the
given object, false if it is not equal
to itpublic 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 - whether to included the channel binding data in the String output