Make pw-token-gen.py more random
This fix utilizes the urandom method in the os mmodule and provides more randomness in our generation tool. Closes-bug: 1732295 Change-Id: I060976d243dfc4ddc7fd67aff36f3a888a0a363e
This commit is contained in:
parent
d78e63a67d
commit
e9f957861b
|
@ -22,7 +22,6 @@ import random
|
||||||
import tarfile
|
import tarfile
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from Crypto import Random
|
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -69,7 +68,7 @@ class CredentialGenerator(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _random_bytes():
|
def _random_bytes():
|
||||||
"""Returns 1024 random bytes of data."""
|
"""Returns 1024 random bytes of data."""
|
||||||
return Random.get_random_bytes(1024)
|
return os.urandom(1024)
|
||||||
|
|
||||||
def _encode_bytes(self):
|
def _encode_bytes(self):
|
||||||
"""Builds random strings based on random data.
|
"""Builds random strings based on random data.
|
||||||
|
|
Loading…
Reference in New Issue