code: func (c *client) insertKey(s interface{}, comment string) error {
  	var req []byte
  	switch k := s.(type) {
  	case *rsa.PrivateKey:
  		if len(k.Primes) != 2 {
  			return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
  		}
  		k.Precompute()
  		req = ssh.Marshal(rsaKeyMsg{
  			Type:     ssh.KeyAlgoRSA,
  			N:        k.N,
  			E:        big.NewInt(int64(k.E)),
  			D:        k.D,
  			Iqmp:     k.Precomputed.Qinv,
  			P:        k.Primes[0],
  			Q:        k.Primes[1],
  			Comments: comment,
  		})
  	case *dsa.PrivateKey:
  		req = ssh.Marshal(dsaKeyMsg{
  			Type:     ssh.KeyAlgoDSA,
  			P:        k.P,
  			Q:        k.Q,
  			G:        k.G,
  			Y:        k.Y,
  			X:        k.X,
  			Comments: comment,
  		})
  	case *ecdsa.PrivateKey:
  		nistID := fmt.Sprintf("nistp%d", k.Params().BitSize)
  		req = ssh.Marshal(ecdsaKeyMsg{
  			Type:     "ecdsa-sha2-" + nistID,
  			Curve:    nistID,
  			KeyBytes: elliptic.Marshal(k.Curve, k.X, k.Y),
  			D:        k.D,
  			Comments: comment,
  		})
  	default:
  		return fmt.Errorf("agent: unsupported key type %T", s)
  	}
  	resp, err := c.call(req)
  	if err != nil {
  		return err
  	}
  	if _, ok := resp.(*successAgentMsg); ok {
  		return nil
  	}
  	return errors.New("agent: failure")
  }
docs: // Insert adds a private key to the agent.