Skip to content

Commit

Permalink
Removed deferred call to Wipe on decoding creds. The client is respon…
Browse files Browse the repository at this point in the history
…sible to (#48)

call wipe after the contents are processed.
  • Loading branch information
aricart authored Sep 20, 2019
1 parent 3cf5854 commit c2e662a
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions creds_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ func FormatUserConfig(jwtString string, seed []byte) ([]byte, error) {

// ParseDecoratedJWT takes a creds file and returns the JWT portion.
func ParseDecoratedJWT(contents []byte) (string, error) {
defer wipeSlice(contents)

items := userConfigRE.FindAllSubmatch(contents, -1)
if len(items) == 0 {
return string(contents), nil
Expand All @@ -150,7 +148,6 @@ func ParseDecoratedJWT(contents []byte) (string, error) {
// key pair from it.
func ParseDecoratedNKey(contents []byte) (nkeys.KeyPair, error) {
var seed []byte
defer wipeSlice(contents)

items := userConfigRE.FindAllSubmatch(contents, -1)
if len(items) > 1 {
Expand Down Expand Up @@ -201,10 +198,3 @@ func ParseDecoratedUserNKey(contents []byte) (nkeys.KeyPair, error) {
}
return kp, nil
}

// Just wipe slice with 'x', for clearing contents of nkey seed file.
func wipeSlice(buf []byte) {
for i := range buf {
buf[i] = 'x'
}
}

0 comments on commit c2e662a

Please sign in to comment.