Updated implementation with Error in Checking passphrase: must convert endline to null