code: func DefaultSigAlgo(priv crypto.Signer) x509.SignatureAlgorithm {
  	pub := priv.Public()
  	switch pub := pub.(type) {
  	case *rsa.PublicKey:
  		keySize := pub.N.BitLen()
  		switch {
  		case keySize >= 4096:
  			return x509.SHA512WithRSA
  		case keySize >= 3072:
  			return x509.SHA384WithRSA
  		case keySize >= 2048:
  			return x509.SHA256WithRSA
  		default:
  			return x509.SHA1WithRSA
  		}
  	case *ecdsa.PublicKey:
  		switch pub.Curve {
  		case elliptic.P256():
  			return x509.ECDSAWithSHA256
  		case elliptic.P384():
  			return x509.ECDSAWithSHA384
  		case elliptic.P521():
  			return x509.ECDSAWithSHA512
  		default:
  			return x509.ECDSAWithSHA1
  		}
  	default:
  		return x509.UnknownSignatureAlgorithm
  	}
  }
docs: // DefaultSigAlgo returns an appropriate X.509 signature algorithm given
  // the CA's private key.