LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package x509 | 5 package x509 |
6 | 6 |
7 import ( | 7 import ( |
8 "crypto/x509/pkix" | 8 "crypto/x509/pkix" |
9 "encoding/pem" | 9 "encoding/pem" |
10 "errors" | 10 "errors" |
(...skipping 17 matching lines...) Expand all Loading... |
28 expectedChains [][]string | 28 expectedChains [][]string |
29 } | 29 } |
30 | 30 |
31 var verifyTests = []verifyTest{ | 31 var verifyTests = []verifyTest{ |
32 { | 32 { |
33 leaf: googleLeaf, | 33 leaf: googleLeaf, |
34 intermediates: []string{thawteIntermediate}, | 34 intermediates: []string{thawteIntermediate}, |
35 currentTime: 1302726541, | 35 currentTime: 1302726541, |
36 dnsName: "www.google.com", | 36 dnsName: "www.google.com", |
37 testSystemRootsError: true, | 37 testSystemRootsError: true, |
38 systemSkip: true, | |
39 | 38 |
40 // Without any roots specified we should get a system roots | 39 // Without any roots specified we should get a system roots |
41 // error. | 40 // error. |
42 errorCallback: expectSystemRootsError, | 41 errorCallback: expectSystemRootsError, |
43 }, | 42 }, |
44 { | 43 { |
45 leaf: googleLeaf, | 44 leaf: googleLeaf, |
46 intermediates: []string{thawteIntermediate}, | 45 intermediates: []string{thawteIntermediate}, |
47 roots: []string{verisignRoot}, | 46 roots: []string{verisignRoot}, |
48 currentTime: 1302726541, | 47 currentTime: 1302726541, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 block, _ := pem.Decode([]byte(pemBytes)) | 204 block, _ := pem.Decode([]byte(pemBytes)) |
206 if block == nil { | 205 if block == nil { |
207 return nil, errors.New("failed to decode PEM") | 206 return nil, errors.New("failed to decode PEM") |
208 } | 207 } |
209 return ParseCertificate(block.Bytes) | 208 return ParseCertificate(block.Bytes) |
210 } | 209 } |
211 | 210 |
212 func testVerify(t *testing.T, useSystemRoots bool) { | 211 func testVerify(t *testing.T, useSystemRoots bool) { |
213 for i, test := range verifyTests { | 212 for i, test := range verifyTests { |
214 if useSystemRoots && test.systemSkip { | 213 if useSystemRoots && test.systemSkip { |
| 214 continue |
| 215 } |
| 216 if runtime.GOOS == "windows" && test.testSystemRootsError { |
215 continue | 217 continue |
216 } | 218 } |
217 | 219 |
218 opts := VerifyOptions{ | 220 opts := VerifyOptions{ |
219 Intermediates: NewCertPool(), | 221 Intermediates: NewCertPool(), |
220 DNSName: test.dnsName, | 222 DNSName: test.dnsName, |
221 CurrentTime: time.Unix(test.currentTime, 0), | 223 CurrentTime: time.Unix(test.currentTime, 0), |
222 KeyUsages: test.keyUsages, | 224 KeyUsages: test.keyUsages, |
223 } | 225 } |
224 | 226 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 MD4wPAYEVR0gADA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWdu | 556 MD4wPAYEVR0gADA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWdu |
555 LmNvbS9yZXBvc2l0b3J5LzAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmds | 557 LmNvbS9yZXBvc2l0b3J5LzAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmds |
556 b2JhbHNpZ24ubmV0L3Jvb3QuY3JsMB8GA1UdIwQYMBaAFGB7ZhpFDZfKiVAvfQTN | 558 b2JhbHNpZ24ubmV0L3Jvb3QuY3JsMB8GA1UdIwQYMBaAFGB7ZhpFDZfKiVAvfQTN |
557 NKj//P1LMA0GCSqGSIb3DQEBBQUAA4IBAQBDc3nMpMxJMQMcYUCB3+C73UpvwDE8 | 559 NKj//P1LMA0GCSqGSIb3DQEBBQUAA4IBAQBDc3nMpMxJMQMcYUCB3+C73UpvwDE8 |
558 eCOr7t2F/u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