Merge pull request #1872 from hashicorp/transit-uuid-generate

Use uuid.GenerateRandomBytes
This commit is contained in:
Jeff Mitchell 2016-09-12 15:45:59 -04:00 committed by GitHub
commit 19a98d4e2d

View file

@ -4,7 +4,6 @@ import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/json"
@ -529,8 +528,7 @@ func (p *policy) rotate(storage logical.Storage) error {
}
// Generate a 256bit key
newKey := make([]byte, 32)
_, err := rand.Read(newKey)
newKey, err := uuid.GenerateRandomBytes(32)
if err != nil {
return err
}
@ -549,8 +547,6 @@ func (p *policy) rotate(storage logical.Storage) error {
p.MinDecryptionVersion = 1
}
//fmt.Printf("policy %s rotated to %d\n", p.Name, p.LatestVersion)
return p.Persist(storage)
}