Package org.apache.sshd.common

Examples of org.apache.sshd.common.KeyPairProvider


       
        try {
            AuthFuture authResult;
            session = connectFuture.getSession();
   
            KeyPairProvider keyPairProvider;
            final String certResource = getCertResource();
            if (certResource != null) {
                log.debug("Attempting to authenticate using ResourceKey '{}'...", certResource);
                keyPairProvider = new ResourceHelperKeyPairProvider(new String[]{certResource}, getCamelContext().getClassResolver());
            } else {
                keyPairProvider = getKeyPairProvider();
            }
   
            if (keyPairProvider != null) {
                log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
                KeyPair pair = keyPairProvider.loadKey(getKeyType());
                authResult = session.authPublicKey(getUsername(), pair);
            } else {
                log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
                authResult = session.authPassword(getUsername(), getPassword());
            }
View Full Code Here


            root.setLevel(Level.FINE);
        } else {
            root.setLevel(Level.FINEST);
        }

        KeyPairProvider provider = null;
        final List<String> files = new ArrayList<String>();
        File f = new File(System.getProperty("user.home"), ".ssh/id_dsa");
        if (f.exists() && f.isFile() && f.canRead()) {
            files.add(f.getAbsolutePath());
        }
View Full Code Here

                ids.add(new KeyAgentIdentity(agent, pair.getFirst()));
            }
        } else {
            this.agent = null;
        }
        KeyPairProvider provider = session.getFactoryManager().getKeyPairProvider();
        if (provider != null) {
            for (KeyPair pair : provider.loadKeys()) {
                ids.add(new KeyPairIdentity(session.getFactoryManager(), pair));
            }
        }
        this.keys = ids.iterator();
    }
View Full Code Here

            root.setLevel(Level.FINE);
        } else {
            root.setLevel(Level.FINEST);
        }

        KeyPairProvider provider = null;
        List<String> files = new ArrayList<String>();
        File f = new File(System.getProperty("user.home"), ".ssh/id_dsa");
        if (f.exists() && f.isFile() && f.canRead()) {
            files.add(f.getAbsolutePath());
        }
View Full Code Here

            root.setLevel(Level.FINE);
        } else {
            root.setLevel(Level.FINEST);
        }

        KeyPairProvider provider = null;
        final List<String> files = new ArrayList<String>();
        File f = new File(System.getProperty("user.home"), ".ssh/id_dsa");
        if (f.exists() && f.isFile() && f.canRead()) {
            files.add(f.getAbsolutePath());
        }
View Full Code Here

        log.debug("Connected to {}:{}", getHost(), getPort());

        AuthFuture authResult;
        ClientSession session = connectFuture.getSession();

        KeyPairProvider keyPairProvider;
        final String certFilename = getCertFilename();
        if (certFilename != null) {
            log.debug("Attempting to authenticate using FileKey '{}'...", certFilename);
            keyPairProvider = new FileKeyPairProvider(new String[]{certFilename});
        } else {
            keyPairProvider = getKeyPairProvider();
        }

        if (keyPairProvider != null) {
            log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
            KeyPair pair = keyPairProvider.loadKey(getKeyType());
            authResult = session.authPublicKey(getUsername(), pair);
        } else {
            log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
            authResult = session.authPassword(getUsername(), getPassword());
        }
View Full Code Here

       
        try {
            AuthFuture authResult;
            session = connectFuture.getSession();
   
            KeyPairProvider keyPairProvider;
            final String certResource = getCertResource();
            if (certResource != null) {
                log.debug("Attempting to authenticate using ResourceKey '{}'...", certResource);
                keyPairProvider = new ResourceHelperKeyPairProvider(new String[]{certResource}, getCamelContext().getClassResolver());
            } else {
                keyPairProvider = getKeyPairProvider();
            }
   
            if (keyPairProvider != null) {
                log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
                KeyPair pair = keyPairProvider.loadKey(getKeyType());
                authResult = session.authPublicKey(getUsername(), pair);
            } else {
                log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
                authResult = session.authPassword(getUsername(), getPassword());
            }
View Full Code Here

    }
    return pub.isEmpty() ? local : pub;
  }

  private List<PublicKey> myHostKeys() {
    final KeyPairProvider p = getKeyPairProvider();
    final List<PublicKey> keys = new ArrayList<PublicKey>(2);
    addPublicKey(keys, p, KeyPairProvider.SSH_RSA);
    addPublicKey(keys, p, KeyPairProvider.SSH_DSS);
    return keys;
  }
View Full Code Here

        log.debug("Connected to {}:{}", getHost(), getPort());

        AuthFuture authResult;
        ClientSession session = connectFuture.getSession();

        KeyPairProvider keyPairProvider;
        final String certResource = getCertResource();
        if (certResource != null) {
            log.debug("Attempting to authenticate using ResourceKey '{}'...", certResource);
            keyPairProvider = new ResourceHelperKeyPairProvider(new String[]{certResource}, getCamelContext().getClassResolver());
        } else {
            keyPairProvider = getKeyPairProvider();
        }

        if (keyPairProvider != null) {
            log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
            KeyPair pair = keyPairProvider.loadKey(getKeyType());
            authResult = session.authPublicKey(getUsername(), pair);
        } else {
            log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
            authResult = session.authPassword(getUsername(), getPassword());
        }
View Full Code Here

      authTimeout = SSH_SERVER_AUTH_DEFAULT_TIMEOUT;
    }

    //
    Resource serverKey = null;
    KeyPairProvider keyPairProvider = null;

    // Get embedded default key
    URL serverKeyURL = SSHPlugin.class.getResource("/crash/hostkey.pem");
    if (serverKeyURL != null) {
      try {
View Full Code Here

TOP

Related Classes of org.apache.sshd.common.KeyPairProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.