Closed
Description
What version of Go are you using (go version
)?
1.8
What operating system and processor architecture are you using (go env
)?
debian9 lxc (no certificates on the system) / amd64
What did you do?
https://play.golang.org/p/9uFYp2M6PT
What did you expect to see?
I expected to have either an error or an empty certPool
What did you see instead?
both CertPool and error are nil when there is no certificates found on the system
If you think this is the correct behavior maybe add a small warning in the documentation
Regards
Etienne
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
nussjustin commentedon Aug 11, 2017
This only affects Unix and Plan9, all other operating systems will return an empty pool when no certificates are found from what I see.
shreyas1996 commentedon Aug 13, 2017
As you can see,this is the output we get when we run it on a windows based system..
Here is the source code for the function you used..
https://golang.org/src/crypto/x509/cert_pool.go?s=730:770#L22
there it is..
this might be the expected output.
i hope u got the doubt.. if not please help me understand it using a suitable use case
Regards
Shreyas
nussjustin commentedon Aug 13, 2017
@shreyas1996 Using SystemCertPool under Windows is issue #16736, see the issue description in #18609 for the basic problem with it unter windows. This issue is about a (nil, nil) return value under Unix (and Plan 9)
shreyas1996 commentedon Aug 13, 2017
oh okay.. i will check that too
But as stated above by @champtar used that function.. i thought maybe he/she was concerned as to why such an output was displayed when the expected one is different.
anyways,thanks for pointing it out @nussjustin
[-]x509.SystemCertPool() can return nil,nil[/-][+]crypto/x509: SystemCertPool() can return nil,nil[/+]gopherbot commentedon Mar 30, 2018
Change https://golang.org/cl/103596 mentions this issue:
crypto/x509: don't return nil, nil from SystemCertPool