A RetroSearch Logo

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

Search Query:

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

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

File tree Expand file treeCollapse file tree 7 files changed

+19

-20

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+19

-20

lines changed Original file line number Diff line number Diff line change

@@ -30,7 +30,7 @@ import (

30 30

"errors"

31 31

"flag"

32 32

"fmt"

33 -

"io/ioutil"

33 +

"io"

34 34

"os"

35 35 36 36

"github.com/cloudflare/cfssl/config"

@@ -151,9 +151,9 @@ func Start(cmds map[string]*Command) error {

151 151

// ReadStdin reads from stdin if the file is "-"

152 152

func ReadStdin(filename string) ([]byte, error) {

153 153

if filename == "-" {

154 -

return ioutil.ReadAll(os.Stdin)

154 +

return io.ReadAll(os.Stdin)

155 155

}

156 -

return ioutil.ReadFile(filename)

156 +

return os.ReadFile(filename)

157 157

}

158 158 159 159

// PrintCert outputs a cert, key and csr to stdout

Original file line number Diff line number Diff line change

@@ -1,7 +1,6 @@

1 1

package gencert

2 2 3 3

import (

4 -

"io/ioutil"

5 4

"os"

6 5

"strings"

7 6

"testing"

@@ -86,8 +85,8 @@ func TestGencertFile(t *testing.T) {

86 85

}

87 86 88 87

func TestGencertEnv(t *testing.T) {

89 -

tempCaCert, _ := ioutil.ReadFile("../testdata/ca.pem")

90 -

tempCaKey, _ := ioutil.ReadFile("../testdata/ca-key.pem")

88 +

tempCaCert, _ := os.ReadFile("../testdata/ca.pem")

89 +

tempCaKey, _ := os.ReadFile("../testdata/ca-key.pem")

91 90

os.Setenv("ca", string(tempCaCert))

92 91

os.Setenv("ca_key", string(tempCaKey))

93 92

@@ -124,8 +123,8 @@ func TestGencertEnv(t *testing.T) {

124 123

}

125 124 126 125

func TestBadGencertEnv(t *testing.T) {

127 -

tempCaCert, _ := ioutil.ReadFile("../testdata/ca.pem")

128 -

tempCaKey, _ := ioutil.ReadFile("../testdata/ca-key.pem")

126 +

tempCaCert, _ := os.ReadFile("../testdata/ca.pem")

127 +

tempCaKey, _ := os.ReadFile("../testdata/ca-key.pem")

129 128

os.Setenv("ca", string(tempCaCert))

130 129

os.Setenv("ca_key", string(tempCaKey))

131 130 Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ package gencsr

3 3

import (

4 4

"encoding/json"

5 5

"errors"

6 -

"io/ioutil"

6 +

"io"

7 7

"os"

8 8

"testing"

9 9

@@ -36,7 +36,7 @@ func newStdoutRedirect() (*stdoutRedirect, error) {

36 36

func (pipe *stdoutRedirect) readAll() ([]byte, error) {

37 37

pipe.w.Close()

38 38

os.Stdout = pipe.saved

39 -

return ioutil.ReadAll(pipe.r)

39 +

return io.ReadAll(pipe.r)

40 40

}

41 41 42 42

func checkResponse(out []byte) error {

Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ package genkey

3 3

import (

4 4

"encoding/json"

5 5

"errors"

6 -

"io/ioutil"

6 +

"io"

7 7

"os"

8 8

"testing"

9 9

@@ -30,7 +30,7 @@ func newStdoutRedirect() (*stdoutRedirect, error) {

30 30

func (pipe *stdoutRedirect) readAll() ([]byte, error) {

31 31

pipe.w.Close()

32 32

os.Stdout = pipe.saved

33 -

return ioutil.ReadAll(pipe.r)

33 +

return io.ReadAll(pipe.r)

34 34

}

35 35 36 36

func checkResponse(out []byte) error {

Original file line number Diff line number Diff line change

@@ -2,6 +2,7 @@ package ocsprefresh

2 2 3 3

import (

4 4

"encoding/hex"

5 +

"os"

5 6

"testing"

6 7

"time"

7 8

@@ -11,15 +12,14 @@ import (

11 12

"github.com/cloudflare/cfssl/cli"

12 13

"github.com/cloudflare/cfssl/helpers"

13 14

"golang.org/x/crypto/ocsp"

14 -

"io/ioutil"

15 15

)

16 16 17 17

var dbAccessor certdb.Accessor

18 18 19 19

func TestOCSPRefreshMain(t *testing.T) {

20 20

db := testdb.SQLiteDB("../../certdb/testdb/certstore_development.db")

21 21 22 -

certPEM, err := ioutil.ReadFile("../../ocsp/testdata/cert.pem")

22 +

certPEM, err := os.ReadFile("../../ocsp/testdata/cert.pem")

23 23

if err != nil {

24 24

t.Fatal(err)

25 25

}

Original file line number Diff line number Diff line change

@@ -2,7 +2,7 @@

2 2

package ocspsign

3 3 4 4

import (

5 -

"io/ioutil"

5 +

"os"

6 6

"time"

7 7 8 8

"github.com/cloudflare/cfssl/cli"

@@ -27,7 +27,7 @@ var ocspSignerFlags = []string{"ca", "responder", "responder-key", "reason", "st

27 27

// ocspSignerMain is the main CLI of OCSP signer functionality.

28 28

func ocspSignerMain(args []string, c cli.Config) (err error) {

29 29

// Read the cert to be revoked from file

30 -

certBytes, err := ioutil.ReadFile(c.CertFile)

30 +

certBytes, err := os.ReadFile(c.CertFile)

31 31

if err != nil {

32 32

log.Critical("Unable to read certificate: ", err)

33 33

return

@@ -80,8 +80,8 @@ func ocspSignerMain(args []string, c cli.Config) (err error) {

80 80 81 81

// SignerFromConfig creates a signer from a cli.Config as a helper for cli and serve

82 82

func SignerFromConfig(c cli.Config) (ocsp.Signer, error) {

83 -

//if this is called from serve then we need to use the specific responder key file

84 -

//fallback to key for backwards-compatibility

83 +

// if this is called from serve then we need to use the specific responder key file

84 +

// fallback to key for backwards-compatibility

85 85

k := c.ResponderKeyFile

86 86

if k == "" {

87 87

k = c.KeyFile

Original file line number Diff line number Diff line change

@@ -4,7 +4,7 @@ package sign

4 4

import (

5 5

"encoding/json"

6 6

"errors"

7 -

"io/ioutil"

7 +

"os"

8 8 9 9

"github.com/cloudflare/cfssl/certdb/dbconf"

10 10

certsql "github.com/cloudflare/cfssl/certdb/sql"

@@ -127,7 +127,7 @@ func signerMain(args []string, c cli.Config) (err error) {

127 127

}

128 128 129 129

var subjectJSON []byte

130 -

subjectJSON, err = ioutil.ReadFile(subjectFile)

130 +

subjectJSON, err = os.ReadFile(subjectFile)

131 131

if err != nil {

132 132

return

133 133

}

You can’t perform that action at this time.


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