Package com.sshtools.j2ssh.transport.compression

Examples of com.sshtools.j2ssh.transport.compression.SshCompression


            // Get the algorithm objects
            algorithms.lock();

            SshCipher cipher = algorithms.getCipher();
            SshHmac hmac = algorithms.getHmac();
            SshCompression compression = algorithms.getCompression();

            // Write the data into a byte array
            ByteArrayWriter message = new ByteArrayWriter();

            // Get the message payload data
            byte[] msgdata = msg.toByteArray();

            //int payload = msgdata.length;
            int padding = 4;
            int cipherlen = 8;

            // Determine the cipher length
            if (cipher != null) {
                cipherlen = cipher.getBlockSize();
            }

            // Compress the payload if necersary
            if (compression != null) {
                msgdata = compression.compress(msgdata, 0, msgdata.length);
            }

            //Determine the padding length
            padding += ((cipherlen -
            ((msgdata.length + 5 + padding) % cipherlen)) % cipherlen);
View Full Code Here


            // Get the algorithm objects
            algorithms.lock();

            SshCipher cipher = algorithms.getCipher();
            SshHmac hmac = algorithms.getHmac();
            SshCompression compression = algorithms.getCompression();

            // Write the data into a byte array
            ByteArrayWriter message = new ByteArrayWriter();

            // Get the message payload data
            byte[] msgdata = msg.toByteArray();

            //int payload = msgdata.length;
            int padding = 4;
            int cipherlen = 8;

            // Determine the cipher length
            if (cipher != null) {
                cipherlen = cipher.getBlockSize();
            }

            // Compress the payload if necersary
            if (compression != null) {
                msgdata = compression.compress(msgdata, 0, msgdata.length);
            }

            //Determine the padding length
            padding += ((cipherlen -
            ((msgdata.length + 5 + padding) % cipherlen)) % cipherlen);
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.transport.compression.SshCompression

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.