Use libhex to encode hex string in libs/apkverify/
Bug: 239413416
Test: libapkverify.test, libapkverify.integration_test
Change-Id: I21285b1528f6eb8806a594f53b7b1045255af3b5
Signed-off-by: Tanmoy Mollik <triploblastic@google.com>
diff --git a/libs/apkverify/src/v3.rs b/libs/apkverify/src/v3.rs
index db7d8cc..fcd966b 100644
--- a/libs/apkverify/src/v3.rs
+++ b/libs/apkverify/src/v3.rs
@@ -196,8 +196,8 @@
ensure!(
computed == digest.digest.as_ref(),
"Digest mismatch: computed={:?} vs expected={:?}",
- to_hex_string(&computed),
- to_hex_string(&digest.digest),
+ hex::encode(&computed),
+ hex::encode(digest.digest.as_ref()),
);
// 7. Verify that public key of the first certificate of certificates is identical
@@ -261,8 +261,3 @@
Ok(PKey::public_key_from_der(raw_public_key.as_ref())?)
}
}
-
-#[inline]
-pub(crate) fn to_hex_string(buf: &[u8]) -> String {
- buf.iter().map(|b| format!("{:02X}", b)).collect()
-}