public final class CertificateRequest extends HandshakeMessage
This message, if sent, will immediately follow the ServerKeyExchange message (if it is sent;
otherwise, this message follows the server's CertificateMessage message).
| Modifier and Type | Class and Description |
|---|---|
static class |
CertificateRequest.ClientCertificateType
Certificate types that the client may offer.
|
FRAGMENT_LENGTH_BITS, FRAGMENT_OFFSET_BITS, MESSAGE_HEADER_LENGTH_BYTES, MESSAGE_LENGTH_BITS, MESSAGE_SEQ_BITS, MESSAGE_TYPE_BITS| Constructor and Description |
|---|
CertificateRequest(InetSocketAddress peerAddress)
Initializes an empty certificate request.
|
CertificateRequest(List<CertificateRequest.ClientCertificateType> certificateTypes,
List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms,
List<X500Principal> certificateAuthorities,
InetSocketAddress peerAddress) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCerticiateAuthorities(List<X500Principal> authorities)
Takes a list of trusted certificates, extracts the subject principal and
adds the DER-encoded distinguished name to the certificate authorities.
|
boolean |
addCertificateAuthority(X500Principal authority)
Adds a distinguished name to the list of acceptable certificate authorities.
|
void |
addCertificateType(CertificateRequest.ClientCertificateType certificateType)
Adds a certificate type to the list of supported certificate types.
|
void |
addSignatureAlgorithm(SignatureAndHashAlgorithm signatureAndHashAlgorithm)
Appends a signature and hash algorithm to the end of the list of supported algorithms.
|
void |
addSignatureAlgorithms(List<SignatureAndHashAlgorithm> signatureAndHashAlgorithms)
Appends a list of signature and hash algorithms to the end of the list of supported algorithms.
|
byte[] |
fragmentToByteArray()
The serialization of the handshake body (without the handshake header).
|
static HandshakeMessage |
fromReader(org.eclipse.californium.elements.util.DatagramReader reader,
InetSocketAddress peerAddress)
Parses a certificate request message from its binary encoding.
|
List<X500Principal> |
getCertificateAuthorities()
Gets the distinguished names of certificate authorities trusted by the server.
|
List<CertificateRequest.ClientCertificateType> |
getCertificateTypes()
Gets the certificate types that the client may offer.
|
int |
getMessageLength()
Must be implemented by each subclass.
|
HandshakeType |
getMessageType()
Returns the type of the handshake message.
|
SignatureAndHashAlgorithm |
getSignatureAndHashAlgorithm(List<X509Certificate> chain)
Gets a signature algorithm that is compatible with a given certificate chain.
|
SignatureAndHashAlgorithm |
getSignatureAndHashAlgorithm(PublicKey key)
Gets the signature algorithm that is compatible with a given public key.
|
List<SignatureAndHashAlgorithm> |
getSupportedSignatureAlgorithms()
Gets the signature algorithms that the server is able to verify.
|
void |
selectSignatureAlgorithms(List<SignatureAndHashAlgorithm> supportedSignatureAndHashAlgorithms)
Select received supported signature and hash algorithms by the supported
signature and hash algorithms of this peer.
|
String |
toString() |
fragmentChanged, fromByteArray, fromGenericHandshakeMessage, getContentType, getFragmentLength, getFragmentOffset, getMessageSeq, getNextHandshakeMessage, getRawMessage, setMessageSeq, setNextHandshakeMessage, size, toByteArray, writeTogetPeerpublic CertificateRequest(InetSocketAddress peerAddress)
peerAddress - the IP address and port of the peer this
message has been received from or should be sent topublic CertificateRequest(List<CertificateRequest.ClientCertificateType> certificateTypes, List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, List<X500Principal> certificateAuthorities, InetSocketAddress peerAddress)
certificateTypes - the list of allowed client certificate types.supportedSignatureAlgorithms - the list of supported signature and hash algorithms.certificateAuthorities - the list of allowed certificate authorities.peerAddress - the IP address and port of the peer this
message has been received from or should be sent topublic HandshakeType getMessageType()
HandshakeMessageHandshakeType.getMessageType in class HandshakeMessageHandshakeType.public int getMessageLength()
HandshakeMessagegetMessageLength in class HandshakeMessagepublic String toString()
toString in class HandshakeMessagepublic byte[] fragmentToByteArray()
HandshakeMessageClientHello, the
fragments are considered to be not modified. If a modification is required,
call HandshakeMessage.fragmentChanged().fragmentToByteArray in class HandshakeMessagepublic static HandshakeMessage fromReader(org.eclipse.californium.elements.util.DatagramReader reader, InetSocketAddress peerAddress)
reader - reader for the binary encoding of the message.peerAddress - The origin address of the message.public void addCertificateType(CertificateRequest.ClientCertificateType certificateType)
certificateType - The type to add.public void addSignatureAlgorithm(SignatureAndHashAlgorithm signatureAndHashAlgorithm)
The algorithm's position in list indicates least preference to the recipient (the DTLS client) of the message.
signatureAndHashAlgorithm - The algorithm to add.public void addSignatureAlgorithms(List<SignatureAndHashAlgorithm> signatureAndHashAlgorithms)
The algorithm's position in list indicates least preference to the recipient (the DTLS client) of the message.
signatureAndHashAlgorithms - The algorithms to add.public void selectSignatureAlgorithms(List<SignatureAndHashAlgorithm> supportedSignatureAndHashAlgorithms)
supportedSignatureAndHashAlgorithms - supported signature and hash
algorithms of this peerpublic boolean addCertificateAuthority(X500Principal authority)
authority - The authority to add.false if the authority could not be added because it would exceed the
maximum encoded length allowed for the certificate request message's
certificate authorities vector (2^16 - 1 bytes).NullPointerException - if the authority is null.public boolean addCerticiateAuthorities(List<X500Principal> authorities)
authorities - authorities of the trusted certificates to add.false if not all certificates could not be added because it would exceed the
maximum encoded length allowed for the certificate request message's
certificate authorities vector (2^16 - 1 bytes).public List<CertificateRequest.ClientCertificateType> getCertificateTypes()
null.public SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(PublicKey key)
key - The public key.null if
the given key is not compatible with any of the supported certificate types
or any of the supported signature algorithms.public SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(List<X509Certificate> chain)
chain - The certificate chain.null if any of the chain's certificates is not
compatible with any of the supported certificate types or any of the supported signature algorithms.public List<SignatureAndHashAlgorithm> getSupportedSignatureAlgorithms()
null).public List<X500Principal> getCertificateAuthorities()
The names are provided in DER-encoded ASN.1 format. The list is between 0 and 216-1 bytes long, while one distinguished name can range from 1 to 216-1 bytes length. Therefore, the length in the serialization must be handled carefully.
null).Copyright © 2023 Eclipse Foundation. All rights reserved.