@@ -317,65 +317,9 @@ func Listen(host string, port int, ciphers, keyExchanges, macs []string) {
317
317
}
318
318
}
319
319
320
- // Workaround slightly broken behaviour in x/crypto/ssh/handshake.go:458-463
321
- //
322
- // Fundamentally the issue here is that HostKeyAlgos make the incorrect assumption
323
- // that the PublicKey().Type() matches the signature algorithm.
324
- //
325
- // Therefore we need to add duplicates for the RSA with different signing algorithms.
326
- signers := make ([]ssh.Signer , 0 , len (srv .HostSigners ))
327
- for _ , signer := range srv .HostSigners {
328
- if signer .PublicKey ().Type () == "ssh-rsa" {
329
- signers = append (signers ,
330
- & wrapSigner {
331
- Signer : signer ,
332
- algorithm : gossh .KeyAlgoRSASHA512 ,
333
- },
334
- & wrapSigner {
335
- Signer : signer ,
336
- algorithm : gossh .KeyAlgoRSASHA256 ,
337
- },
338
- )
339
- }
340
- signers = append (signers , signer )
341
- }
342
- srv .HostSigners = signers
343
-
344
320
go listen (& srv )
345
321
}
346
322
347
- // wrapSigner wraps a signer and overrides its public key type with the provided algorithm
348
- type wrapSigner struct {
349
- ssh.Signer
350
- algorithm string
351
- }
352
-
353
- // PublicKey returns an associated PublicKey instance.
354
- func (s * wrapSigner ) PublicKey () gossh.PublicKey {
355
- return & wrapPublicKey {
356
- PublicKey : s .Signer .PublicKey (),
357
- algorithm : s .algorithm ,
358
- }
359
- }
360
-
361
- // Sign returns raw signature for the given data. This method
362
- // will apply the hash specified for the keytype to the data using
363
- // the algorithm assigned for this key
364
- func (s * wrapSigner ) Sign (rand io.Reader , data []byte ) (* gossh.Signature , error ) {
365
- return s .Signer .(gossh.AlgorithmSigner ).SignWithAlgorithm (rand , data , s .algorithm )
366
- }
367
-
368
- // wrapPublicKey wraps a PublicKey and overrides its type
369
- type wrapPublicKey struct {
370
- gossh.PublicKey
371
- algorithm string
372
- }
373
-
374
- // Type returns the algorithm
375
- func (k * wrapPublicKey ) Type () string {
376
- return k .algorithm
377
- }
378
-
379
323
// GenKeyPair make a pair of public and private keys for SSH access.
380
324
// Public key is encoded in the format for inclusion in an OpenSSH authorized_keys file.
381
325
// Private Key generated is PEM encoded
0 commit comments