Fix issues with versioning of encrypted files. Add more tests for versioning. Support setting version to 0 for a previous key that was not versioned.