commit
e6435f3f44
|
@ -1,4 +1,12 @@
|
||||||
|
|
||||||
|
#### **Version v0.1.0**
|
||||||
|
|
||||||
|
##### FEATURES
|
||||||
|
|
||||||
|
BUGS
|
||||||
|
* Fixed the bundle format to produce four file, a bundle with cert+ca, and the FILENAME-ca.pem, FILENAME-key.pem,
|
||||||
|
and the FILENAME.pem certificate
|
||||||
|
|
||||||
#### **Version v0.0.9-1**
|
#### **Version v0.0.9-1**
|
||||||
|
|
||||||
##### FEATURES
|
##### FEATURES
|
||||||
|
|
27
formats.go
27
formats.go
|
@ -90,18 +90,33 @@ func writeCertificateFile(filename string, data map[string]interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeCertificateBundleFile(filename string, data map[string]interface{}) error {
|
func writeCertificateBundleFile(filename string, data map[string]interface{}) error {
|
||||||
certificateFile := fmt.Sprintf("%s.crt", filename)
|
bundleFile := fmt.Sprintf("%s-bundle.pem", filename)
|
||||||
caFile := fmt.Sprintf("%s.ca", filename)
|
keyFile := fmt.Sprintf("%s-key.pem", filename)
|
||||||
certificate := fmt.Sprintf("%s\n\n%s", data["certificate"], data["private_key"])
|
caFile := fmt.Sprintf("%s-ca.pem", filename)
|
||||||
ca := fmt.Sprintf("%s", data["issuing_ca"])
|
certFile := fmt.Sprintf("%s.pem", filename)
|
||||||
|
|
||||||
if err := writeFile(certificateFile, []byte(certificate)); err != nil {
|
bundle := fmt.Sprintf("%s\n\n%s", data["certificate"], data["issuing_ca"])
|
||||||
|
key := fmt.Sprintf("%s\n", data["private_key"])
|
||||||
|
ca := fmt.Sprintf("%s\n", data["issuing_ca"])
|
||||||
|
certificate := fmt.Sprintf("%s\n", data["certificate"])
|
||||||
|
|
||||||
|
if err := writeFile(bundleFile, []byte(bundle)); err != nil {
|
||||||
glog.Errorf("failed to write the bundled certificate file, error: %s", err)
|
glog.Errorf("failed to write the bundled certificate file, error: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := writeFile(certFile, []byte(certificate)); err != nil {
|
||||||
|
glog.Errorf("failed to write the certificate file, errro: %s", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if err := writeFile(caFile, []byte(ca)); err != nil {
|
if err := writeFile(caFile, []byte(ca)); err != nil {
|
||||||
glog.Errorf("failed to write the ca certificate file, errro: %s", err)
|
glog.Errorf("failed to write the ca file, errro: %s", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := writeFile(keyFile, []byte(key)); err != nil {
|
||||||
|
glog.Errorf("failed to write the key file, errro: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue