Keystore 2.0: Legacy key blobs

This patch adds support for reading legacy keystore blob files.

Test: keystore2_test
Bug: 159371296
Change-Id: I94ec556b2250a0ef7d55c317e13b3f3770a11bc7
diff --git a/keystore2/src/test/utils.rs b/keystore2/src/test/utils.rs
index e016ec0..8c93859 100644
--- a/keystore2/src/test/utils.rs
+++ b/keystore2/src/test/utils.rs
@@ -12,10 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use std::env::temp_dir;
 use std::fs::{create_dir, remove_dir_all};
 use std::io::ErrorKind;
-use std::path::Path;
+use std::path::{Path, PathBuf};
+use std::{env::temp_dir, ops::Deref};
 
 #[derive(Debug)]
 pub struct TempDir {
@@ -44,6 +44,10 @@
         &self.path
     }
 
+    pub fn build(&self) -> PathBuilder {
+        PathBuilder(self.path.clone())
+    }
+
     /// When a test is failing you can set this to false in order to inspect
     /// the directory structure after the test failed.
     #[allow(dead_code)]
@@ -61,3 +65,20 @@
         }
     }
 }
+
+pub struct PathBuilder(PathBuf);
+
+impl PathBuilder {
+    pub fn push(mut self, segment: &str) -> Self {
+        self.0.push(segment);
+        self
+    }
+}
+
+impl Deref for PathBuilder {
+    type Target = Path;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}