Back to index

obnam  1.1
Public Member Functions
obnamlib.encryption_tests.SymmetricEncryptionTests Class Reference

List of all members.

Public Member Functions

def test_generates_key_of_correct_length
def test_generates_key_with_size_rounded_up
def test_encrypts_into_different_string_than_cleartext
def test_encrypt_decrypt_round_trip

Detailed Description

Definition at line 33 of file encryption_tests.py.


Member Function Documentation

Definition at line 57 of file encryption_tests.py.

00057 
00058     def test_encrypt_decrypt_round_trip(self):
00059         cleartext = 'hello, world'
00060         key = 'sekr1t'
00061         encrypted = obnamlib.encrypt_symmetric(cleartext, key)
00062         decrypted = obnamlib.decrypt_symmetric(encrypted, key)
00063         self.assertEqual(decrypted, cleartext)
00064 

Definition at line 51 of file encryption_tests.py.

00051 
00052     def test_encrypts_into_different_string_than_cleartext(self):
00053         cleartext = 'hello world'
00054         key = 'sekr1t'
00055         encrypted = obnamlib.encrypt_symmetric(cleartext, key)
00056         self.assertNotEqual(cleartext, encrypted)

Definition at line 41 of file encryption_tests.py.

00041 
00042     def test_generates_key_of_correct_length(self):
00043         numbits = 16
00044         key = obnamlib.generate_symmetric_key(numbits, filename='/dev/zero')
00045         self.assertEqual(len(key) * 8 / 2, numbits) # /2 for hex encoding

Definition at line 46 of file encryption_tests.py.

00046 
00047     def test_generates_key_with_size_rounded_up(self):
00048         numbits = 15
00049         key = obnamlib.generate_symmetric_key(numbits, filename='/dev/zero')
00050         self.assertEqual(len(key)/2, 2) # /2 for hex encoding


The documentation for this class was generated from the following file: