apkverify:Raise NotFound error when searching for signature
Bug: 197052966
Test: atest libapkverify.test
Change-Id: Id729dc64226dbfb78524620266510b1ffa559f2e
diff --git a/libs/apkverify/src/v3.rs b/libs/apkverify/src/v3.rs
index 876e98b..d429ba1 100644
--- a/libs/apkverify/src/v3.rs
+++ b/libs/apkverify/src/v3.rs
@@ -15,6 +15,8 @@
*/
//! Verifies APK Signature Scheme V3
+//!
+//! [v3 verification]: https://source.android.com/security/apksigning/v3#verification
use anyhow::{anyhow, bail, ensure, Context, Result};
use bytes::Bytes;
@@ -36,9 +38,6 @@
// TODO(jooyung): get "ro.build.version.sdk"
const SDK_INT: u32 = 31;
-/// Data model for Signature Scheme V3
-/// https://source.android.com/security/apksigning/v3#verification
-
type Signers = LengthPrefixed<Vec<LengthPrefixed<Signer>>>;
struct Signer {
@@ -160,6 +159,7 @@
Ok((digest.signature_algorithm_id, digest.digest.as_ref().to_vec().into_boxed_slice()))
}
+ /// The steps in this method implements APK Signature Scheme v3 verification step 3.
fn verify<R: Read + Seek>(&self, sections: &mut ApkSections<R>) -> Result<Box<[u8]>> {
// 1. Choose the strongest supported signature algorithm ID from signatures.
let strongest = self.strongest_signature()?;