Fixes for recursive opendir
[Issue#] N/A
[Feature] Replacing recursive opendir with safe fts_ functions
[Cause] Recursive opendir may reach limit of open dirs for process
[Solution] Replace with standard fts_* functions for traversing directories
[Verification] Install an encrypted widget and verify that encryption works
Major rewrite to resource encryption functions was done - verify by installing
an encrypted widget and checking that eligible resources are really encrypted.
Minor fixes added, mainly to close directories that are no longer used.
Change-Id: I51e36f225d49cd46b5454c0cf7cbda09d9e7c1c1