Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “是如何组成的”;公共主机密钥和证书(KU S)“;在SSH_MSG_KEX_DH_GEX_回复消息中?(SSH2密钥交换)_Java_Ssh - Fatal编程技术网

Java “是如何组成的”;公共主机密钥和证书(KU S)“;在SSH_MSG_KEX_DH_GEX_回复消息中?(SSH2密钥交换)

Java “是如何组成的”;公共主机密钥和证书(KU S)“;在SSH_MSG_KEX_DH_GEX_回复消息中?(SSH2密钥交换),java,ssh,Java,Ssh,我试图用Java实现SSH2密钥交换,但遇到了一些困难。缔约国表示: 服务器响应为: byte SSH_MSG_KEX_DH_GEX_REPLY string server public host key and certificates (K_S) mpint f string signature of H 我的问题是,“服务器公共主机密钥和证书(K_S)”应该如何组成?我在哪里可以找到这些信息 我拥有主机公钥和私钥,可以读取所需的所有信息,例如: /* Read t

我试图用Java实现SSH2密钥交换,但遇到了一些困难。缔约国表示:

服务器响应为:

 byte    SSH_MSG_KEX_DH_GEX_REPLY
 string  server public host key and certificates (K_S)
 mpint   f
 string  signature of H
我的问题是,“服务器公共主机密钥和证书(K_S)”应该如何组成?我在哪里可以找到这些信息

我拥有主机公钥和私钥,可以读取所需的所有信息,例如:

/*
 Read the required variables from the public key.
 */
DSAParams pubKeyDSAParams = ((DSAPublicKey) pair.getPublic()).getParams();
BigInteger p = pubKeyDSAParams.getP();
BigInteger q = pubKeyDSAParams.getQ();
BigInteger g = pubKeyDSAParams.getG();

/*
Read the private exponent from the private key.
 */
DSAPrivateKey privKey = (DSAPrivateKey) pair.getPrivate();
BigInteger x = privKey.getX();

我自己找到了答案:

签名编码如下:

  string    signature format identifier (as specified by the
            public key/certificate format)
  byte[n]   signature blob in format specific encoding.
“ssh dss”密钥格式具有以下特定编码:

  string    "ssh-dss"
  mpint     p
  mpint     q
  mpint     g
  mpint     y
这里,“p”、“q”、“g”和“y”参数构成签名密钥 斑点

签名格式:

当前正在使用以下公钥和/或证书格式 定义:

   ssh-dss           REQUIRED     sign   Raw DSS Key
   ssh-rsa           RECOMMENDED  sign   Raw RSA Key
   pgp-sign-rsa      OPTIONAL     sign   OpenPGP certificates (RSA key)
   pgp-sign-dss      OPTIONAL     sign   OpenPGP certificates (DSS key)