Esempio n. 1
0
 def getRandomBytes(howMany):
     randomKey = cryptlib_py.cryptCreateContext(cryptlib_py.CRYPT_UNUSED, cryptlib_py.CRYPT_ALGO_AES)
     cryptlib_py.cryptSetAttribute(randomKey, cryptlib_py.CRYPT_CTXINFO_MODE, cryptlib_py.CRYPT_MODE_OFB)
     cryptlib_py.cryptGenerateKey(randomKey)
     bytes = createByteArrayZeros(howMany)
     cryptlib_py.cryptEncrypt(randomKey, bytes)
     return bytes
Esempio n. 2
0
 def getRandomBytes(howMany):
     randomKey = cryptlib_py.cryptCreateContext(
         cryptlib_py.CRYPT_UNUSED, cryptlib_py.CRYPT_ALGO_AES)
     cryptlib_py.cryptSetAttribute(randomKey,
                                   cryptlib_py.CRYPT_CTXINFO_MODE,
                                   cryptlib_py.CRYPT_MODE_OFB)
     cryptlib_py.cryptGenerateKey(randomKey)
     bytes = createByteArrayZeros(howMany)
     cryptlib_py.cryptEncrypt(randomKey, bytes)
     return bytes