我试图用Java实现SSH2密钥交换,并遇到一些困难。 RFC4419表示:
服务器响应:
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();