WIP: includes everything necessary for encryption, but not tested yet