5
5
"bytes"
6
6
"crypto/x509"
7
7
"encoding/json"
8
- "io/ioutil "
8
+ "os "
9
9
"strings"
10
10
"testing"
11
11
@@ -176,14 +176,14 @@ func TestBundleWithECDSAKeyMarshalJSON(t *testing.T) {
176
176
}
177
177
178
178
key := obj ["key" ].(string )
179
- keyBytes , _ := ioutil .ReadFile (leafKeyECDSA256 )
179
+ keyBytes , _ := os .ReadFile (leafKeyECDSA256 )
180
180
keyBytes = bytes .Trim (keyBytes , " \n " )
181
181
if key != string (keyBytes ) {
182
182
t .Fatal ("key is not recovered." )
183
183
}
184
184
185
185
cert := obj ["crt" ].(string )
186
- certBytes , _ := ioutil .ReadFile (leafECDSA256 )
186
+ certBytes , _ := os .ReadFile (leafECDSA256 )
187
187
certBytes = bytes .Trim (certBytes , " \n " )
188
188
if cert != string (certBytes ) {
189
189
t .Fatal ("cert is not recovered." )
@@ -212,7 +212,7 @@ func TestBundleWithRSAKeyMarshalJSON(t *testing.T) {
212
212
}
213
213
214
214
key := obj ["key" ].(string )
215
- keyBytes , _ := ioutil .ReadFile (leafKeyRSA2048 )
215
+ keyBytes , _ := os .ReadFile (leafKeyRSA2048 )
216
216
keyBytes = bytes .Trim (keyBytes , " \n " )
217
217
if key != string (keyBytes ) {
218
218
t .Error ("key is" , key )
@@ -221,7 +221,7 @@ func TestBundleWithRSAKeyMarshalJSON(t *testing.T) {
221
221
}
222
222
223
223
cert := obj ["crt" ].(string )
224
- certBytes , _ := ioutil .ReadFile (leafRSA2048 )
224
+ certBytes , _ := os .ReadFile (leafRSA2048 )
225
225
certBytes = bytes .Trim (certBytes , " \n " )
226
226
if cert != string (certBytes ) {
227
227
t .Fatal ("cert is not recovered." )
@@ -373,7 +373,7 @@ func TestForceBundle(t *testing.T) {
373
373
interL1Bytes := signCSRFile (caSigner , interL1CSR , t )
374
374
375
375
// create a inter L1 signer
376
- interL1KeyBytes , err := ioutil .ReadFile (interL1Key )
376
+ interL1KeyBytes , err := os .ReadFile (interL1Key )
377
377
if err != nil {
378
378
t .Fatal (err )
379
379
}
@@ -384,7 +384,7 @@ func TestForceBundle(t *testing.T) {
384
384
interL2Bytes := signCSRFile (interL1Signer , interL2CSR , t )
385
385
386
386
// create a inter L2 signer
387
- interL2KeyBytes , err := ioutil .ReadFile (interL2Key )
387
+ interL2KeyBytes , err := os .ReadFile (interL2Key )
388
388
if err != nil {
389
389
t .Fatal (err )
390
390
}
@@ -396,7 +396,7 @@ func TestForceBundle(t *testing.T) {
396
396
397
397
// create two platforms
398
398
// both trust the CA cert and L1 intermediate
399
- caBytes , err := ioutil .ReadFile (testCAFile )
399
+ caBytes , err := os .ReadFile (testCAFile )
400
400
if err != nil {
401
401
t .Fatal (err )
402
402
}
@@ -476,7 +476,7 @@ func TestUpdateIntermediate(t *testing.T) {
476
476
caSigner := makeCASignerFromFile (testCAFile , testCAKeyFile , x509 .SHA256WithRSA , t )
477
477
sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
478
478
479
- interKeyBytes , err := ioutil .ReadFile (interL1Key )
479
+ interKeyBytes , err := os .ReadFile (interL1Key )
480
480
if err != nil {
481
481
t .Fatal (err )
482
482
}
@@ -487,7 +487,7 @@ func TestUpdateIntermediate(t *testing.T) {
487
487
leafBytes := signCSRFile (sha2InterSigner , leafCSR , t )
488
488
489
489
// read CA cert bytes
490
- caCertBytes , err := ioutil .ReadFile (testCAFile )
490
+ caCertBytes , err := os .ReadFile (testCAFile )
491
491
if err != nil {
492
492
t .Fatal (err )
493
493
}
@@ -522,7 +522,7 @@ func TestForceBundleNoFallback(t *testing.T) {
522
522
caSigner := makeCASignerFromFile (testCAFile , testCAKeyFile , x509 .SHA256WithRSA , t )
523
523
sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
524
524
525
- interKeyBytes , err := ioutil .ReadFile (interL1Key )
525
+ interKeyBytes , err := os .ReadFile (interL1Key )
526
526
if err != nil {
527
527
t .Fatal (err )
528
528
}
@@ -533,7 +533,7 @@ func TestForceBundleNoFallback(t *testing.T) {
533
533
leafBytes := signCSRFile (sha2InterSigner , leafCSR , t )
534
534
535
535
// read CA cert bytes
536
- caCertBytes , err := ioutil .ReadFile (testCAFile )
536
+ caCertBytes , err := os .ReadFile (testCAFile )
537
537
if err != nil {
538
538
t .Fatal (err )
539
539
}
@@ -566,7 +566,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
566
566
interL1Bytes := signCSRFile (caSigner , interL1CSR , t )
567
567
568
568
// create a inter L1 signer
569
- interL1KeyBytes , err := ioutil .ReadFile (interL1Key )
569
+ interL1KeyBytes , err := os .ReadFile (interL1Key )
570
570
if err != nil {
571
571
t .Fatal (err )
572
572
}
@@ -577,7 +577,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
577
577
interL2Bytes := signCSRFile (interL1Signer , interL2CSR , t )
578
578
579
579
// create a inter L2 signer
580
- interL2KeyBytes , err := ioutil .ReadFile (interL2Key )
580
+ interL2KeyBytes , err := os .ReadFile (interL2Key )
581
581
if err != nil {
582
582
t .Fatal (err )
583
583
}
@@ -590,7 +590,7 @@ func TestSHA2HomogeneityAgainstUbiquity(t *testing.T) {
590
590
// create two platforms
591
591
// platform A trusts the CA cert and L1 intermediate
592
592
// platform B trusts the CA cert
593
- caBytes , err := ioutil .ReadFile (testCAFile )
593
+ caBytes , err := os .ReadFile (testCAFile )
594
594
if err != nil {
595
595
t .Fatal (err )
596
596
}
@@ -708,7 +708,7 @@ func TestSHA2Warning(t *testing.T) {
708
708
sha2InterBytes := signCSRFile (caSigner , interL1CSR , t )
709
709
710
710
// read CA cert bytes
711
- caCertBytes , err := ioutil .ReadFile (testCAFile )
711
+ caCertBytes , err := os .ReadFile (testCAFile )
712
712
if err != nil {
713
713
t .Fatal (err )
714
714
}
@@ -752,7 +752,7 @@ func TestECDSAWarning(t *testing.T) {
752
752
753
753
// readCert read a PEM file and returns a cert.
754
754
func readCert (filename string ) * x509.Certificate {
755
- bytes , _ := ioutil .ReadFile (filename )
755
+ bytes , _ := os .ReadFile (filename )
756
756
cert , _ := helpers .ParseCertificatePEM (bytes )
757
757
return cert
758
758
}
@@ -784,7 +784,7 @@ func newCustomizedBundlerFromFile(t *testing.T, caBundle, intBundle, adhocInters
784
784
t .Fatal (err )
785
785
}
786
786
if adhocInters != "" {
787
- moreIntersPEM , err := ioutil .ReadFile (adhocInters )
787
+ moreIntersPEM , err := os .ReadFile (adhocInters )
788
788
if err != nil {
789
789
t .Fatalf ("Read additional intermediates failed. %v" ,
790
790
err )
0 commit comments