]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/x509: add Plan 9 root certificate location
authorDavid du Colombier <0intro@gmail.com>
Wed, 26 Sep 2012 18:47:47 +0000 (14:47 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 26 Sep 2012 18:47:47 +0000 (14:47 -0400)
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/6571056

src/pkg/crypto/x509/root_plan9.go [new file with mode: 0644]
src/pkg/crypto/x509/root_stub.go

diff --git a/src/pkg/crypto/x509/root_plan9.go b/src/pkg/crypto/x509/root_plan9.go
new file mode 100644 (file)
index 0000000..677927a
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build plan9
+
+package x509
+
+import "io/ioutil"
+
+// Possible certificate files; stop after finding one.
+var certFiles = []string{
+       "/sys/lib/tls/ca.pem",
+}
+
+func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
+       return nil, nil
+}
+
+func initSystemRoots() {
+       roots := NewCertPool()
+       for _, file := range certFiles {
+               data, err := ioutil.ReadFile(file)
+               if err == nil {
+                       roots.AppendCertsFromPEM(data)
+                       break
+               }
+       }
+
+       systemRoots = roots
+}
index 568004108b538e8858e70b6656987314a7a8cf41..756732f7d4ffb8f74962302b5ad6a3c60a94de2a 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build plan9 darwin,!cgo
+// +build darwin,!cgo
 
 package x509