File tree 2 files changed +7
-18
lines changed
2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -114,10 +114,11 @@ func (f *NinaFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs [
114
114
for _ , URL := range URLs {
115
115
logrus .Infof ("Converting and flashing certificate from %s" , URL )
116
116
flasherOut .Write ([]byte (fmt .Sprintf ("Converting and flashing certificate from %s\n " , URL )))
117
- data , err := f . certificateFromURL (URL )
117
+ rootCertificate , err := certificates . ScrapeRootCertificatesFromURL (URL )
118
118
if err != nil {
119
119
return err
120
120
}
121
+ data := pem .EncodeToMemory (& pem.Block {Type : "CERTIFICATE" , Bytes : rootCertificate .Raw })
121
122
certificatesData = append (certificatesData , data ... )
122
123
}
123
124
@@ -143,14 +144,6 @@ func (f *NinaFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs [
143
144
return nil
144
145
}
145
146
146
- func (f * NinaFlasher ) certificateFromURL (URL string ) ([]byte , error ) {
147
- rootCertificate , err := certificates .ScrapeRootCertificatesFromURL (URL )
148
- if err != nil {
149
- return nil , err
150
- }
151
- return pem .EncodeToMemory (& pem.Block {Type : "CERTIFICATE" , Bytes : rootCertificate .Raw }), nil
152
- }
153
-
154
147
// Close the port used by this flasher
155
148
func (f * NinaFlasher ) Close () error {
156
149
return f .port .Close ()
Original file line number Diff line number Diff line change @@ -99,7 +99,11 @@ func (f *WincFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs [
99
99
for _ , URL := range URLs {
100
100
logrus .Infof ("Converting and flashing certificate from %s" , URL )
101
101
flasherOut .Write ([]byte (fmt .Sprintf ("Converting and flashing certificate from %s\n " , URL )))
102
- data , err := f .certificateFromURL (URL )
102
+ rootCertificate , err := certificates .ScrapeRootCertificatesFromURL (URL )
103
+ if err != nil {
104
+ return err
105
+ }
106
+ data , err := f .getCertificateData (rootCertificate )
103
107
if err != nil {
104
108
return err
105
109
}
@@ -116,14 +120,6 @@ func (f *WincFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs [
116
120
return nil
117
121
}
118
122
119
- func (f * WincFlasher ) certificateFromURL (URL string ) ([]byte , error ) {
120
- rootCertificate , err := certificates .ScrapeRootCertificatesFromURL (URL )
121
- if err != nil {
122
- return nil , err
123
- }
124
- return f .getCertificateData (rootCertificate )
125
- }
126
-
127
123
func (f * WincFlasher ) getCertificateData (cert * x509.Certificate ) ([]byte , error ) {
128
124
b := []byte {}
129
125
nameSHA1Bytes , err := calculateNameSha1 (cert )
You can’t perform that action at this time.
0 commit comments