I'm using a variant of this, seems like the encrypted string is keeping the \n newline char at the end like this:
It looks like base64 encoding so whitespace shouldn't pose a problem. Are you seeing an error?
yes, sorry, it works fine.
Here's a script that can be used to edit an encrypted databag in place. It makes some assumptions about paths but those are adjustable: https://gist.github.com/4123044
Very nice. Here is a generic script for taking a databag file and encrypting it https://gist.github.com/kcd83/6227767