Package com.sshtools.j2ssh.transport.publickey

Examples of com.sshtools.j2ssh.transport.publickey.SshPrivateKeyFile.toPrivateKey()


                }

                passphrase = new String(dialog.getPassphrase());

                try {
                    key = pkf.toPrivateKey(passphrase);

                    break;
                } catch (InvalidSshKeyException ihke) {
                    dialog.setMessage("Passphrase Invalid! Try again");
                    dialog.setMessageForeground(Color.red);
View Full Code Here


                    dialog.setMessageForeground(Color.red);
                }
            } while (true);
        } else {
            try {
                key = pkf.toPrivateKey(passphrase);
            } catch (InvalidSshKeyException ihke) {
                return false;
            }
        }
View Full Code Here

     */
    public static boolean checkPassPhrase(File keyFilePath, String passPhrase) {
        SshPrivateKeyFile keyFile = parsePrivateKeyFile(keyFilePath);
        if (keyFile != null) {
            try {
                keyFile.toPrivateKey(passPhrase);
            } catch (InvalidSshKeyException e) {
                return false;
            }
            return true;
        } else {
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
Copyright © 2018 www.massapi.com. 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.