Package org.conscrypt

Class DuckTypedPSKKeyManager

  • All Implemented Interfaces:
    KeyManager, PSKKeyManager

    public class DuckTypedPSKKeyManager
    extends Object
    implements PSKKeyManager
    Reflection-based PSKKeyManager adaptor for objects which expose all the methods of the PSKKeyManager interface but do not implement the interface.

    This is expected to be useful on platforms where there are multiple instances of the PSKKeyManager interface.

    • Method Detail

      • chooseServerKeyIdentityHint

        public String chooseServerKeyIdentityHint​(Socket socket)
        Description copied from interface: PSKKeyManager
        Gets the PSK identity hint to report to the client to help agree on the PSK for the provided socket.
        Specified by:
        chooseServerKeyIdentityHint in interface PSKKeyManager
        Returns:
        PSK identity hint to be provided to the client or null to provide no hint.
      • chooseServerKeyIdentityHint

        public String chooseServerKeyIdentityHint​(SSLEngine engine)
        Description copied from interface: PSKKeyManager
        Gets the PSK identity hint to report to the client to help agree on the PSK for the provided engine.
        Specified by:
        chooseServerKeyIdentityHint in interface PSKKeyManager
        Returns:
        PSK identity hint to be provided to the client or null to provide no hint.
      • chooseClientKeyIdentity

        public String chooseClientKeyIdentity​(String identityHint,
                                              Socket socket)
        Description copied from interface: PSKKeyManager
        Gets the PSK identity to report to the server to help agree on the PSK for the provided socket.
        Specified by:
        chooseClientKeyIdentity in interface PSKKeyManager
        Parameters:
        identityHint - identity hint provided by the server or null if none provided.
        Returns:
        PSK identity to provide to the server. null is permitted but will be converted into an empty string.
      • chooseClientKeyIdentity

        public String chooseClientKeyIdentity​(String identityHint,
                                              SSLEngine engine)
        Description copied from interface: PSKKeyManager
        Gets the PSK identity to report to the server to help agree on the PSK for the provided engine.
        Specified by:
        chooseClientKeyIdentity in interface PSKKeyManager
        Parameters:
        identityHint - identity hint provided by the server or null if none provided.
        Returns:
        PSK identity to provide to the server. null is permitted but will be converted into an empty string.
      • getKey

        public SecretKey getKey​(String identityHint,
                                String identity,
                                Socket socket)
        Description copied from interface: PSKKeyManager
        Gets the PSK to use for the provided socket.
        Specified by:
        getKey in interface PSKKeyManager
        Parameters:
        identityHint - identity hint provided by the server to help select the key or null if none provided.
        identity - identity provided by the client to help select the key.
        Returns:
        key or null to signal to peer that no suitable key is available and to abort the handshake.
      • getKey

        public SecretKey getKey​(String identityHint,
                                String identity,
                                SSLEngine engine)
        Description copied from interface: PSKKeyManager
        Gets the PSK to use for the provided engine.
        Specified by:
        getKey in interface PSKKeyManager
        Parameters:
        identityHint - identity hint provided by the server to help select the key or null if none provided.
        identity - identity provided by the client to help select the key.
        Returns:
        key or null to signal to peer that no suitable key is available and to abort the handshake.