aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/rsa_enc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/rsa_enc.cpp')
-rw-r--r--doc/examples/rsa_enc.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp
index ac609c4b3..b8e5d874b 100644
--- a/doc/examples/rsa_enc.cpp
+++ b/doc/examples/rsa_enc.cpp
@@ -34,9 +34,10 @@
#include <botan/botan.h>
#include <botan/pubkey.h>
#include <botan/rsa.h>
+#include <botan/base64.h>
+
using namespace Botan;
-std::string b64_encode(const SecureVector<byte>&);
SymmetricKey derive_key(const std::string&, const SymmetricKey&, u32bit);
int main(int argc, char* argv[])
@@ -98,10 +99,10 @@ int main(int argc, char* argv[])
SymmetricKey mac_key = derive_key("MAC", masterkey, 16);
SymmetricKey iv = derive_key("IV", masterkey, 8);
- SecureVector<byte> encrypted_key =
+ std::vector<byte> encrypted_key =
encryptor.encrypt(masterkey.bits_of(), rng);
- ciphertext << b64_encode(encrypted_key) << std::endl;
+ ciphertext << base64_encode(encrypted_key) << std::endl;
Pipe pipe(new Fork(
new Chain(
@@ -135,13 +136,6 @@ int main(int argc, char* argv[])
return 0;
}
-std::string b64_encode(const SecureVector<byte>& in)
- {
- Pipe pipe(new Base64_Encoder);
- pipe.process_msg(in);
- return pipe.read_all_as_string();
- }
-
SymmetricKey derive_key(const std::string& param,
const SymmetricKey& masterkey,
u32bit outputlength)