@@ -68,7 +68,7 @@ func BootstrapCertTempl(nBef time.Time, nAft time.Time) (*x509.Certificate, erro
6868// the root certificate.
6969func CreateNodeCert (pathPrefix string , fileName string , rsaBits int , nBef time.Time , nAft time.Time , ipAdresses []string , rootCert * x509.Certificate , rootKey * rsa.PrivateKey ) error {
7070
71- stdlog .Printf ("[crypto.GeneratePKI] === Generating for %s ===\n " , fileName )
71+ stdlog .Printf ("[crypto.GeneratePKI] === Generating for %s ===" , fileName )
7272
7373 // Generate this node's key pair.
7474 key , err := rsa .GenerateKey (rand .Reader , rsaBits )
@@ -113,7 +113,7 @@ func CreateNodeCert(pathPrefix string, fileName string, rsaBits int, nBef time.T
113113 }
114114 certFile .Sync ()
115115
116- stdlog .Printf ("[crypto.GeneratePKI] Saved %s-cert.pem to disk.\n " , fileName )
116+ stdlog .Printf ("[crypto.GeneratePKI] Saved %s-cert.pem to disk." , fileName )
117117
118118 // Additionally, open file handle for node key.
119119 keyFile , err := os .OpenFile (fmt .Sprintf ("%sprivate/%s-key.pem" , pathPrefix , fileName ), (os .O_WRONLY | os .O_CREATE | os .O_TRUNC ), 0600 )
@@ -128,8 +128,8 @@ func CreateNodeCert(pathPrefix string, fileName string, rsaBits int, nBef time.T
128128 }
129129 keyFile .Sync ()
130130
131- stdlog .Printf ("[crypto.GeneratePKI] Saved %s-key.pem to disk.\n " , fileName )
132- stdlog .Printf ("[crypto.GeneratePKI] === Done generating for %s ===\n \n " , fileName )
131+ stdlog .Printf ("[crypto.GeneratePKI] Saved %s-key.pem to disk." , fileName )
132+ stdlog .Printf ("[crypto.GeneratePKI] === Done generating for %s ===" , fileName )
133133
134134 return nil
135135}
@@ -143,7 +143,7 @@ func main() {
143143 // Parse supplied command-line flags.
144144 flag .Parse ()
145145
146- stdlog .Println ("[crypto.GeneratePKI] Building pluto's internal PKI.\n " )
146+ stdlog .Println ("[crypto.GeneratePKI] Building pluto's internal PKI." )
147147
148148 if len (* validFrom ) == 0 {
149149
@@ -154,7 +154,7 @@ func main() {
154154 // If start date supplied, try to parse.
155155 notBefore , err = time .Parse ("Jan 2 15:04:05 2006" , * validFrom )
156156 if err != nil {
157- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to parse creation date of certificates: %s\n " , err .Error ())
157+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to parse creation date of certificates: %s" , err .Error ())
158158 }
159159 }
160160
@@ -172,7 +172,7 @@ func main() {
172172 // Generate root key pair.
173173 rootKey , err := rsa .GenerateKey (rand .Reader , * rsaBits )
174174 if err != nil {
175- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to generate root key: %s\n " , err .Error ())
175+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to generate root key: %s" , err .Error ())
176176 }
177177
178178 // Prepare to create the root certificate which will
@@ -190,26 +190,26 @@ func main() {
190190 // Create the actual root certificate.
191191 rootCertDER , err := x509 .CreateCertificate (rand .Reader , rootTemplate , rootTemplate , & rootKey .PublicKey , rootKey )
192192 if err != nil {
193- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to create DER byte representation of root certificate: %s\n " , err .Error ())
193+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to create DER byte representation of root certificate: %s" , err .Error ())
194194 }
195195
196196 // Parse root certificate again so that we can sign with it.
197197 rootCert , err := x509 .ParseCertificate (rootCertDER )
198198 if err != nil {
199- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to parse DER root certificate to x509 certificate: %s\n " , err .Error ())
199+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to parse DER root certificate to x509 certificate: %s" , err .Error ())
200200 }
201201
202202 // Open file handle to store root certificate at.
203203 rootCertFile , err := os .Create (fmt .Sprintf ("%sprivate/root-cert.pem" , * pathPrefix ))
204204 if err != nil {
205- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to open file for root certificate: %s\n " , err .Error ())
205+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to open file for root certificate: %s" , err .Error ())
206206 }
207207 defer rootCertFile .Close ()
208208
209209 // Encode it in PEM format and save to disk.
210210 err = pem .Encode (rootCertFile , & pem.Block {Type : "CERTIFICATE" , Bytes : rootCertDER })
211211 if err != nil {
212- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to write root certificate in PEM format to disk: %s\n " , err .Error ())
212+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to write root certificate in PEM format to disk: %s" , err .Error ())
213213 }
214214 rootCertFile .Sync ()
215215
@@ -218,18 +218,18 @@ func main() {
218218 // Additionally, open file handle for root key.
219219 rootKeyFile , err := os .OpenFile (fmt .Sprintf ("%sprivate/root-key.pem" , * pathPrefix ), (os .O_WRONLY | os .O_CREATE | os .O_TRUNC ), 0600 )
220220 if err != nil {
221- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to open file for root key: %s\n " , err .Error ())
221+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to open file for root key: %s" , err .Error ())
222222 }
223223
224224 // Encode it in PEM format and save to disk.
225225 err = pem .Encode (rootKeyFile , & pem.Block {Type : "RSA PRIVATE KEY" , Bytes : x509 .MarshalPKCS1PrivateKey (rootKey )})
226226 if err != nil {
227- stdlog .Fatalf ("[crypto.GeneratePKI] Failed to write root key in PEM format to disk: %s\n " , err .Error ())
227+ stdlog .Fatalf ("[crypto.GeneratePKI] Failed to write root key in PEM format to disk: %s" , err .Error ())
228228 }
229229 rootKeyFile .Sync ()
230230
231231 stdlog .Println ("[crypto.GeneratePKI] Saved root-key.pem to disk." )
232- stdlog .Println ("[crypto.GeneratePKI] === Done generating root certificate ===\n " )
232+ stdlog .Println ("[crypto.GeneratePKI] === Done generating root certificate ===" )
233233
234234 // Generate distributor's internal key and signed certificate.
235235 err = CreateNodeCert (* pathPrefix , "internal-distributor" , * rsaBits , notBefore , notAfter , []string {config .Distributor .PublicIP }, rootCert , rootKey )
0 commit comments