aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/certifi/cas.go
blob: a195e28a54ff75da42aaa38b4e06766024a4c747 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package certifi

import (
	"crypto/x509"
	"sync"

	"a.yandex-team.ru/library/go/certifi/internal/certs"
)

var (
	internalOnce sync.Once
	commonOnce   sync.Once
	internalCAs  []*x509.Certificate
	commonCAs    []*x509.Certificate
)

// InternalCAs returns list of Yandex Internal certificates
func InternalCAs() []*x509.Certificate {
	internalOnce.Do(initInternalCAs)
	return internalCAs
}

// CommonCAs returns list of common certificates
func CommonCAs() []*x509.Certificate {
	commonOnce.Do(initCommonCAs)
	return commonCAs
}

func initInternalCAs() {
	internalCAs = certsFromPEM(certs.InternalCAs())
}

func initCommonCAs() {
	commonCAs = certsFromPEM(certs.CommonCAs())
}