Package com.sshtools.j2ssh.transport.publickey

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


     * @param keyFilePath the private key file.
     * @param passPhrase the password for the file.
     * @return true if it is valid.
     */
    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


            });
            GFacUtils.updateApplicationJobStatus(jobExecutionContext, jobId, ApplicationJobStatus.AUTHENTICATE);
            // 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.SshPrivateKeyFile

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.