11package jwt_test
22
33import (
4- "io/ioutil "
4+ "os "
55 "strings"
66 "testing"
77
@@ -46,7 +46,7 @@ var rsaTestData = []struct {
4646}
4747
4848func TestRSAVerify (t * testing.T ) {
49- keyData , _ := ioutil .ReadFile ("test/sample_key.pub" )
49+ keyData , _ := os .ReadFile ("test/sample_key.pub" )
5050 key , _ := jwt .ParseRSAPublicKeyFromPEM (keyData )
5151
5252 for _ , data := range rsaTestData {
@@ -64,7 +64,7 @@ func TestRSAVerify(t *testing.T) {
6464}
6565
6666func TestRSASign (t * testing.T ) {
67- keyData , _ := ioutil .ReadFile ("test/sample_key" )
67+ keyData , _ := os .ReadFile ("test/sample_key" )
6868 key , _ := jwt .ParseRSAPrivateKeyFromPEM (keyData )
6969
7070 for _ , data := range rsaTestData {
@@ -83,7 +83,7 @@ func TestRSASign(t *testing.T) {
8383}
8484
8585func TestRSAVerifyWithPreParsedPrivateKey (t * testing.T ) {
86- key , _ := ioutil .ReadFile ("test/sample_key.pub" )
86+ key , _ := os .ReadFile ("test/sample_key.pub" )
8787 parsedKey , err := jwt .ParseRSAPublicKeyFromPEM (key )
8888 if err != nil {
8989 t .Fatal (err )
@@ -97,7 +97,7 @@ func TestRSAVerifyWithPreParsedPrivateKey(t *testing.T) {
9797}
9898
9999func TestRSAWithPreParsedPrivateKey (t * testing.T ) {
100- key , _ := ioutil .ReadFile ("test/sample_key" )
100+ key , _ := os .ReadFile ("test/sample_key" )
101101 parsedKey , err := jwt .ParseRSAPrivateKeyFromPEM (key )
102102 if err != nil {
103103 t .Fatal (err )
@@ -114,9 +114,9 @@ func TestRSAWithPreParsedPrivateKey(t *testing.T) {
114114}
115115
116116func TestRSAKeyParsing (t * testing.T ) {
117- key , _ := ioutil .ReadFile ("test/sample_key" )
118- secureKey , _ := ioutil .ReadFile ("test/privateSecure.pem" )
119- pubKey , _ := ioutil .ReadFile ("test/sample_key.pub" )
117+ key , _ := os .ReadFile ("test/sample_key" )
118+ secureKey , _ := os .ReadFile ("test/privateSecure.pem" )
119+ pubKey , _ := os .ReadFile ("test/sample_key.pub" )
120120 badKey := []byte ("All your base are belong to key" )
121121
122122 // Test parsePrivateKey
@@ -156,7 +156,7 @@ func TestRSAKeyParsing(t *testing.T) {
156156}
157157
158158func BenchmarkRSAParsing (b * testing.B ) {
159- key , _ := ioutil .ReadFile ("test/sample_key" )
159+ key , _ := os .ReadFile ("test/sample_key" )
160160
161161 b .ReportAllocs ()
162162 b .ResetTimer ()
@@ -170,7 +170,7 @@ func BenchmarkRSAParsing(b *testing.B) {
170170}
171171
172172func BenchmarkRS256Signing (b * testing.B ) {
173- key , _ := ioutil .ReadFile ("test/sample_key" )
173+ key , _ := os .ReadFile ("test/sample_key" )
174174 parsedKey , err := jwt .ParseRSAPrivateKeyFromPEM (key )
175175 if err != nil {
176176 b .Fatal (err )
@@ -180,7 +180,7 @@ func BenchmarkRS256Signing(b *testing.B) {
180180}
181181
182182func BenchmarkRS384Signing (b * testing.B ) {
183- key , _ := ioutil .ReadFile ("test/sample_key" )
183+ key , _ := os .ReadFile ("test/sample_key" )
184184 parsedKey , err := jwt .ParseRSAPrivateKeyFromPEM (key )
185185 if err != nil {
186186 b .Fatal (err )
@@ -190,7 +190,7 @@ func BenchmarkRS384Signing(b *testing.B) {
190190}
191191
192192func BenchmarkRS512Signing (b * testing.B ) {
193- key , _ := ioutil .ReadFile ("test/sample_key" )
193+ key , _ := os .ReadFile ("test/sample_key" )
194194 parsedKey , err := jwt .ParseRSAPrivateKeyFromPEM (key )
195195 if err != nil {
196196 b .Fatal (err )
0 commit comments