Package com.sshtools.j2ssh.transport.publickey

Examples of com.sshtools.j2ssh.transport.publickey.SshPrivateKey


        File keyfile = (instance.getKeyfile() == null) ? null
                                                       : new File(instance.getKeyfile());
        String passphrase = null;
        SshPrivateKeyFile pkf = null;
        SshPrivateKey key;

        if ((keyfile == null) || !keyfile.exists()) {
            JFileChooser chooser = new JFileChooser();
            chooser.setFileHidingEnabled(false);
            chooser.setDialogTitle("Select Private Key File For Authentication");
View Full Code Here


        // Create an instance of the public key from the factory
        //SshKeyPair pair = SshKeyPairFactory.newInstance(keyType);
        // Get the configuration and get the relevant host key
        Map keys = config.getServerHostKeys();
        Iterator it = keys.entrySet().iterator();
        SshPrivateKey pk; //privateKeyFile = null;

        while (it.hasNext()) {
            Map.Entry entry = (Map.Entry) it.next();

            if (entry.getKey().equals(keyType)) {
View Full Code Here

            // Initialize the authentication data.
            PublicKeyAuthenticationClient publicKeyAuth = new PublicKeyAuthenticationClient();
            publicKeyAuth.setUsername(amazonSecurityContext.getUserName());
            SshPrivateKeyFile file = SshPrivateKeyFile.
                    parse(new File(System.getProperty("user.home") + "/.ssh/" + KEY_PAIR_NAME));
            SshPrivateKey privateKey = file.toPrivateKey("");
            publicKeyAuth.setKey(privateKey);

            // Authenticate
            int result = sshClient.authenticate(publicKeyAuth);
            if(result== AuthenticationProtocolState.FAILED) {
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.transport.publickey.SshPrivateKey

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.