Completed the key creation
Completed the encryptKey function, slight error