Interface SshAgent

  • All Superinterfaces:
    java.lang.AutoCloseable, java.nio.channels.Channel, java.io.Closeable
    All Known Implementing Classes:
    AbstractAgentProxy, AgentClient, AgentDelegate, AgentImpl

    public interface SshAgent
    extends java.nio.channels.Channel
    SSH key agent server
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void addIdentity​(java.security.KeyPair key, java.lang.String comment, SshAgentKeyConstraint... constraints)
      Adds a key to the agent.
      java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,​java.lang.String>> getIdentities()  
      void removeAllIdentities()  
      void removeIdentity​(java.security.PublicKey key)  
      default java.security.KeyPair resolveLocalIdentity​(java.security.PublicKey key)
      Used for reporting client-side public key authentication via agent
      java.util.Map.Entry<java.lang.String,​byte[]> sign​(SessionContext session, java.security.PublicKey key, java.lang.String algo, byte[] data)  
      • Methods inherited from interface java.nio.channels.Channel

        close, isOpen
    • Field Detail

      • SSH_AUTHSOCKET_ENV_NAME

        static final java.lang.String SSH_AUTHSOCKET_ENV_NAME
        See Also:
        Constant Field Values
    • Method Detail

      • getIdentities

        java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,​java.lang.String>> getIdentities()
                                                                                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • sign

        java.util.Map.Entry<java.lang.String,​byte[]> sign​(SessionContext session,
                                                                java.security.PublicKey key,
                                                                java.lang.String algo,
                                                                byte[] data)
                                                         throws java.io.IOException
        Parameters:
        session - The current SessionContext
        key - The PublicKey to use for signing
        algo - Recommended signature algorithm - if null/empty then one will be selected based on the key type and/or signature factories. Note: even if specific algorithm specified, the implementation may disregard and choose another
        data - Data to sign
        Returns:
        used algorithm + signed data - using the identity
        Throws:
        java.io.IOException - If failed to sign
      • resolveLocalIdentity

        default java.security.KeyPair resolveLocalIdentity​(java.security.PublicKey key)
        Used for reporting client-side public key authentication via agent
        Parameters:
        key - The PublicKey that is going to be used
        Returns:
        The KeyPair identity for it - if available - null otherwise
      • addIdentity

        void addIdentity​(java.security.KeyPair key,
                         java.lang.String comment,
                         SshAgentKeyConstraint... constraints)
                  throws java.io.IOException
        Adds a key to the agent.
        Parameters:
        key - KeyPair to add
        comment - to associate with the key
        constraints - SshAgentKeyConstraints for this key to pass on to the agent
        Throws:
        java.io.IOException - if an error in the communication with the agent occurred, or the agent did not return a reply indicating successful addition of the key
      • removeIdentity

        void removeIdentity​(java.security.PublicKey key)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • removeAllIdentities

        void removeAllIdentities()
                          throws java.io.IOException
        Throws:
        java.io.IOException