Rename key_dir to metadata_key_dir and refactor

Bug: 147814592
Test: Crosshatch boots
Change-Id: I18b03486d2e93c6103880d1af68d9f70147fde63
5 files changed