import "math/rand"
func generateAES256Key() ([]byte, error) {
var key = make([]byte, 32)
if _, err := rand.Read(key); err != nil {
return nil, err
}
return key, nil
}math/rand) provide a RNG implementation that is
optimized for performance rather than security. Thus, random numbers generated
with these libraries are usually not suited for cryptographic operations.
Instead always use RNGs which explicitly state that they implement a CSPRNG
like Go’s crypto/rand module.sigma star gmbh
Eduard-Bodem-Gasse 6, 1st floor
6020 Innsbruck | Austria