Package com.sshtools.j2ssh.io

Examples of com.sshtools.j2ssh.io.ByteArrayWriter.writeString()


        SshPublicKey pub = key.getPublicKey();
        log.info("Preparing public key authentication request");

        // Now prepare and send the message
        baw.write(1);
        baw.writeString(pub.getAlgorithmName());
        baw.writeBinaryString(pub.getEncoded());

        // Create the signature data
        ByteArrayWriter data = new ByteArrayWriter();
        data.writeBinaryString(authentication.getSessionIdentifier());
View Full Code Here


        // Create the signature data
        ByteArrayWriter data = new ByteArrayWriter();
        data.writeBinaryString(authentication.getSessionIdentifier());
        data.write(SshMsgUserAuthRequest.SSH_MSG_USERAUTH_REQUEST);
        data.writeString(getUsername());
        data.writeString(serviceToStart);
        data.writeString(getMethodName());
        data.write(1);
        data.writeString(pub.getAlgorithmName());
        data.writeBinaryString(pub.getEncoded());
View Full Code Here

        // Create the signature data
        ByteArrayWriter data = new ByteArrayWriter();
        data.writeBinaryString(authentication.getSessionIdentifier());
        data.write(SshMsgUserAuthRequest.SSH_MSG_USERAUTH_REQUEST);
        data.writeString(getUsername());
        data.writeString(serviceToStart);
        data.writeString(getMethodName());
        data.write(1);
        data.writeString(pub.getAlgorithmName());
        data.writeBinaryString(pub.getEncoded());
View Full Code Here

        ByteArrayWriter data = new ByteArrayWriter();
        data.writeBinaryString(authentication.getSessionIdentifier());
        data.write(SshMsgUserAuthRequest.SSH_MSG_USERAUTH_REQUEST);
        data.writeString(getUsername());
        data.writeString(serviceToStart);
        data.writeString(getMethodName());
        data.write(1);
        data.writeString(pub.getAlgorithmName());
        data.writeBinaryString(pub.getEncoded());

        // Generate the signature
View Full Code Here

        data.write(SshMsgUserAuthRequest.SSH_MSG_USERAUTH_REQUEST);
        data.writeString(getUsername());
        data.writeString(serviceToStart);
        data.writeString(getMethodName());
        data.write(1);
        data.writeString(pub.getAlgorithmName());
        data.writeBinaryString(pub.getEncoded());

        // Generate the signature
        baw.writeBinaryString(key.generateSignature(data.toByteArray()));
View Full Code Here

            SshMsgUserAuthPwdChangeReq.SSH_MSG_USERAUTH_PWD_CHANGEREQ);

        // Send a password authentication request
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.write(0);
        baw.writeString(password);

        SshMsgUserAuthRequest msg = new SshMsgUserAuthRequest(getUsername(),
                serviceToStart, "password", baw.toByteArray());
        authentication.sendMessage(msg);
View Full Code Here

            if (newpassword != null) {
                log.debug("Setting new password");
                baw = new ByteArrayWriter();
                baw.write(1);
                baw.writeString(password);
                baw.writeString(newpassword);
                msg = new SshMsgUserAuthRequest(getUsername(), serviceToStart,
                        "password", baw.toByteArray());
                authentication.sendMessage(msg);
            } else {
View Full Code Here

            if (newpassword != null) {
                log.debug("Setting new password");
                baw = new ByteArrayWriter();
                baw.write(1);
                baw.writeString(password);
                baw.writeString(newpassword);
                msg = new SshMsgUserAuthRequest(getUsername(), serviceToStart,
                        "password", baw.toByteArray());
                authentication.sendMessage(msg);
            } else {
                throw new TerminatedStateException(AuthenticationProtocolState.FAILED);
View Full Code Here

        authentication.registerMessage(SshMsgUserAuthInfoRequest.class,
            SshMsgUserAuthInfoRequest.SSH_MSG_USERAUTH_INFO_REQUEST);

        // Send the authentication request
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString("");
        baw.writeString("");

        SshMessage msg = new SshMsgUserAuthRequest(getUsername(),
                serviceToStart, getMethodName(), baw.toByteArray());
        authentication.sendMessage(msg);
View Full Code Here

            SshMsgUserAuthInfoRequest.SSH_MSG_USERAUTH_INFO_REQUEST);

        // Send the authentication request
        ByteArrayWriter baw = new ByteArrayWriter();
        baw.writeString("");
        baw.writeString("");

        SshMessage msg = new SshMsgUserAuthRequest(getUsername(),
                serviceToStart, getMethodName(), baw.toByteArray());
        authentication.sendMessage(msg);
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.