MCPcopy Create free account
hub / github.com/anchordotdev/cli / checkCA

Method checkCA

truststore/platform_linux.go:88–112  ·  view source on GitHub ↗
(ca *CA)

Source from the content-addressed store, hash-verified

86}
87
88func (s *Platform) checkCA(ca *CA) (bool, error) {
89 if ok, err := s.check(); !ok {
90 return ok, err
91 }
92
93 buf, err := s.DataFS.ReadFile(s.trustFilenamePath(ca))
94 if err != nil {
95 if errors.Is(err, syscall.ENOENT) {
96 return false, nil
97 }
98 return false, err
99 }
100
101 var blk *pem.Block
102 for len(buf) > 0 {
103 if blk, buf = pem.Decode(buf); blk == nil {
104 return false, nil
105 }
106
107 if bytes.Equal(ca.Raw, blk.Bytes) {
108 return true, nil
109 }
110 }
111 return false, nil
112}
113
114func (s *Platform) installCA(ca *CA) (bool, error) {
115 cert, err := os.ReadFile(ca.FilePath)

Callers 1

CheckCAMethod · 0.95

Calls 4

checkMethod · 0.95
trustFilenamePathMethod · 0.95
EqualMethod · 0.80
ReadFileMethod · 0.45

Tested by

no test coverage detected