Package org.bouncycastle.tls
Class ServerName
- java.lang.Object
-
- org.bouncycastle.tls.ServerName
-
public final class ServerName extends java.lang.Object
RFC 6066 3. Server Name Indication Current implementation uses this guidance: "For backward compatibility, all future data structures associated with new NameTypes MUST begin with a 16-bit length field. TLS MAY treat provided server names as opaque data and pass the names and types to the application." RFC 6066 specifies ASCII encoding for host_name (possibly using A-labels for IDNs), but note that the previous version (RFC 4366) specified UTF-8 encoding (see RFC 6066 Appendix A). For maximum compatibility, it is recommended that client code tolerate receiving UTF-8 from the peer, but only generate ASCII itself.
-
-
Constructor Summary
Constructors Constructor Description ServerName(short nameType, byte[] nameData)
ServerName(short nameType, java.lang.Object name)
Deprecated.UseServerName(short, byte[])
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
encode(java.io.OutputStream output)
Encode thisServerName
to anOutputStream
.java.lang.String
getHostName()
Deprecated.UsegetNameData()
instead.byte[]
getNameData()
short
getNameType()
static ServerName
parse(java.io.InputStream input)
Parse aServerName
from anInputStream
.
-
-
-
Constructor Detail
-
ServerName
public ServerName(short nameType, java.lang.Object name)
Deprecated.UseServerName(short, byte[])
instead.
-
ServerName
public ServerName(short nameType, byte[] nameData)
-
-
Method Detail
-
getNameType
public short getNameType()
-
getNameData
public byte[] getNameData()
-
getHostName
public java.lang.String getHostName()
Deprecated.UsegetNameData()
instead.A convenience method for returning a host_name as a UTF-8 string. Note that this method does not attempt to recognize Internationalized Domain Names (see RFC 5890); further processing may be required to support them.
-
encode
public void encode(java.io.OutputStream output) throws java.io.IOException
Encode thisServerName
to anOutputStream
.- Parameters:
output
- theOutputStream
to encode to.- Throws:
java.io.IOException
-
parse
public static ServerName parse(java.io.InputStream input) throws java.io.IOException
Parse aServerName
from anInputStream
.- Parameters:
input
- theInputStream
to parse from.- Returns:
- a
ServerName
object. - Throws:
java.io.IOException
-
-