public final class CertificateMessage extends HandshakeMessage
ServerHello message. For details see RFC 5246.FRAGMENT_LENGTH_BITS, FRAGMENT_OFFSET_BITS, MESSAGE_HEADER_LENGTH_BYTES, MESSAGE_LENGTH_BITS, MESSAGE_SEQ_BITS, MESSAGE_TYPE_BITS| Constructor and Description |
|---|
CertificateMessage(byte[] rawPublicKeyBytes,
InetSocketAddress peerAddress)
Creates a CERTIFICATE message containing a raw public key.
|
CertificateMessage(List<X509Certificate> certificateChain,
InetSocketAddress peerAddress)
Creates a CERTIFICATE message containing a certificate chain.
|
CertificateMessage(List<X509Certificate> certificateChain,
List<X500Principal> certificateAuthorities,
InetSocketAddress peerAddress)
Creates a CERTIFICATE message containing a certificate chain.
|
CertificateMessage(PublicKey publicKey,
InetSocketAddress peerAddress)
Creates a CERTIFICATE message containing a raw public key.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
fragmentToByteArray()
The serialization of the handshake body (without the handshake header).
|
static CertificateMessage |
fromReader(org.eclipse.californium.elements.util.DatagramReader reader,
CertificateType certificateType,
InetSocketAddress peerAddress)
Creates a certificate message from its binary encoding.
|
CertPath |
getCertificateChain()
Gets the certificate chain provided by the peer.
|
int |
getMessageLength()
Must be implemented by each subclass.
|
HandshakeType |
getMessageType()
Returns the type of the handshake message.
|
PublicKey |
getPublicKey()
Gets the public key contained in this message.
|
boolean |
isEmpty()
Is empty certificate message.
|
String |
toString() |
fragmentChanged, fromByteArray, fromGenericHandshakeMessage, getContentType, getFragmentLength, getFragmentOffset, getMessageSeq, getNextHandshakeMessage, getRawMessage, setMessageSeq, setNextHandshakeMessage, size, toByteArray, writeTogetPeerpublic CertificateMessage(List<X509Certificate> certificateChain, InetSocketAddress peerAddress)
certificateChain - the certificate chain with the (first certificate must be the
server's)peerAddress - the IP address and port of the peer this
message has been received from or should be sent toNullPointerException - if the certificate chain is null
(use an array of length zero to create an empty message)IllegalArgumentException - if the certificate chain contains any
non-X.509 certificates or does not form a valid chain of
certification.public CertificateMessage(List<X509Certificate> certificateChain, List<X500Principal> certificateAuthorities, InetSocketAddress peerAddress)
certificateChain - the certificate chain with the (first certificate
must be the server's)certificateAuthorities - the certificate authorities to truncate
chain. Maybe null or empty.peerAddress - the IP address and port of the peer this message has
been received from or should be sent toNullPointerException - if the certificate chain is
null (use an array of length zero to create an
empty message)IllegalArgumentException - if the certificate chain contains any
non-X.509 certificates or does not form a valid chain of
certification.public CertificateMessage(PublicKey publicKey, InetSocketAddress peerAddress)
publicKey - the public keypeerAddress - the IP address and port of the peer this
message has been received from or should be sent topublic CertificateMessage(byte[] rawPublicKeyBytes,
InetSocketAddress peerAddress)
rawPublicKeyBytes - the raw public key (SubjectPublicKeyInfo)peerAddress - the IP address and port of the peer this
message has been received from or should be sent toNullPointerException - if the raw public key byte array is null
(use an array of length zero to create an empty message)public HandshakeType getMessageType()
HandshakeMessageHandshakeType.getMessageType in class HandshakeMessageHandshakeType.public int getMessageLength()
HandshakeMessagegetMessageLength in class HandshakeMessagepublic String toString()
toString in class HandshakeMessagepublic CertPath getCertificateChain()
null if
RawPublicKeys are usedpublic boolean isEmpty()
true, if certificate message contains no certificates,
false, otherwise.public byte[] fragmentToByteArray()
HandshakeMessageClientHello, the
fragments are considered to be not modified. If a modification is required,
call HandshakeMessage.fragmentChanged().fragmentToByteArray in class HandshakeMessagepublic static CertificateMessage fromReader(org.eclipse.californium.elements.util.DatagramReader reader, CertificateType certificateType, InetSocketAddress peerAddress) throws HandshakeException
reader - reader for the binary encoding of the message.certificateType - negotiated type of certificate the certificate message contains.peerAddress - The IP address and port of the peer that sent the message.HandshakeException - if the binary encoding could not be parsed.IllegalArgumentException - if the certificate type is not supported.public PublicKey getPublicKey()
Copyright © 2023 Eclipse Foundation. All rights reserved.