read/write for encrypt/decrypt fully working