org.apache.sshd.common.util.buffer.Buffer.getCompactData()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.getCompactData()方法的一些代码示例,展示了Buffer.getCompactData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getCompactData()方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:getCompactData

Buffer.getCompactData介绍

暂无

代码示例

代码示例来源:origin: org.apache.sshd/sshd-core

bs.putPublicKey(key);
byte[] contents = bs.getCompactData();
byte[] sig;
try {

代码示例来源:origin: org.apache.sshd/sshd-common

@Override
public byte[] sign() throws Exception {
  byte[] sig = super.sign();
  try (DERParser parser = new DERParser(sig)) {
    int type = parser.read();
    if (type != 0x30) {
      throw new StreamCorruptedException("Invalid signature format - not a DER SEQUENCE: 0x" + Integer.toHexString(type));
    }
    // length of remaining encoding of the 2 integers
    int remainLen = parser.readLength();
    /*
     * There are supposed to be 2 INTEGERs, each encoded with:
     *
     *  - one byte representing the fact that it is an INTEGER
     *  - one byte of the integer encoding length
     *  - at least one byte of integer data (zero length is not an option)
     */
    if (remainLen < (2 * 3)) {
      throw new StreamCorruptedException("Invalid signature format - not enough encoded data length: " + remainLen);
    }
    BigInteger r = parser.readBigInteger();
    BigInteger s = parser.readBigInteger();
    // Write the <r,s> to its own types writer.
    Buffer rsBuf = new ByteArrayBuffer();
    rsBuf.putMPInt(r);
    rsBuf.putMPInt(s);
    return rsBuf.getCompactData();
  }
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@Override
public byte[] sign() throws Exception {
  byte[] sig = super.sign();
  try (DERParser parser = new DERParser(sig)) {
    int type = parser.read();
    if (type != 0x30) {
      throw new StreamCorruptedException("Invalid signature format - not a DER SEQUENCE: 0x" + Integer.toHexString(type));
    }
    // length of remaining encoding of the 2 integers
    int remainLen = parser.readLength();
    /*
     * There are supposed to be 2 INTEGERs, each encoded with:
     *
     *  - one byte representing the fact that it is an INTEGER
     *  - one byte of the integer encoding length
     *  - at least one byte of integer data (zero length is not an option)
     */
    if (remainLen < (2 * 3)) {
      throw new StreamCorruptedException("Invalid signature format - not enough encoded data length: " + remainLen);
    }
    BigInteger r = parser.readBigInteger();
    BigInteger s = parser.readBigInteger();
    // Write the <r,s> to its own types writer.
    Buffer rsBuf = new ByteArrayBuffer();
    rsBuf.putMPInt(r);
    rsBuf.putMPInt(s);
    return rsBuf.getCompactData();
  }
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

bs.putPublicKey(key);
byte[] contents = bs.getCompactData();
byte[] sig;
try {

代码示例来源:origin: org.apache.sshd/sshd-core

byte[] data = buffer.getCompactData();
writePacket(buffer);
return data;

代码示例来源:origin: org.apache.sshd/sshd-osgi

byte[] data = buffer.getCompactData();
writePacket(buffer);
return data;

代码示例来源:origin: org.apache.sshd/sshd-core

byte[] keyBytes = buffer.getCompactData();
buffer = session.prepareBuffer(SshConstants.SSH_MSG_USERAUTH_REQUEST, BufferUtils.clear(buffer));
buffer.putString(username);

代码示例来源:origin: org.apache.sshd/sshd-osgi

byte[] keyBytes = buffer.getCompactData();
buffer = session.prepareBuffer(SshConstants.SSH_MSG_USERAUTH_REQUEST, BufferUtils.clear(buffer));
buffer.putString(username);

代码示例来源:origin: org.apache.sshd/sshd-core

buf.putPublicKey(k);
byte[] data = buf.getCompactData();
verifier.update(data);

代码示例来源:origin: org.apache.sshd/sshd-osgi

buf.putPublicKey(k);
byte[] data = buf.getCompactData();
verifier.update(data);

代码示例来源:origin: org.apache.sshd/sshd-core

byte[] k_s = buffer.getCompactData();
buffer.putBytes(sigBytes);
byte[] sigH = buffer.getCompactData();
if (log.isTraceEnabled()) {
  log.trace("next({})[{}][K_S]:  {}", this, session, BufferUtils.toHex(k_s));

代码示例来源:origin: org.apache.sshd/sshd-osgi

});
modes.putByte(PtyMode.TTY_OP_END);
buffer.putBytes(modes.getCompactData());
writePacket(buffer);

代码示例来源:origin: org.apache.sshd/sshd-core

});
modes.putByte(PtyMode.TTY_OP_END);
buffer.putBytes(modes.getCompactData());
writePacket(buffer);

代码示例来源:origin: org.apache.sshd/sshd-osgi

byte[] k_s = buffer.getCompactData();
buffer.putBytes(sigBytes);
byte[] sigH = buffer.getCompactData();
if (log.isTraceEnabled()) {
  log.trace("next({})[{}][K_S]:  {}", this, session, BufferUtils.toHex(k_s));

代码示例来源:origin: org.apache.sshd/sshd-osgi

msgbuf.putString(getName());
byte[] msgbytes = msgbuf.getCompactData();
byte[] inmic = buffer.getBytes();
try {

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.ssh.apache

private void sendMic(ClientSession session, String service)
    throws IOException, GSSException {
  state = ProtocolState.MIC_SENT;
  // Produce MIC
  Buffer micBuffer = new ByteArrayBuffer();
  micBuffer.putBytes(session.getSessionId());
  micBuffer.putByte(SshConstants.SSH_MSG_USERAUTH_REQUEST);
  micBuffer.putString(session.getUsername());
  micBuffer.putString(service);
  micBuffer.putString(getName());
  byte[] micBytes = micBuffer.getCompactData();
  byte[] mic = context.getMIC(micBytes, 0, micBytes.length,
      new MessageProp(0, true));
  Buffer buffer = session
      .createBuffer(SshConstants.SSH_MSG_USERAUTH_GSSAPI_MIC);
  buffer.putBytes(mic);
  session.writePacket(buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-core

msgbuf.putString(getName());
byte[] msgbytes = msgbuf.getCompactData();
byte[] inmic = buffer.getBytes();
try {

代码示例来源:origin: com.alibaba.middleware/termd-core

byte[] contents = bs.getCompactData();
byte[] signature = agent.sign(key, contents);
Buffer bs2 = new ByteArrayBuffer(keyType.length() + signature.length + Long.SIZE, false);

代码示例来源:origin: io.termd/termd-core

byte[] contents = bs.getCompactData();
byte[] signature = agent.sign(key, contents);
Buffer bs2 = new ByteArrayBuffer(keyType.length() + signature.length + Long.SIZE, false);

代码示例来源:origin: termd/termd

byte[] contents = bs.getCompactData();
byte[] signature = agent.sign(key, contents);
Buffer bs2 = new ByteArrayBuffer(keyType.length() + signature.length + Long.SIZE, false);

相关文章