55 "bytes"
66 "crypto/x509"
77 "encoding/json"
8- "io/ioutil "
8+ "os "
99 "strings"
1010 "testing"
1111
@@ -176,14 +176,14 @@ func TestBundleWithECDSAKeyMarshalJSON(t *testing.T) {
176176 }
177177
178178 key := obj ["key" ].(string )
179- keyBytes , _ := ioutil .ReadFile (leafKeyECDSA256 )
179+ keyBytes , _ := os .ReadFile (leafKeyECDSA256 )
180180 keyBytes = bytes .Trim (keyBytes , " \n " )
181181 if key != string (keyBytes ) {
182182 t .Fatal ("key is not recovered." )
183183 }
184184
185185 cert := obj ["crt" ].(string )
186- certBytes , _ := ioutil .ReadFile (leafECDSA256 )
186+ certBytes , _ := os .ReadFile (leafECDSA256 )
187187 certBytes = bytes .Trim (certBytes , " \n " )
188188 if cert != string (certBytes ) {
189189 t .Fatal ("cert is not recovered." )
@@ -212,7 +212,7 @@ func TestBundleWithRSAKeyMarshalJSON(t *testing.T) {
212212 }
213213
214214 key := obj ["key" ].(string )
215- keyBytes , _ := ioutil .ReadFile (leafKeyRSA2048 )
215+ keyBytes , _ := os .ReadFile (leafKeyRSA2048 )
216216 keyBytes = bytes .Trim (keyBytes , " \n " )
217217 if key != string (keyBytes ) {
218218 t .Error ("key is" , key )
@@ -221,7 +221,7 @@ func TestBundleWithRSAKeyMarshalJSON(t *testing.T) {
221221 }
222222
223223 cert := obj ["crt" ].(string )
224- certBytes , _ := ioutil .ReadFile (leafRSA2048 )
224+ certBytes , _ := os .ReadFile (leafRSA2048 )
225225 certBytes = bytes .Trim (certBytes , " \n " )
226226 if cert != string (certBytes ) {
227227 t .Fatal ("cert is not recovered." )
@@ -373,7 +373,7 @@ func TestForceBundle(t *testing.T) {
373373 interL1Bytes := signCSRFile (caSigner , interL1CSR , t )
374374
375375 // create a inter L1 signer
376- interL1KeyBytes , err := ioutil .ReadFile (interL1Key )
376+ interL1KeyBytes , err := os .ReadFile (interL1Key )
377377 if err != nil {
378378 t .Fatal (err )
379379 }
@@ -384,7 +384,7 @@ func TestForceBundle(t *testing.T) {
384384 interL2Bytes := signCSRFile (interL1Signer , interL2CSR , t )
385385
386386 // create a inter L2 signer
387- interL2KeyBytes , err := ioutil .ReadFile (interL2Key )
387+ interL2KeyBytes , err := os .ReadFile (interL2Key )
388388 if err != nil {
389389 t .Fatal (err )
390390 }
@@ -396,7 +396,7 @@ func TestForceBundle(t *testing.T) {
396396
397397 // create two platforms
398398 // both trust the CA cert and L1 intermediate
399- caBytes , err := ioutil .ReadFile (testCAFile )
399+ caBytes , err := os .ReadFile (testCAFile )
400400 if err != nil {
401401 t .Fatal (err )
402402 }
@@ -476,7 +476,7 @@ func TestUpdateIntermediate(t *testing.T) {
476476 caSigner := makeCASignerFromFile (testCAFile , testCAKeyFile , x509 .SHA256WithRSA , t )
477477 sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
478478
479- interKeyBytes , err := ioutil .ReadFile (interL1Key )
479+ interKeyBytes , err := os .ReadFile (interL1Key )
480480 if err != nil {
481481 t .Fatal (err )
482482 }
@@ -487,7 +487,7 @@ func TestUpdateIntermediate(t *testing.T) {
487487 leafBytes := signCSRFile (sha2InterSigner , leafCSR , t )
488488
489489 // read CA cert bytes
490- caCertBytes , err := ioutil .ReadFile (testCAFile )
490+ caCertBytes , err := os .ReadFile (testCAFile )
491491 if err != nil {
492492 t .Fatal (err )
493493 }
@@ -522,7 +522,7 @@ func TestForceBundleNoFallback(t *testing.T) {
522522 caSigner := makeCASignerFromFile (testCAFile , testCAKeyFile , x509 .SHA256WithRSA , t )
523523 sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
524524
525- interKeyBytes , err := ioutil .ReadFile (interL1Key )
525+ interKeyBytes , err := os .ReadFile (interL1Key )
526526 if err != nil {
527527 t .Fatal (err )
528528 }
@@ -533,7 +533,7 @@ func TestForceBundleNoFallback(t *testing.T) {
533533 leafBytes := signCSRFile (sha2InterSigner , leafCSR , t )
534534
535535 // read CA cert bytes
536- caCertBytes , err := ioutil .ReadFile (testCAFile )
536+ caCertBytes , err := os .ReadFile (testCAFile )
537537 if err != nil {
538538 t .Fatal (err )
539539 }
@@ -566,7 +566,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
566566 interL1Bytes := signCSRFile (caSigner , interL1CSR , t )
567567
568568 // create a inter L1 signer
569- interL1KeyBytes , err := ioutil .ReadFile (interL1Key )
569+ interL1KeyBytes , err := os .ReadFile (interL1Key )
570570 if err != nil {
571571 t .Fatal (err )
572572 }
@@ -577,7 +577,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
577577 interL2Bytes := signCSRFile (interL1Signer , interL2CSR , t )
578578
579579 // create a inter L2 signer
580- interL2KeyBytes , err := ioutil .ReadFile (interL2Key )
580+ interL2KeyBytes , err := os .ReadFile (interL2Key )
581581 if err != nil {
582582 t .Fatal (err )
583583 }
@@ -590,7 +590,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
590590 // create two platforms
591591 // platform A trusts the CA cert and L1 intermediate
592592 // platform B trusts the CA cert
593- caBytes , err := ioutil .ReadFile (testCAFile )
593+ caBytes , err := os .ReadFile (testCAFile )
594594 if err != nil {
595595 t .Fatal (err )
596596 }
@@ -708,7 +708,7 @@ func TestSHA2Warning(t *testing.T) {
708708 sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
709709
710710 // read CA cert bytes
711- caCertBytes , err := ioutil .ReadFile (testCAFile )
711+ caCertBytes , err := os .ReadFile (testCAFile )
712712 if err != nil {
713713 t .Fatal (err )
714714 }
@@ -752,7 +752,7 @@ func TestECDSAWarning(t *testing.T) {
752752
753753// readCert read a PEM file and returns a cert.
754754func readCert (filename string ) * x509.Certificate {
755- bytes , _ := ioutil .ReadFile (filename )
755+ bytes , _ := os .ReadFile (filename )
756756 cert , _ := helpers .ParseCertificatePEM (bytes )
757757 return cert
758758}
@@ -784,7 +784,7 @@ func newCustomizedBundlerFromFile(t *testing.T, caBundle, intBundle, adhocInters
784784 t .Fatal (err )
785785 }
786786 if adhocInters != "" {
787- moreIntersPEM , err := ioutil .ReadFile (adhocInters )
787+ moreIntersPEM , err := os .ReadFile (adhocInters )
788788 if err != nil {
789789 t .Fatalf ("Read additional intermediates failed. %v" ,
790790 err )
0 commit comments