use a stream, this way it also works for public shared galleries and with encryption enabled