diff --git a/src/crypto/crypto.cc b/src/crypto/crypto.cc index 9458de9..f7e9fb5 100644 --- a/src/crypto/crypto.cc +++ b/src/crypto/crypto.cc @@ -41,12 +41,11 @@ #include "byteorder.h" #include "crypto.h" #include "base64.h" +#include "prng.h" using namespace std; using namespace Crypto; -const char rdev[] = "/dev/urandom"; - long int myatoi( const char *str ) { char *end; @@ -122,12 +121,7 @@ Base64Key::Base64Key( string printable_key ) Base64Key::Base64Key() { - ifstream devrandom( rdev, ifstream::in | ifstream::binary ); - - devrandom.read( reinterpret_cast( key ), sizeof( key ) ); - if ( !devrandom ) { - throw CryptoException( "Could not read from " + string( rdev ) ); - } + PRNG().fill( key, sizeof( key ) ); } string Base64Key::printable_key( void ) const