Skip to content

An X509 peer should support RPK too #2145

@sbernard31

Description

@sbernard31

In my case I have a DTLS server (using bouncy castle low level API), which need to support PSK, RPK and X509.

A peer which support X509 could support RPK too.
Of course, it should be possible to configure that peer in a way it only accept X509.

Currently, it seems there is a bug (or missing feature) which prevent to create a server which accept both.

A comment in the code seems to confirm that:

// TODO An X509 certificate should still be usable as RawPublicKey
short serverCertificateType = credentials.getCertificate().getCertificateType();

Maybe it make sense to try to find supported Server Certificate Type based on getCredentials() but in case this is X509 certificate, maybe RPK should be added too by default ?

Maybe we should have a getSupportedServerCertificateTypes() in AbstractTlsServer with default implementation based on getCredentials, so it would be easy to override it change default behavoir.

(Bonus question, as there is not so much documentation, it is often hard to know what is expected when implementing BC interface/abstract class, typically for getCredentials() should I a create a BcDefaultTlsCredentialedSigner on each call ? I guess at least 1 by handshake and so it should be simpler if getCredentials was called only 1 time by handshake ? currently it is called twice, 1 time to get Server Certificate Type and one time to store it ServerHandshakeState.serverCredentials)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions