Skip to content

crypto/x509: confusing error for missing hash function #5058

Description

@rsc
Someone tried to validate a cert using SHA-512 without crypto/sha512 linked in. The
error was "x509: certificate signed by unknown authority."


---------- Forwarded message ----------
From: Mike Lewis <mikelikespie@gmail.com>
Date: Wed, Mar 13, 2013 at 2:44 PM
Subject: [go-nuts] Non-Obvious Failure with x509 and custom root CAs
To: golang-nuts@googlegroups.com


Hi,

Long story short:
I was trying do http Get against a url with a custom root CA (that was on my keychain). 
Received "x509: certificate signed by unknown authority."

Ended up going x509 code and ended up landing in x509.go where hashType.Available() was
returning false.

Our CA was using SHA512.  The workaround for me was to 'import _
"crypto/sha512"' in my code.  However, this was anything but intuitive.  I
basically had to add a bunch of print statements throughout go's source code to figure
out where it was failing.

Is this documented anywhere?  Or is this a bug?  Basically the http library will fail on
any root certs that use algos that aren't imported by a transitive dependency and will
give a very obscure error.

Thanks,
Mike

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions