Class AgentImpl

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, SshAgent

    public class AgentImpl
    extends java.lang.Object
    implements SshAgent
    A local SSH agent implementation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<java.util.Map.Entry<java.security.KeyPair,​java.lang.String>> keys  
      private java.util.concurrent.atomic.AtomicBoolean open  
    • Constructor Summary

      Constructors 
      Constructor Description
      AgentImpl()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIdentity​(java.security.KeyPair key, java.lang.String comment)  
      void close()  
      java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,​java.lang.String>> getIdentities()  
      protected static java.util.Map.Entry<java.security.KeyPair,​java.lang.String> getKeyPair​(java.util.Collection<? extends java.util.Map.Entry<java.security.KeyPair,​java.lang.String>> keys, java.security.PublicKey key)  
      boolean isOpen()  
      void removeAllIdentities()  
      void removeIdentity​(java.security.PublicKey key)  
      byte[] sign​(SessionContext session, java.security.PublicKey key, byte[] data)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • keys

        private final java.util.List<java.util.Map.Entry<java.security.KeyPair,​java.lang.String>> keys
      • open

        private final java.util.concurrent.atomic.AtomicBoolean open
    • Constructor Detail

      • AgentImpl

        public AgentImpl()
    • Method Detail

      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • getIdentities

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

        public byte[] sign​(SessionContext session,
                           java.security.PublicKey key,
                           byte[] data)
                    throws java.io.IOException
        Specified by:
        sign in interface SshAgent
        Throws:
        java.io.IOException
      • addIdentity

        public void addIdentity​(java.security.KeyPair key,
                                java.lang.String comment)
                         throws java.io.IOException
        Specified by:
        addIdentity in interface SshAgent
        Throws:
        java.io.IOException
      • removeIdentity

        public void removeIdentity​(java.security.PublicKey key)
                            throws java.io.IOException
        Specified by:
        removeIdentity in interface SshAgent
        Throws:
        java.io.IOException
      • removeAllIdentities

        public void removeAllIdentities()
                                 throws java.io.IOException
        Specified by:
        removeAllIdentities in interface SshAgent
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getKeyPair

        protected static java.util.Map.Entry<java.security.KeyPair,​java.lang.String> getKeyPair​(java.util.Collection<? extends java.util.Map.Entry<java.security.KeyPair,​java.lang.String>> keys,
                                                                                                      java.security.PublicKey key)