A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cloudflare/cfssl/commit/b27c723cccb13f14dc6b3936415bdd7759ab930b below:

replace uses of deprecated io/ioutil · cloudflare/cfssl@b27c723 · GitHub

@@ -10,14 +10,13 @@ import (

10 10

"crypto/x509/pkix"

11 11

"encoding/asn1"

12 12

"encoding/pem"

13 -

"io/ioutil"

14 13

"math"

14 +

"os"

15 15

"testing"

16 16

"time"

17 17 18 -

"golang.org/x/crypto/ocsp"

19 - 20 18

"github.com/google/certificate-transparency-go"

19 +

"golang.org/x/crypto/ocsp"

21 20

)

22 21 23 22

const (

@@ -52,7 +51,7 @@ const (

52 51

func TestParseCertificatesDER(t *testing.T) {

53 52

var password = []string{"password", "", ""}

54 53

for i, testFile := range []string{testPKCS12Passwordispassword, testPKCS12EmptyPswd, testCertDERFile} {

55 -

testDER, err := ioutil.ReadFile(testFile)

54 +

testDER, err := os.ReadFile(testFile)

56 55

if err != nil {

57 56

t.Fatal(err)

58 57

}

@@ -65,7 +64,7 @@ func TestParseCertificatesDER(t *testing.T) {

65 64

}

66 65

}

67 66 68 -

testDER, err := ioutil.ReadFile(testEmptyPKCS7DER)

67 +

testDER, err := os.ReadFile(testEmptyPKCS7DER)

69 68

if err != nil {

70 69

t.Fatal(err)

71 70

}

@@ -89,7 +88,7 @@ func TestKeyLength(t *testing.T) {

89 88

t.Fatal("KeyLength malfunctioning on nonsense input")

90 89

}

91 90 92 -

//test the ecdsa branch

91 +

// test the ecdsa branch

93 92

ecdsaPriv, _ := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)

94 93

ecdsaIn, _ := ecdsaPriv.Public().(*ecdsa.PublicKey)

95 94

expEcdsa := ecdsaIn.Curve.Params().BitSize

@@ -98,7 +97,7 @@ func TestKeyLength(t *testing.T) {

98 97

t.Fatal("KeyLength malfunctioning on ecdsa input")

99 98

}

100 99 101 -

//test the rsa branch

100 +

// test the rsa branch

102 101

rsaPriv, _ := rsa.GenerateKey(rand.Reader, 256)

103 102

rsaIn, _ := rsaPriv.Public().(*rsa.PublicKey)

104 103

expRsa := rsaIn.N.BitLen()

@@ -118,8 +117,8 @@ func TestExpiryTime(t *testing.T) {

118 117

t.Fatal("Expiry time is malfunctioning on empty input")

119 118

}

120 119 121 -

//read a pem file and use that expiry date

122 -

bytes, _ := ioutil.ReadFile(testBundleFile)

120 +

// read a pem file and use that expiry date

121 +

bytes, _ := os.ReadFile(testBundleFile)

123 122

certs, err := ParseCertificatesPEM(bytes)

124 123

if err != nil {

125 124

t.Fatalf("%v", err)

@@ -269,7 +268,7 @@ func TestSignatureString(t *testing.T) {

269 268 270 269

func TestParseCertificatePEM(t *testing.T) {

271 270

for _, testFile := range []string{testCertFile, testExtraWSCertFile, testSinglePKCS7} {

272 -

certPEM, err := ioutil.ReadFile(testFile)

271 +

certPEM, err := os.ReadFile(testFile)

273 272

if err != nil {

274 273

t.Fatal(err)

275 274

}

@@ -280,7 +279,7 @@ func TestParseCertificatePEM(t *testing.T) {

280 279

}

281 280

}

282 281

for _, testFile := range []string{testBundleFile, testMessedUpCertFile, testEmptyPKCS7PEM, testEmptyCertFile, testMultiplePKCS7} {

283 -

certPEM, err := ioutil.ReadFile(testFile)

282 +

certPEM, err := os.ReadFile(testFile)

284 283

if err != nil {

285 284

t.Fatal(err)

286 285

}

@@ -294,7 +293,7 @@ func TestParseCertificatePEM(t *testing.T) {

294 293

func TestParseCertificatesPEM(t *testing.T) {

295 294

// expected cases

296 295

for _, testFile := range []string{testBundleFile, testExtraWSBundleFile, testSinglePKCS7, testMultiplePKCS7} {

297 -

bundlePEM, err := ioutil.ReadFile(testFile)

296 +

bundlePEM, err := os.ReadFile(testFile)

298 297

if err != nil {

299 298

t.Fatal(err)

300 299

}

@@ -308,7 +307,7 @@ func TestParseCertificatesPEM(t *testing.T) {

308 307

// test failure cases

309 308

// few lines deleted, then headers removed

310 309

for _, testFile := range []string{testMessedUpBundleFile, testEmptyPKCS7PEM, testNoHeaderCert} {

311 -

bundlePEM, err := ioutil.ReadFile(testFile)

310 +

bundlePEM, err := os.ReadFile(testFile)

312 311

if err != nil {

313 312

t.Fatal(err)

314 313

}

@@ -320,7 +319,7 @@ func TestParseCertificatesPEM(t *testing.T) {

320 319

}

321 320 322 321

func TestSelfSignedCertificatePEM(t *testing.T) {

323 -

testPEM, err := ioutil.ReadFile(testCertFile)

322 +

testPEM, err := os.ReadFile(testCertFile)

324 323

if err != nil {

325 324

t.Fatal(err)

326 325

}

@@ -330,7 +329,7 @@ func TestSelfSignedCertificatePEM(t *testing.T) {

330 329

}

331 330 332 331

// a few lines deleted from the pem file

333 -

wrongPEM, err := ioutil.ReadFile(testMessedUpCertFile)

332 +

wrongPEM, err := os.ReadFile(testMessedUpCertFile)

334 333

if err != nil {

335 334

t.Fatal(err)

336 335

}

@@ -353,7 +352,7 @@ func TestSelfSignedCertificatePEM(t *testing.T) {

353 352

func TestParsePrivateKeyPEM(t *testing.T) {

354 353 355 354

// expected cases

356 -

testRSAPEM, err := ioutil.ReadFile(testPrivateRSAKey)

355 +

testRSAPEM, err := os.ReadFile(testPrivateRSAKey)

357 356

if err != nil {

358 357

t.Fatal(err)

359 358

}

@@ -362,7 +361,7 @@ func TestParsePrivateKeyPEM(t *testing.T) {

362 361

t.Fatal(err)

363 362

}

364 363 365 -

testECDSAPEM, err := ioutil.ReadFile(testPrivateECDSAKey)

364 +

testECDSAPEM, err := os.ReadFile(testPrivateECDSAKey)

366 365

if err != nil {

367 366

t.Fatal(err)

368 367

}

@@ -371,7 +370,7 @@ func TestParsePrivateKeyPEM(t *testing.T) {

371 370

t.Fatal(err)

372 371

}

373 372 374 -

testEd25519PEM, err := ioutil.ReadFile(testPrivateEd25519Key)

373 +

testEd25519PEM, err := os.ReadFile(testPrivateEd25519Key)

375 374

if err != nil {

376 375

t.Fatal(err)

377 376

}

@@ -381,7 +380,7 @@ func TestParsePrivateKeyPEM(t *testing.T) {

381 380

t.Fatal(err)

382 381

}

383 382 384 -

testOpenSSLECKey, err := ioutil.ReadFile(testPrivateOpenSSLECKey)

383 +

testOpenSSLECKey, err := os.ReadFile(testPrivateOpenSSLECKey)

385 384

if err != nil {

386 385

t.Fatal(err)

387 386

}

@@ -400,7 +399,7 @@ func TestParsePrivateKeyPEM(t *testing.T) {

400 399

}

401 400 402 401

for _, fname := range errCases {

403 -

testPEM, _ := ioutil.ReadFile(fname)

402 +

testPEM, _ := os.ReadFile(fname)

404 403

_, err = ParsePrivateKeyPEM(testPEM)

405 404

if err == nil {

406 405

t.Fatal("Incorrect private key failed to produce an error")

@@ -413,7 +412,7 @@ func TestParsePrivateKeyPEM(t *testing.T) {

413 412

const ecdsaTestCSR = "testdata/ecdsa256.csr"

414 413 415 414

func TestParseCSRPEM(t *testing.T) {

416 -

in, err := ioutil.ReadFile(ecdsaTestCSR)

415 +

in, err := os.ReadFile(ecdsaTestCSR)

417 416

if err != nil {

418 417

t.Fatalf("%v", err)

419 418

}

@@ -432,7 +431,7 @@ func TestParseCSRPEM(t *testing.T) {

432 431

}

433 432 434 433

func TestParseCSRPEMMore(t *testing.T) {

435 -

csrPEM, err := ioutil.ReadFile(testCSRPEM)

434 +

csrPEM, err := os.ReadFile(testCSRPEM)

436 435

if err != nil {

437 436

t.Fatal(err)

438 437

}

@@ -441,7 +440,7 @@ func TestParseCSRPEMMore(t *testing.T) {

441 440

t.Fatal(err)

442 441

}

443 442 444 -

csrPEM, err = ioutil.ReadFile(testCSRPEMBad)

443 +

csrPEM, err = os.ReadFile(testCSRPEMBad)

445 444

if err != nil {

446 445

t.Fatal(err)

447 446

}

@@ -459,7 +458,7 @@ func TestParseCSRPEMMore(t *testing.T) {

459 458

const rsaOldTestCSR = "testdata/rsa-old.csr"

460 459 461 460

func TestParseOldCSR(t *testing.T) {

462 -

in, err := ioutil.ReadFile(rsaOldTestCSR)

461 +

in, err := os.ReadFile(rsaOldTestCSR)

463 462

if err != nil {

464 463

t.Fatalf("%v", err)

465 464

}

@@ -508,7 +507,7 @@ func TestLoadPEMCertPool(t *testing.T) {

508 507

t.Fatal("Empty file name should not generate error or a cert pool")

509 508

}

510 509 511 -

in, err := ioutil.ReadFile(testEmptyPem)

510 +

in, err := os.ReadFile(testEmptyPem)

512 511

if err != nil {

513 512

t.Fatalf("%v", err)

514 513

}

@@ -519,7 +518,7 @@ func TestLoadPEMCertPool(t *testing.T) {

519 518

t.Fatal("Expected error for empty file")

520 519

}

521 520 522 -

in, err = ioutil.ReadFile(testEmptyCertFile)

521 +

in, err = os.ReadFile(testEmptyCertFile)

523 522

if err != nil {

524 523

t.Fatalf("%v", err)

525 524

}

@@ -530,7 +529,7 @@ func TestLoadPEMCertPool(t *testing.T) {

530 529

t.Fatal("Expected error for empty cert")

531 530

}

532 531 533 -

in, err = ioutil.ReadFile(clientCertFile)

532 +

in, err = os.ReadFile(clientCertFile)

534 533

if err != nil {

535 534

t.Fatalf("%v", err)

536 535

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4