Package ch.ethz.ssh2.packets

Examples of ch.ethz.ssh2.packets.TypesWriter.writeString()


  public static byte[] encodeSSHRSAPublicKey(RSAPublicKey pk) throws IOException
  {
    TypesWriter tw = new TypesWriter();

    tw.writeString("ssh-rsa");
    tw.writeMPInt(pk.getE());
    tw.writeMPInt(pk.getN());

    return tw.getBytes();
  }
View Full Code Here


  public static byte[] encodeSSHRSASignature(RSASignature sig) throws IOException
  {
    TypesWriter tw = new TypesWriter();

    tw.writeString("ssh-rsa");

    /* S is NOT an MPINT. "The value for 'rsa_signature_blob' is encoded as a string
     * containing s (which is an integer, without lengths or padding, unsigned and in
     * network byte order)."
     */
 
View Full Code Here

    byte[] s = sig.getS().toByteArray();

    /* Remove first zero sign byte, if present */

    if ((s.length > 1) && (s[0] == 0x00))
      tw.writeString(s, 1, s.length - 1);
    else
      tw.writeString(s, 0, s.length);

    return tw.getBytes();
  }
View Full Code Here

    /* Remove first zero sign byte, if present */

    if ((s.length > 1) && (s[0] == 0x00))
      tw.writeString(s, 1, s.length - 1);
    else
      tw.writeString(s, 0, s.length);

    return tw.getBytes();
  }

  public static RSASignature generateSignature(byte[] message, RSAPrivateKey pk) throws IOException
View Full Code Here

  public static byte[] encodeSSHDSAPublicKey(DSAPublicKey pk) throws IOException
  {
    TypesWriter tw = new TypesWriter();

    tw.writeString("ssh-dss");
    tw.writeMPInt(pk.getP());
    tw.writeMPInt(pk.getQ());
    tw.writeMPInt(pk.getG());
    tw.writeMPInt(pk.getY());
View Full Code Here

  private final void closeHandle(byte[] handle) throws IOException
  {
    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(handle, 0, handle.length);

    sendMessage(Packet.SSH_FXP_CLOSE, req_id, tw.getBytes());

    expectStatusOKMessage(req_id);
  }
View Full Code Here

    checkHandleValidAndOpen(handle);

    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(handle.fileHandle, 0, handle.fileHandle.length);

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_FSTAT...");
      debug.flush();
View Full Code Here

  private SFTPv3FileAttributes statBoth(String path, int statMethod) throws IOException
  {
    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(path, charsetName);

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_STAT/SSH_FXP_LSTAT...");
      debug.flush();
View Full Code Here

  public String readLink(String path) throws IOException
  {
    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(path, charsetName);

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_READLINK...");
      debug.flush();
View Full Code Here

  public void setstat(String path, SFTPv3FileAttributes attr) throws IOException
  {
    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(path, charsetName);
    tw.writeBytes(createAttrs(attr));

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_SETSTAT...");
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.