Reviewers: golang-dev_googlegroups.com,
Message:
Hello golang-dev (cc: [email protected], rsc),
I'd like you to review this change to
https://code.google.com/p/go
Description:
crypto/x509: add Plan 9 root certificate location
Please review this at http://codereview.appspot.com/6571056/
Affected files:
A src/pkg/crypto/x509/root_plan9.go
M src/pkg/crypto/x509/root_stub.go
Index: src/pkg/crypto/x509/root_plan9.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/pkg/crypto/x509/root_plan9.go
@@ -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: src/pkg/crypto/x509/root_stub.go
===================================================================
--- a/src/pkg/crypto/x509/root_stub.go
+++ b/src/pkg/crypto/x509/root_stub.go
@@ -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