This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 277
/
types.go
62 lines (47 loc) · 1.53 KB
/
types.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Package tresor implements the certificate.Manager interface for Tresor, a custom certificate provider in OSM.
package tresor
import (
"math/big"
"sync"
"time"
"github.com/openservicemesh/osm/pkg/certificate"
"github.com/openservicemesh/osm/pkg/certificate/pem"
"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/logger"
)
const (
// How many bits to use for the RSA key
rsaBits = 2048
// How many bits in the certificate serial number
certSerialNumberBits = 128
)
var (
log = logger.New("tresor")
serialNumberLimit = new(big.Int).Lsh(big.NewInt(1), certSerialNumberBits)
)
// CertManager implements certificate.Manager
type CertManager struct {
// The Certificate Authority root certificate to be used by this certificate manager
ca certificate.Certificater
// Cache for all the certificates issued
// Types: map[certificate.CommonName]certificate.Certificater
cache sync.Map
certificatesOrganization string
cfg configurator.Configurator
serviceCertValidityDuration time.Duration
keySize int
}
// Certificate implements certificate.Certificater
type Certificate struct {
// The commonName of the certificate
commonName certificate.CommonName
// The serial number of the certificate
serialNumber certificate.SerialNumber
// When the cert expires
expiration time.Time
// PEM encoded Certificate and Key (byte arrays)
certChain pem.Certificate
privateKey pem.PrivateKey
// Certificate authority signing this certificate
issuingCA pem.RootCertificate
}