Examples of PasswordFinder


Examples of net.schmizz.sshj.userauth.password.PasswordFinder

     * @throws TransportException if there was a transport-layer error
     */
    public void authPassword(final String username, final char[] password)
            throws UserAuthException, TransportException {
        try {
            authPassword(username, new PasswordFinder() {

                @Override
                public char[] reqPassword(Resource<?> resource) {
                    return password.clone();
                }
View Full Code Here

Examples of net.schmizz.sshj.userauth.password.PasswordFinder

        SSHClient ssh = new SSHClient();
        // ssh.useCompression(); // Can lead to significant speedup (needs JZlib in classpath)
        ssh.loadKnownHosts();
        ssh.connect("dev4");
        try {
          PasswordFinder password = PasswordUtils.createOneOff("Reishee1".toCharArray());
          final String base = System.getProperty("user.home") + File.separator + ".ssh" + File.separator;
          final KeyProvider keyProvider = ssh.loadKeys(base + "id_dsa", password);
         
          final String user = System.getProperty("user.name");
          ssh.authPublickey(user, keyProvider);
View Full Code Here

Examples of net.schmizz.sshj.userauth.password.PasswordFinder

                } catch (IOException e) {
                    throw new RuntimeIOException("Cannot read key from private key file " + privateKeyFile, e);
                }
                client.authPublickey(username, keys);
            } else if (password != null) {
                PasswordFinder passwordFinder = getPasswordFinder();
                client.auth(username, new AuthPassword(passwordFinder),
                        new AuthKeyboardInteractive(new RegularExpressionPasswordResponseProvider(passwordFinder, interactiveKeyboardAuthPromptRegex)));
            }
            sshClient = client;
            connected();
View Full Code Here

Examples of net.schmizz.sshj.userauth.password.PasswordFinder

            throw new RuntimeIOException("Cannot connect to " + this, e);
        }
    }

    private PasswordFinder getPasswordFinder() {
        return new PasswordFinder() {

            @Override
            public char[] reqPassword(Resource<?> resource) {
                return password.toCharArray();
            }
View Full Code Here

Examples of net.schmizz.sshj.userauth.password.PasswordFinder

    private static final char[] SECRET_PASSWORD = "secret".toCharArray();
    private RegularExpressionPasswordResponseProvider provider;

    @BeforeMethod
    public void setup() {
        provider = new RegularExpressionPasswordResponseProvider(new PasswordFinder() {
            @Override
            public char[] reqPassword(Resource<?> resource) {
                return SECRET_PASSWORD;
            }
View Full Code Here

Examples of net.schmizz.sshj.userauth.password.PasswordFinder

     * @throws TransportException if there was a transport-layer error
     */
    public void authPassword(final String username, final char[] password)
            throws UserAuthException, TransportException {
        try {
            authPassword(username, new PasswordFinder() {

                @Override
                public char[] reqPassword(Resource<?> resource) {
                    return password.clone();
                }
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            //  in order to break the link between SshClient and BouncyCastle
            try {
                if (SecurityUtils.isBouncyCastleRegistered()) {
                    class KeyPairProviderLoader implements Callable<KeyPairProvider> {
                        public KeyPairProvider call() throws Exception {
                            return new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
                                public char[] getPassword() {
                                    try {
                                        System.out.println("Enter password for private key: ");
                                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                                        String password = r.readLine();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

            //  in order to break the link between SshClient and BouncyCastle
            try {
                if (SecurityUtils.isBouncyCastleRegistered()) {
                    class KeyPairProviderLoader implements Callable<KeyPairProvider> {
                        public KeyPairProvider call() throws Exception {
                            return new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
                                public char[] getPassword() {
                                    try {
                                        System.out.println("Enter password for private key: ");
                                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                                        String password = r.readLine();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

        f = new File(System.getProperty("user.home"), ".ssh/id_rsa");
        if (f.exists() && f.isFile() && f.canRead()) {
            files.add(f.getAbsolutePath());
        }
        if (files.size() > 0) {
            provider = new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
                public char[] getPassword() {
                    try {
                        System.out.println("Enter password for private key: ");
                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                        String password = r.readLine();
View Full Code Here

Examples of org.bouncycastle.openssl.PasswordFinder

    public void performTest()
        throws Exception
    {
        Reader          fRd =new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("test.pem")));
        PasswordFinder  pGet = new Password("secret".toCharArray());
        PEMReader       pemRd = new PEMReader(fRd, pGet);
        Object          o;

        while ((o = pemRd.readObject()) != null)
        {
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.