mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #12049: Add RAND_bytes() and RAND_pseudo_bytes() functions to the ssl
module.
This commit is contained in:
parent
b7b1930fe3
commit
99c8b16143
6 changed files with 106 additions and 4 deletions
|
@ -102,6 +102,14 @@ class BasicSocketTests(unittest.TestCase):
|
|||
sys.stdout.write("\n RAND_status is %d (%s)\n"
|
||||
% (v, (v and "sufficient randomness") or
|
||||
"insufficient randomness"))
|
||||
|
||||
data, is_cryptographic = ssl.RAND_pseudo_bytes(16)
|
||||
self.assertEqual(len(data), 16)
|
||||
self.assertEqual(is_cryptographic, v == 1)
|
||||
if v:
|
||||
data = ssl.RAND_bytes(16)
|
||||
self.assertEqual(len(data), 16)
|
||||
|
||||
try:
|
||||
ssl.RAND_egd(1)
|
||||
except TypeError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue