Package com.sshtools.j2ssh.subsystem

Examples of com.sshtools.j2ssh.subsystem.SubsystemMessage


     * @throws InterruptedException
     */
    public synchronized SubsystemMessage getMessage(UnsignedInteger32 requestId)
        throws InterruptedException {
        Iterator it;
        SubsystemMessage msg;

        // If there ae no messages available then wait untill there are.
        while (getState().getValue() == OpenClosedState.OPEN) {
            if (messages.size() > 0) {
                it = messages.iterator();
View Full Code Here


     *
     * @throws IOException if an IO error occurs
     */
    protected void sendVersionRequest(String application)
        throws IOException {
        SubsystemMessage msg = new SshAgentRequestVersion(application);
        sendMessage(msg);
        msg = readMessage();

        if (msg instanceof SshAgentVersionResponse) {
            SshAgentVersionResponse reply = (SshAgentVersionResponse) msg;
View Full Code Here

     * @throws IOException if an IO error occurs
     */
    public void addKey(SshPrivateKey prvkey, SshPublicKey pubkey,
        String description, KeyConstraints constraints)
        throws IOException {
        SubsystemMessage msg = new SshAgentAddKey(prvkey, pubkey, description,
                constraints);
        sendMessage(msg);
        msg = readMessage();

        if (!(msg instanceof SshAgentSuccess)) {
View Full Code Here

     *
     * @throws IOException if an IO error occurs
     */
    public byte[] hashAndSign(SshPublicKey key, byte[] data)
        throws IOException {
        SubsystemMessage msg = new SshAgentPrivateKeyOp(key, HASH_AND_SIGN, data);
        sendMessage(msg);
        msg = readMessage();

        if (msg instanceof SshAgentOperationComplete) {
            return ((SshAgentOperationComplete) msg).getData();
View Full Code Here

     * @return a map of public keys and descriptions
     *
     * @throws IOException if an IO error occurs
     */
    public Map listKeys() throws IOException {
        SubsystemMessage msg = new SshAgentListKeys();
        sendMessage(msg);
        msg = readMessage();

        if (msg instanceof SshAgentKeyList) {
            return ((SshAgentKeyList) msg).getKeys();
View Full Code Here

     * @return true if the agent was locked, otherwise false
     *
     * @throws IOException if an IO error occurs
     */
    public boolean lockAgent(String password) throws IOException {
        SubsystemMessage msg = new SshAgentLock(password);
        sendMessage(msg);
        msg = readMessage();

        return (msg instanceof SshAgentSuccess);
    }
View Full Code Here

     * @return true if the agent was unlocked, otherwise false
     *
     * @throws IOException if an IO error occurs
     */
    public boolean unlockAgent(String password) throws IOException {
        SubsystemMessage msg = new SshAgentUnlock(password);
        sendMessage(msg);
        msg = readMessage();

        return (msg instanceof SshAgentSuccess);
    }
View Full Code Here

     * @return the random data received
     *
     * @throws IOException if an IO error occurs
     */
    public byte[] getRandomData(int count) throws IOException {
        SubsystemMessage msg = new SshAgentRandom(count);
        sendMessage(msg);
        msg = readMessage();

        if (msg instanceof SshAgentRandomData) {
            return ((SshAgentRandomData) msg).getRandomData();
View Full Code Here

     * @param padding the padding data
     *
     * @throws IOException if an IO error occurs
     */
    public void ping(byte[] padding) throws IOException {
        SubsystemMessage msg = new SshAgentPing(padding);
        sendMessage(msg);
        msg = readMessage();

        if (msg instanceof SshAgentAlive) {
            if (!Arrays.equals(padding, ((SshAgentAlive) msg).getPadding())) {
View Full Code Here

     *
     * @throws IOException if an IO error occurs
     */
    public void deleteKey(SshPublicKey key, String description)
        throws IOException {
        SubsystemMessage msg = new SshAgentDeleteKey(key, description);
        sendMessage(msg);
        msg = readMessage();

        if (!(msg instanceof SshAgentSuccess)) {
            throw new IOException("The agent failed to delete the key");
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.subsystem.SubsystemMessage

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.