diff options
author | lloyd <[email protected]> | 2009-10-09 18:48:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-09 18:48:11 +0000 |
commit | ebfa4f1f5d07857b1c000f36c8f8cea0984db121 (patch) | |
tree | c390ac5204d1e1238ede6c2d6e5437e6a0992fb0 /doc | |
parent | 43d6a9673f7bbf962ef6075e4268caa44f03a798 (diff) |
Fix python install target. Add CryptoBox wrapper plus an example
Diffstat (limited to 'doc')
-rw-r--r-- | doc/log.txt | 1 | ||||
-rwxr-xr-x | doc/python/cryptobox.py | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/doc/log.txt b/doc/log.txt index 883c3dabe..3dac507ca 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,5 +1,6 @@ * 1.9.1-pre, 2009-??-?? + - Better support for Python and Perl wrappers - Add an implementation of Blue Midnight Wish (Round 2 tweak version) - Add threshold secret sharing (draft-mcgrew-tss-02) - Add runtime cpu feature detection for x86/x86-64 diff --git a/doc/python/cryptobox.py b/doc/python/cryptobox.py new file mode 100755 index 000000000..1968b40e1 --- /dev/null +++ b/doc/python/cryptobox.py @@ -0,0 +1,34 @@ +#!/usr/bin/python + +import sys +import botan + +def main(args = None): + if args is None: + args = sys.argv + + if len(args) != 3: + raise Exception("Bad usage") + + password = args[1] + input = ''.join(open(args[2]).readlines()) + + rng = botan.RandomNumberGenerator() + + ciphertext = botan.cryptobox_encrypt(input, password, rng) + + print ciphertext + + plaintext = '' + + try: + plaintext = botan.cryptobox_decrypt(ciphertext, password + 'FAIL') + except Exception, e: + print "Oops -- ", e + + plaintext = botan.cryptobox_decrypt(ciphertext, password) + + print plaintext + +if __name__ == '__main__': + sys.exit(main()) |