diff options
| author | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-05-27 10:40:50 -0400 |
|---|---|---|
| committer | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-05-27 10:40:50 -0400 |
| commit | f6d847cd867c09319f9fc451c09dc7322542e26b (patch) | |
| tree | 443491286f802bdb29566e90e619a30147fba384 | |
| parent | 107b15d2dd7d554d9cca177343ab45c51029d484 (diff) | |
| download | nova-f6d847cd867c09319f9fc451c09dc7322542e26b.tar.gz nova-f6d847cd867c09319f9fc451c09dc7322542e26b.tar.xz nova-f6d847cd867c09319f9fc451c09dc7322542e26b.zip | |
prevent encryption from adding newlines on long messages
| -rw-r--r-- | nova/tests/test_xenapi.py | 4 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 0632d05a5..fe37f0ebe 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -594,6 +594,7 @@ class XenAPIDiffieHellmanTestCase(test.TestCase): def _test_encryption(self, message): enc = self.alice.encrypt(message) + print enc self.assertFalse(enc.endswith('\n')) dec = self.bob.decrypt(enc) self.assertEquals(dec, message) @@ -613,6 +614,9 @@ class XenAPIDiffieHellmanTestCase(test.TestCase): def test_encrypt_with_leading_newlines(self): self._test_encryption('\n\nMessage with leading newlines.') + def test_encrypt_really_long_message(self): + self._test_encryption(''.join(['abcd' for i in xrange(1024)])) + def tearDown(self): super(XenAPIDiffieHellmanTestCase, self).tearDown() diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index ce84c8652..1fcaaeede 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1201,7 +1201,7 @@ class SimpleDH(object): return proc.stdout.read() def encrypt(self, text): - cmd = 'enc -aes-128-cbc -a -pass pass:%s -nosalt' % self._shared + cmd = 'enc -aes-128-cbc -a -A -pass pass:%s -nosalt' % self._shared return self._run_ssl(cmd, text).strip('\n') def decrypt(self, text): |
