Fix tests for GenerateKey and Marshalling