package com.jscape.inet.ssh.protocol.v2.marshaling.keys;

import com.jscape.inet.ssh.protocol.v2.marshaling.primitive.StringCodec;
import com.jscape.inet.ssh.protocol.v2.messages.Signature;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author Alex Usun
 */
public class RsaSignatureCodec
        implements SignatureCodec.EntryCodec {

    @Override
    public Signature read(String identifier, InputStream in)
            throws IOException {
        byte[] blob = StringCodec.readValue(in);

        return new Signature(identifier, blob);
    }

    @Override
    public void write(Signature value, OutputStream out)
            throws IOException {
        StringCodec.writeValue(value.blob, out);
    }
}
