MCPcopy Index your code
hub / github.com/cortexproject/cortex / New

Function New

integration/ca/ca.go:23–47  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

21}
22
23func New(name string) *CA {
24 key, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
25 if err != nil {
26 panic(err)
27 }
28
29 return &CA{
30 key: key,
31 cert: &x509.Certificate{
32 SerialNumber: big.NewInt(1),
33 Subject: pkix.Name{
34 Organization: []string{name},
35 },
36 NotBefore: time.Now(),
37 NotAfter: time.Now().Add(time.Hour * 24 * 180),
38
39 KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
40 ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
41 BasicConstraintsValid: true,
42 IsCA: true,
43 },
44 serial: big.NewInt(2),
45 }
46
47}
48
49func writeExclusivePEMFile(path, marker string, mode os.FileMode, data []byte) (err error) {
50 f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL, mode)

Callers 5

testSingleBinaryEnvFunction · 0.92
TestRulerAlertmanagerTLSFunction · 0.92
TestGetConsulConfigFunction · 0.92
setupCertificatesFunction · 0.92

Calls 1

AddMethod · 0.45

Tested by 5

testSingleBinaryEnvFunction · 0.74
TestRulerAlertmanagerTLSFunction · 0.74
TestGetConsulConfigFunction · 0.74
setupCertificatesFunction · 0.74