Skip to content

Commit

Permalink
Update pkg/apis/minio.min.io/v2/utils.go
Browse files Browse the repository at this point in the history
Co-authored-by: Klaus Post <[email protected]>
  • Loading branch information
harshavardhana and klauspost authored Jun 21, 2022
1 parent 7cbdfe7 commit ce75445
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/apis/minio.min.io/v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ func GenerateCredentials() (accessKey, secretKey string, err error) {
return "", "", err
}

secretKey = strings.ReplaceAll(string([]byte(base64.StdEncoding.EncodeToString(keyBytes))[:secretKeyMaxLen]),
"/", "+")
// Table used for Secret keys
const alphaNumericTableFull = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

for i := 0; i < secretKeyMaxLen; i++ {
keyBytes[i] = alphaNumericTableFull[keyBytes[i]%byte(len(alphaNumericTableFull))]
}
secretKey = string(keyBytes)

return accessKey, secretKey, nil
}
Expand Down

0 comments on commit ce75445

Please sign in to comment.