title: TLS clientAuth requires ExtKeyUsageClientAuth through whole certificate chain
body: <p>I'm trying out TLS client authentication using go. It worked fine when I created a simple self-signed client certificate with ExtKeyUsageClientAuth set, but when a client tries to connect with a longer certificate chain:</p>
  
  <p>CA -> intermediate -> client </p>
  
  <p>I get the following error: <code>x509: certificate specifies an incompatible key usage</code></p>
  
  <p>The relevant calls are</p>
  
  <p><a href="http://golang.org/src/pkg/crypto/tls/handshake_server.go" rel="noreferrer">handshake_server.go:</a> <code>processCertsFromClient()</code></p>
  
  <p><a href="http://golang.org/src/pkg/crypto/x509/verify.go" rel="noreferrer">verify.go:</a> <code>checkChainForKeyUsage()</code></p>
  
  <p>and if I'm reading the code right it looks like every single certificate in my chain must have the client auth extended key set.</p>
  
  <p>I'm no x509 expert but that seems like a strange requirement, I've never seen a CA or an intermediate certificate that had client auth set. I don’t see how can you be expected to configure a long lived CA to handle all possible future key usages.  </p>
  
  <p>So where's the mistake? </p>
  
  <p>I can think of a few possibilities</p>
  
  <ol>
  <li>I don’t understand TLS (likely)</li>
  <li>my assumption that client auth works much like server auth is wrong</li>
  <li>I’m reading the code wrong</li>
  <li>my tls server is misconfigured</li>
  <li>golang's TLS client auth implementation is wrong</li>
  </ol>