Strip leading and trailing whitespace from base-64-encoded ciphertext and IV

This also updates corresponding unit tests to take account of whitespace trimming.
Fix up tests