cloudflare/cfssl_trust

Public

mirrored from https://github.com/cloudflare/cfssl_trustAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
f95cb288cfce97fcc2538a97adcd00a2e95c1fca

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

certdata/sanity_test.go

58lines · modecode

1package main
2
3import (
4 "os"
5 "path/filepath"
6 "testing"
7
8 "github.com/cloudflare/cfssl/helpers"
9 "github.com/cloudflare/cfssl/ubiquity"
10)
11
12var metadataFiles = []string{
13 "../ca-bundle.crt.metadata",
14}
15
16func TestMetadataFormat(t *testing.T) {
17 for _, file := range metadataFiles {
18 if err := ubiquity.LoadPlatforms(file); err != nil {
19 t.Fatal(err)
20 }
21 }
22}
23
24var bundleFiles = []string{
25 "../ca-bundle.crt",
26 "../int-bundle.crt",
27}
28
29func TestParseBundles(t *testing.T) {
30 for _, file := range bundleFiles {
31 if _, err := helpers.LoadPEMCertPool(file); err != nil {
32 t.Fatal(err)
33 }
34 }
35}
36
37var trustedRootDirs = []string{
38 "trusted_roots",
39}
40
41func TestParseTrustedRoots(t *testing.T) {
42 for _, dir := range trustedRootDirs {
43 err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
44 if err != nil || info.IsDir() {
45 return err
46 }
47
48 if _, err := helpers.LoadPEMCertPool(path); err != nil {
49 t.Fatal(err)
50 }
51
52 return nil
53 })
54 if err != nil {
55 t.Fatal(err)
56 }
57 }
58}
59