mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-06-24 19:37:49 +03:00
param_source: use random.SystemRandom as random nr source
Python's random module uses a PRNG (Mersenne Twister) which is utterly insecure for key generation - it was so far only used for testing. Replace it with random.SystemRandom(), which draws from /dev/urandom and is suitable for generating cryptographic key material. Change-Id: I6de38c14ac6dd55bc84d53974192509c18d02bfa Jenkins: skip-card-test
This commit is contained in:
committed by
Vadim Yanitskiy
parent
b5ba274583
commit
512aba8b1d
@@ -124,7 +124,7 @@ class DecimalRangeSource(InputExpandingParamSource):
|
||||
return "%0*d" % (self.num_digits, val) # pylint: disable=consider-using-f-string
|
||||
|
||||
class RandomSourceMixin:
|
||||
random_impl = random # TODO secure random source?
|
||||
random_impl = random.SystemRandom()
|
||||
|
||||
class RandomDigitSource(DecimalRangeSource, RandomSourceMixin):
|
||||
"""return a different sequence of random decimal digits each"""
|
||||
|
||||
Reference in New Issue
Block a user