Use go-jwt for more control The x5c[0] cert is now checked against the known intermediates and the x5c[1:] certs.