[apkverify][test] Check public key extracted from apk is valid

This CL checks that the public key extracted directly from apk
(without verification) is valid. So that after this cl, the
integration tests will check

public key from verification ==
public key extracted from apk without verification ==
expected public key

Bug: 239534874
Test: libapkverify.integration_test
Change-Id: I3f8a826bf17e74404788c224afcc8d6fc17b5b81
diff --git a/libs/apkverify/tests/apkverify_test.rs b/libs/apkverify/tests/apkverify_test.rs
index d7b1dc2..03cb4bb 100644
--- a/libs/apkverify/tests/apkverify_test.rs
+++ b/libs/apkverify/tests/apkverify_test.rs
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-use apkverify::{testing::assert_contains, verify};
+use apkverify::{get_public_key_der, testing::assert_contains, verify};
 use std::{fs, matches, path::Path};
 
 const KEY_NAMES_DSA: &[&str] = &["1024", "2048", "3072"];
@@ -208,6 +208,10 @@
         expected_public_key_path
     );
 
-    // TODO(b/239534874): Validates public key extracted directly from apk
+    // Validates public key extracted directly from apk
     // (without verification) == expected public key.
+    let public_key_from_apk = get_public_key_der(apk_path.as_ref());
+    let public_key_from_apk =
+        public_key_from_apk.expect("Error when extracting public key from apk");
+    assert_eq!(expected_public_key, public_key_from_apk.as_ref(), "{}", expected_public_key_path);
 }