aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/rsa_enc.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-27 20:21:45 +0000
committerlloyd <[email protected]>2008-06-27 20:21:45 +0000
commit3d0a9fd636e5ca91fcf8f5c0e13dcf659940b564 (patch)
tree4ce02817eac4c55b27cc75106adce227b4461220 /doc/examples/rsa_enc.cpp
parent964dbc067992211e7d566c881de2c7330f46bef2 (diff)
Update more of the examples
Diffstat (limited to 'doc/examples/rsa_enc.cpp')
-rw-r--r--doc/examples/rsa_enc.cpp6
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;