diff options
Diffstat (limited to 'doc/examples/rsa_enc.cpp')
-rw-r--r-- | doc/examples/rsa_enc.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp index b24074038..e0127d63f 100644 --- a/doc/examples/rsa_enc.cpp +++ b/doc/examples/rsa_enc.cpp @@ -73,6 +73,8 @@ int main(int argc, char* argv[]) return 1; } + std::auto_ptr<RandomNumberGenerator> rng(make_rng()); + std::auto_ptr<PK_Encryptor> encryptor(get_pk_encryptor(*rsakey, "EME1(SHA-1)")); @@ -87,14 +89,14 @@ int main(int argc, char* argv[]) statistically indepedent. Practically speaking I don't think this is a problem. */ - SymmetricKey masterkey(std::min(32U, encryptor->maximum_input_size())); + SymmetricKey masterkey(*rng, std::min(32U, encryptor->maximum_input_size())); SymmetricKey cast_key = derive_key("CAST", masterkey, 16); SymmetricKey mac_key = derive_key("MAC", masterkey, 16); SymmetricKey iv = derive_key("IV", masterkey, 8); SecureVector<byte> encrypted_key = - encryptor->encrypt(masterkey.bits_of()); + encryptor->encrypt(masterkey.bits_of(), *rng); ciphertext << b64_encode(encrypted_key) << std::endl; |