@@ -95,9 +95,9 @@ const (
95
95
KeyTypeRSA
96
96
)
97
97
98
- // TLSCertificate returns Certificate as tls.Certificate.
98
+ // TLSCertificate returns the Certificate as tls.Certificate.
99
99
// A key pair and certificate will be generated at first call of any Certificate functions.
100
- // Error is returned if generation fails.
100
+ // Error is not nil if generation fails.
101
101
func (c * Certificate ) TLSCertificate () (tls.Certificate , error ) {
102
102
err := c .ensureGenerated ()
103
103
if err != nil {
@@ -106,9 +106,9 @@ func (c *Certificate) TLSCertificate() (tls.Certificate, error) {
106
106
return * c .GeneratedCert , nil
107
107
}
108
108
109
- // X509Certificate returns Certificate as x509.Certificate.
109
+ // X509Certificate returns the Certificate as x509.Certificate.
110
110
// A key pair and certificate will be generated at first call of any Certificate functions.
111
- // Error is returned if generation fails.
111
+ // Error is not nil if generation fails.
112
112
func (c * Certificate ) X509Certificate () (x509.Certificate , error ) {
113
113
err := c .ensureGenerated ()
114
114
if err != nil {
@@ -118,9 +118,9 @@ func (c *Certificate) X509Certificate() (x509.Certificate, error) {
118
118
return * cert , err
119
119
}
120
120
121
- // PublicKey returns crypto.PublicKey associated to Certificate.
121
+ // PublicKey returns crypto.PublicKey associated to the Certificate.
122
122
// A key pair and certificate will be generated at first call of any Certificate functions.
123
- // Error is returned if generation fails.
123
+ // Error is not nil if generation fails.
124
124
func (c * Certificate ) PublicKey () (crypto.PublicKey , error ) {
125
125
err := c .ensureGenerated ()
126
126
if err != nil {
@@ -129,9 +129,9 @@ func (c *Certificate) PublicKey() (crypto.PublicKey, error) {
129
129
return c .GeneratedCert .PrivateKey .(crypto.Signer ).Public (), nil
130
130
}
131
131
132
- // PEM returns Certificate as certificate and private key PEM buffers.
132
+ // PEM returns the Certificate as certificate and private key PEM buffers.
133
133
// A key pair and certificate will be generated at first call of any Certificate functions.
134
- // Error is returned if generation fails.
134
+ // Error is not nil if generation fails.
135
135
func (c * Certificate ) PEM () (cert []byte , key []byte , err error ) {
136
136
err = c .ensureGenerated ()
137
137
if err != nil {
@@ -169,9 +169,9 @@ func (c *Certificate) PEM() (cert []byte, key []byte, err error) {
169
169
return
170
170
}
171
171
172
- // WritePEM writes Certificate as certificate and private key PEM files.
172
+ // WritePEM writes the Certificate as certificate and private key PEM files.
173
173
// A key pair and certificate will be generated at first call of any Certificate functions.
174
- // Error is returned if generation fails.
174
+ // Error is not nil if generation fails.
175
175
func (c * Certificate ) WritePEM (certFile , keyFile string ) error {
176
176
err := c .ensureGenerated ()
177
177
if err != nil {
@@ -240,11 +240,11 @@ func (c *Certificate) ensureGenerated() error {
240
240
return nil
241
241
}
242
242
243
- // Generate forces re-generation of key pair and certificate according to current state of Certificate.
243
+ // Generate forces re-generation of key pair and certificate according to current state of the Certificate.
244
244
// Usually it is automatically called when necessary, e.g. PEM() will internally call Generate().
245
- // It can be called explicitly when Certificate fields have been changed since certificate was last generated,
246
- // or if a new certificate is needed.
247
- // Error is returned if generation fails.
245
+ // It can be called explicitly after changing Certificate fields since certificate was last generated,
246
+ // or when a new certificate with same values is needed.
247
+ // Error is not nil if generation fails.
248
248
func (c * Certificate ) Generate () error {
249
249
// Traverse the certificate hierarchy recursively to ensure issuing CAs have been generated as well.
250
250
if c .Issuer != nil {
0 commit comments