aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/bcrypt.cpp45
-rw-r--r--doc/examples/keywrap.cpp38
-rw-r--r--doc/log.txt9
3 files changed, 91 insertions, 1 deletions
diff --git a/doc/examples/bcrypt.cpp b/doc/examples/bcrypt.cpp
new file mode 100644
index 000000000..27a98cf33
--- /dev/null
+++ b/doc/examples/bcrypt.cpp
@@ -0,0 +1,45 @@
+/*
+* Bcrypt example
+* (C) 2011 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/botan.h>
+#include <botan/bcrypt.h>
+#include <iostream>
+
+using namespace Botan;
+
+int main(int argc, char* argv[])
+ {
+ if(argc != 2 && argc != 3)
+ {
+ std::cout << "Usage: " << argv[0] << " password\n"
+ << " " << argv[0] << " password passhash\n";
+ return 1;
+ }
+
+ LibraryInitializer init;
+
+ if(argc == 2)
+ {
+ AutoSeeded_RNG rng;
+
+ std::cout << generate_bcrypt(argv[1], rng, 12) << "\n";
+ }
+ else if(argc == 3)
+ {
+ if(strlen(argv[2]) != 60)
+ {
+ std::cout << "Note: hash " << argv[2]
+ << " has wrong length and cannot be valid\n";
+ }
+
+ const bool ok = check_bcrypt(argv[1], argv[2]);
+
+ std::cout << "Password is " << (ok ? "valid" : "NOT valid") << "\n";
+ }
+
+ return 0;
+ }
diff --git a/doc/examples/keywrap.cpp b/doc/examples/keywrap.cpp
new file mode 100644
index 000000000..730bcb6c9
--- /dev/null
+++ b/doc/examples/keywrap.cpp
@@ -0,0 +1,38 @@
+/*
+* NIST keywrap example
+* (C) 2011 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/botan.h>
+#include <botan/rfc3394.h>
+#include <botan/hex.h>
+#include <iostream>
+
+int main()
+ {
+ using namespace Botan;
+
+ LibraryInitializer init;
+
+ AutoSeeded_RNG rng;
+
+ // The key to encrypt
+ SymmetricKey key(rng, 24);
+
+ // The key encryption key
+ SymmetricKey kek(rng, 32);
+
+ std::cout << "Original: " << key.as_string() << "\n";
+
+ Algorithm_Factory& af = global_state().algorithm_factory();
+
+ SecureVector<byte> enc = rfc3394_keywrap(key.bits_of(), kek, af);
+
+ std::cout << "Encrypted: " << hex_encode(enc) << "\n";
+
+ SecureVector<byte> dec = rfc3394_keyunwrap(enc, kek, af);
+
+ std::cout << "Decrypted: " << hex_encode(dec) << "\n";
+ }
diff --git a/doc/log.txt b/doc/log.txt
index 3fa6e6d6b..9313ac2f6 100644
--- a/doc/log.txt
+++ b/doc/log.txt
@@ -1,5 +1,12 @@
-* 1.9.14-dev, ????-??-??
+* 1.9.15-dev, ????-??-??
+ - Pipe will delete empty output queues as soon as they are no longer
+ needed, even if earlier messages still have data unread.
+
+* 1.9.14, 2011-03-01
+ - Add support for bcrypt, OpenBSD's password hashing scheme
+ - Add support for NIST's AES key wrapping algorithm
+ - Fix an infinite loop in zlib filters introduced in 1.9.11 (PR 142)
* 1.9.13, 2011-02-19
- Update Keccak to the round 3 variant