Examples of toPrivateKey()


Examples of com.adito.security.pki.SshPrivateKeyFile.toPrivateKey()

         generateKey(username, keyType, bitLength, passphrase);
    }

    SshPrivateKeyFile f = SshPrivateKeyFile.parse(store.getEntryInputStream(filename));
   
    return f.toPrivateKey(passphrase);
 
  }
 
  /**
   * Determine if the user has a private key
View Full Code Here

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

            PublicKeyAuthenticationClient publicKeyAuth = new PublicKeyAuthenticationClient();

            publicKeyAuth.setUsername(username);

            SshPrivateKeyFile file = SshPrivateKeyFile.parse( key );
            SshPrivateKey privateKey = file.toPrivateKey( keyPassPhrase );
            publicKeyAuth.setKey( privateKey );

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

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

            // Initialize the authentication data.
            PublicKeyAuthenticationClient publicKeyAuth = new PublicKeyAuthenticationClient();
            publicKeyAuth.setUsername("ec2-user");
            SshPrivateKeyFile file = SshPrivateKeyFile.parse(new File(PRIVATE_KEY_FILE_PATH));
            SshPrivateKey privateKey = file.toPrivateKey("");
            publicKeyAuth.setKey(privateKey);

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

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

                PublicKeyAuthenticationClient pk = new PublicKeyAuthenticationClient();
                pk.setUsername(user);

                SshPrivateKeyFile file = SshPrivateKeyFile.parse(new File(keyfile));
                SshPrivateKey key = file.toPrivateKey(pass);

                pk.setKey(key);
                result = ssh.authenticate(pk);
            }
View Full Code Here

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

            // 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

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

            // 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

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

            // 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

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

      if (file.isPassphraseProtected()) {
        System.out.print("Enter passphrase? ");
        passphrase = reader.readLine();
      }
      // Get the key
      SshPrivateKey key = file.toPrivateKey(passphrase);
      pk.setKey(key);
      // Try the authentication
      int result = ssh.authenticate(pk);
      // Evaluate the result
      if (result == AuthenticationProtocolState.COMPLETE) {
View Full Code Here

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

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

                    dialog.setMessageForeground(Color.red);
                }
            } while (true);
        } else {
            try {
                key = pkf.toPrivateKey(passphrase);
            } catch (InvalidSshKeyException ihke) {
                return false;
            }
        }
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.