@@ -19,8 +19,6 @@ package dynamiccertificates
19
19
import (
20
20
"crypto/tls"
21
21
"crypto/x509"
22
- "fmt"
23
- "io/ioutil"
24
22
)
25
23
26
24
type staticCAContent struct {
@@ -30,19 +28,6 @@ type staticCAContent struct {
30
28
31
29
var _ CAContentProvider = & staticCAContent {}
32
30
33
- // NewStaticCAContentFromFile returns a CAContentProvider based on a filename
34
- func NewStaticCAContentFromFile (filename string ) (CAContentProvider , error ) {
35
- if len (filename ) == 0 {
36
- return nil , fmt .Errorf ("missing filename for ca bundle" )
37
- }
38
-
39
- caBundle , err := ioutil .ReadFile (filename )
40
- if err != nil {
41
- return nil , err
42
- }
43
- return NewStaticCAContent (filename , caBundle )
44
- }
45
-
46
31
// NewStaticCAContent returns a CAContentProvider that always returns the same value
47
32
func NewStaticCAContent (name string , caBundle []byte ) (CAContentProvider , error ) {
48
33
caBundleAndVerifier , err := newCABundleAndVerifier (name , caBundle )
@@ -81,48 +66,6 @@ type staticSNICertKeyContent struct {
81
66
sniNames []string
82
67
}
83
68
84
- // NewStaticCertKeyContentFromFiles returns a CertKeyContentProvider based on a filename
85
- func NewStaticCertKeyContentFromFiles (certFile , keyFile string ) (CertKeyContentProvider , error ) {
86
- if len (certFile ) == 0 {
87
- return nil , fmt .Errorf ("missing filename for certificate" )
88
- }
89
- if len (keyFile ) == 0 {
90
- return nil , fmt .Errorf ("missing filename for key" )
91
- }
92
-
93
- certPEMBlock , err := ioutil .ReadFile (certFile )
94
- if err != nil {
95
- return nil , err
96
- }
97
- keyPEMBlock , err := ioutil .ReadFile (keyFile )
98
- if err != nil {
99
- return nil , err
100
- }
101
-
102
- return NewStaticCertKeyContent (fmt .Sprintf ("cert: %s, key: %s" , certFile , keyFile ), certPEMBlock , keyPEMBlock )
103
- }
104
-
105
- // NewStaticSNICertKeyContentFromFiles returns a SNICertKeyContentProvider based on a filename
106
- func NewStaticSNICertKeyContentFromFiles (certFile , keyFile string , sniNames ... string ) (SNICertKeyContentProvider , error ) {
107
- if len (certFile ) == 0 {
108
- return nil , fmt .Errorf ("missing filename for certificate" )
109
- }
110
- if len (keyFile ) == 0 {
111
- return nil , fmt .Errorf ("missing filename for key" )
112
- }
113
-
114
- certPEMBlock , err := ioutil .ReadFile (certFile )
115
- if err != nil {
116
- return nil , err
117
- }
118
- keyPEMBlock , err := ioutil .ReadFile (keyFile )
119
- if err != nil {
120
- return nil , err
121
- }
122
-
123
- return NewStaticSNICertKeyContent (fmt .Sprintf ("cert: %s, key: %s" , certFile , keyFile ), certPEMBlock , keyPEMBlock , sniNames ... )
124
- }
125
-
126
69
// NewStaticCertKeyContent returns a CertKeyContentProvider that always returns the same value
127
70
func NewStaticCertKeyContent (name string , cert , key []byte ) (CertKeyContentProvider , error ) {
128
71
// Ensure that the key matches the cert and both are valid
0 commit comments