<dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
<dd>
- <p> <!-- CL 30578 -->
- <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a>
- is now implemented on Windows.
- </p>
-
<p> <!-- CL 24743 -->
PSS signatures are now supported.
</p>
package x509
-import "encoding/pem"
+import (
+ "encoding/pem"
+ "errors"
+ "runtime"
+)
// CertPool is a set of certificates.
type CertPool struct {
// Any mutations to the returned pool are not written to disk and do
// not affect any other pool.
func SystemCertPool() (*CertPool, error) {
+ if runtime.GOOS == "windows" {
+ // Issue 16736, 18609:
+ return nil, errors.New("crypto/x509: system root pool is not available on Windows")
+ }
+
return loadSystemRoots()
}
}
func loadSystemRoots() (*CertPool, error) {
+ // TODO: restore this functionality on Windows. We tried to do
+ // it in Go 1.8 but had to revert it. See Issue 18609.
+ // Returning (nil, nil) was the old behavior, prior to CL 30578.
+ return nil, nil
+
const CRYPT_E_NOT_FOUND = 0x80092004
store, err := syscall.CertOpenSystemStore(0, syscall.StringToUTF16Ptr("ROOT"))
"net"
"os/exec"
"reflect"
+ "runtime"
"strings"
"testing"
"time"
}
func TestSystemCertPool(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("not implemented on Windows; Issue 16736, 18609")
+ }
_, err := SystemCertPool()
if err != nil {
t.Fatal(err)