Package org.apache.sshd.common.util

Examples of org.apache.sshd.common.util.Buffer.available()


        while (blockSize > E.length) {
            Buffer buffer = new Buffer();
            buffer.putMPInt(K);
            buffer.putRawBytes(H);
            buffer.putRawBytes(E);
            hash.update(buffer.array(), 0, buffer.available());
            byte[] foo = hash.digest();
            byte[] bar = new byte[E.length + foo.length];
            System.arraycopy(E, 0, bar, 0, E.length);
            System.arraycopy(foo, 0, bar, E.length, foo.length);
            E = bar;
View Full Code Here


            buf.putByte((byte) 1);
            buf.putString(keyAlg);
            buffer.rpos(oldPos);
            buffer.wpos(oldPos + 4 + len);
            buf.putBuffer(buffer);
            verif.update(buf.array(), buf.rpos(), buf.available());
            if (!verif.verify(sig)) {
                throw new Exception("Key verification failed");
            }
            return true;
        }
View Full Code Here

    public void addIdentity(KeyPair key, String comment) throws IOException {
        Buffer buffer = createBuffer(AgentServer.SSH2_AGENTC_ADD_IDENTITY);
        buffer.putKeyPair(key);
        buffer.putString(comment);
        buffer = request(buffer);
        if (buffer.available() != 1 || buffer.getByte() != AgentServer.SSH_AGENT_SUCCESS) {
            throw new SshException("SSH agent failure");
        }
    }

    public void removeIdentity(PublicKey key) throws IOException {
View Full Code Here

    public void removeIdentity(PublicKey key) throws IOException {
        Buffer buffer = createBuffer(AgentServer.SSH2_AGENTC_REMOVE_IDENTITY);
        buffer.putPublicKey(key);
        buffer = request(buffer);
        if (buffer.available() != 1 || buffer.getByte() != AgentServer.SSH_AGENT_SUCCESS) {
            throw new SshException("SSH agent failure");
        }
    }

    public void removeAllIdentities() throws IOException {
View Full Code Here

    }

    public void removeAllIdentities() throws IOException {
        Buffer buffer = createBuffer(AgentServer.SSH2_AGENTC_REMOVE_ALL_IDENTITIES);
        buffer = request(buffer);
        if (buffer.available() != 1 || buffer.getByte() != AgentServer.SSH_AGENT_SUCCESS) {
            throw new SshException("SSH agent failure");
        }
    }

    public void close() {
View Full Code Here

                    int flags = req.getInt();
                    Buffer sig = new Buffer();
                    sig.putString(key instanceof RSAPublicKey ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
                    sig.putBytes(engine.sign(key, data));
                    rep.putByte(SSH2_AGENT_SIGN_RESPONSE);
                    rep.putBytes(sig.array(), sig.rpos(), sig.available());
                    break;
                }
                case SSH2_AGENTC_ADD_IDENTITY:
                {
                    engine.addIdentity(req.getKeyPair(), req.getString());
View Full Code Here

        Buffer buffer = new Buffer();
        buffer.putMPInt(K);
        buffer.putRawBytes(H);
        buffer.putByte((byte) 0x41);
        buffer.putRawBytes(sessionId);
        int pos = buffer.available();
        byte[] buf = buffer.array();
        hash.update(buf, 0, pos);
        IVc2s = hash.digest();

        int j = pos - sessionId.length - 1;
View Full Code Here

            bs.putString("ssh-connection");
            bs.putString("publickey");
            bs.putByte((byte) 1);
            bs.putString((key.getPublic() instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            bs.putPublicKey(key.getPublic());
            verif.update(bs.array(), bs.rpos(), bs.available());

            bs = new Buffer();
            bs.putString((key.getPublic() instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            bs.putBytes(verif.sign());
            buffer.putBytes(bs.array(), bs.rpos(), bs.available());
View Full Code Here

        while (blockSize > E.length) {
            Buffer buffer = new Buffer();
            buffer.putMPInt(K);
            buffer.putRawBytes(H);
            buffer.putRawBytes(E);
            hash.update(buffer.array(), 0, buffer.available());
            byte[] foo = hash.digest();
            byte[] bar = new byte[E.length + foo.length];
            System.arraycopy(E, 0, bar, 0, E.length);
            System.arraycopy(foo, 0, bar, E.length, foo.length);
            E = bar;
View Full Code Here

            verif.update(bs.array(), bs.rpos(), bs.available());

            bs = new Buffer();
            bs.putString((key.getPublic() instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            bs.putBytes(verif.sign());
            buffer.putBytes(bs.array(), bs.rpos(), bs.available());

            session.writePacket(buffer);
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
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.