Implement proper BSON serialization of private keys