Come viene composto "chiave e certificati dell'host pubblico (K_S)" nel messaggio SSH_MSG_KEX_DH_GEX_REPLY? (Scambio di chiavi SSH2)

2

Sto cercando di implementare lo scambio di chiavi SSH2 in Java e di avere alcune difficoltà. RFC4419 afferma che:

The server responds with:

 byte    SSH_MSG_KEX_DH_GEX_REPLY
 string  server public host key and certificates (K_S)
 mpint   f
 string  signature of H

La mia domanda è: come deve essere composta la "chiave pubblica server e i certificati (K_S)"? Dove posso trovare queste informazioni?

Ho una chiave pubblica e privata host e posso leggere tutte le informazioni necessarie come ad esempio:

/*
 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();
    
posta Ernestas Gruodis 29.04.2015 - 15:56
fonte

1 risposta

1

Ho trovato la risposta io stesso in RFC4253 :

Signatures are encoded as follows:

  string    signature format identifier (as specified by the
            public key/certificate format)
  byte[n]   signature blob in format specific encoding.

The "ssh-dss" key format has the following specific encoding:

  string    "ssh-dss"
  mpint     p
  mpint     q
  mpint     g
  mpint     y

Here, the 'p', 'q', 'g', and 'y' parameters form the signature key blob.

Formati di firma:

The following public key and/or certificate formats are currently defined:

   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)
    
risposta data 29.04.2015 - 17:27
fonte

Leggi altre domande sui tag