| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.util.apk; |
| 18 |
|
| 19 |
import android.annotation.Nullable; |
| 20 |
|
| 21 |
import java.security.cert.Certificate; |
| 22 |
import java.util.Collections; |
| 23 |
import java.util.List; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public final class SourceStampVerificationResult { |
| 33 |
|
| 34 |
private final boolean mPresent; |
| 35 |
private final boolean mVerified; |
| 36 |
private final Certificate mCertificate; |
| 37 |
private final List<? extends Certificate> mCertificateLineage; |
| 38 |
|
| 39 |
private SourceStampVerificationResult( |
| 40 |
boolean present, boolean verified, @Nullable Certificate certificate, |
| 41 |
List<? extends Certificate> certificateLineage) { |
| 42 |
this.mPresent = present; |
| 43 |
this.mVerified = verified; |
| 44 |
this.mCertificate = certificate; |
| 45 |
this.mCertificateLineage = certificateLineage; |
| 46 |
} |
| 47 |
|
| 48 |
public boolean isPresent() { |
| 49 |
return mPresent; |
| 50 |
} |
| 51 |
|
| 52 |
public boolean isVerified() { |
| 53 |
return mVerified; |
| 54 |
} |
| 55 |
|
| 56 |
public Certificate getCertificate() { |
| 57 |
return mCertificate; |
| 58 |
} |
| 59 |
|
| 60 |
public List<? extends Certificate> getCertificateLineage() { |
| 61 |
return mCertificateLineage; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public static SourceStampVerificationResult notPresent() { |
| 70 |
return new SourceStampVerificationResult( |
| 71 |
false, false, |
| 72 |
null, Collections.emptyList()); |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
public static SourceStampVerificationResult verified(Certificate certificate, |
| 83 |
List<? extends Certificate> certificateLineage) { |
| 84 |
return new SourceStampVerificationResult( |
| 85 |
true, true, certificate, certificateLineage); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
public static SourceStampVerificationResult notVerified() { |
| 94 |
return new SourceStampVerificationResult( |
| 95 |
true, false, |
| 96 |
null, Collections.emptyList()); |
| 97 |
} |
| 98 |
} |