Share via


PackageManager.HasSigningCertificate Method

Definition

Overloads

HasSigningCertificate(Int32, Byte[], CertificateType)

Searches the set of signing certificates by which the package(s) for the given uid has proven to have been signed.

HasSigningCertificate(String, Byte[], CertificateType)

Searches the set of signing certificates by which the given package has proven to have been signed.

HasSigningCertificate(Int32, Byte[], CertificateType)

Searches the set of signing certificates by which the package(s) for the given uid has proven to have been signed.

[Android.Runtime.Register("hasSigningCertificate", "(I[BI)Z", "GetHasSigningCertificate_IarrayBIHandler", ApiSince=28)]
public virtual bool HasSigningCertificate (int uid, byte[] certificate, Android.Content.PM.CertificateType type);
[<Android.Runtime.Register("hasSigningCertificate", "(I[BI)Z", "GetHasSigningCertificate_IarrayBIHandler", ApiSince=28)>]
abstract member HasSigningCertificate : int * byte[] * Android.Content.PM.CertificateType -> bool
override this.HasSigningCertificate : int * byte[] * Android.Content.PM.CertificateType -> bool

Parameters

uid
Int32

uid whose signing certificates to check

certificate
Byte[]

signing certificate for which to search

type
CertificateType

representation of the certificate

Returns

true if this package was or is signed by exactly the certificate certificate

Attributes

Remarks

Searches the set of signing certificates by which the package(s) for the given uid has proven to have been signed. For multiple packages sharing the same uid, this will return the signing certificates found in the signing history of the "newest" package, where "newest" indicates the package with the newest signing certificate in the shared uid group. This method should be used instead of getPackageInfo with GET_SIGNATURES since it takes into account the possibility of signing certificate rotation, except in the case of packages that are signed by multiple certificates, for which signing certificate rotation is not supported. This method is analogous to using getPackagesForUid followed by getPackageInfo with GET_SIGNING_CERTIFICATES, selecting the PackageInfo of the newest-signed bpackage , and finally searching through the resulting signingInfo field to see if the desired certificate is there.

Java documentation for android.content.pm.PackageManager.hasSigningCertificate(int, byte[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

HasSigningCertificate(String, Byte[], CertificateType)

Searches the set of signing certificates by which the given package has proven to have been signed.

[Android.Runtime.Register("hasSigningCertificate", "(Ljava/lang/String;[BI)Z", "GetHasSigningCertificate_Ljava_lang_String_arrayBIHandler", ApiSince=28)]
public virtual bool HasSigningCertificate (string packageName, byte[] certificate, Android.Content.PM.CertificateType type);
[<Android.Runtime.Register("hasSigningCertificate", "(Ljava/lang/String;[BI)Z", "GetHasSigningCertificate_Ljava_lang_String_arrayBIHandler", ApiSince=28)>]
abstract member HasSigningCertificate : string * byte[] * Android.Content.PM.CertificateType -> bool
override this.HasSigningCertificate : string * byte[] * Android.Content.PM.CertificateType -> bool

Parameters

packageName
String

package whose signing certificates to check

certificate
Byte[]

signing certificate for which to search

type
CertificateType

representation of the certificate

Returns

true if this package was or is signed by exactly the certificate certificate

Attributes

Remarks

Searches the set of signing certificates by which the given package has proven to have been signed. This should be used instead of getPackageInfo with GET_SIGNATURES since it takes into account the possibility of signing certificate rotation, except in the case of packages that are signed by multiple certificates, for which signing certificate rotation is not supported. This method is analogous to using getPackageInfo with GET_SIGNING_CERTIFICATES and then searching through the resulting signingInfo field to see if the desired certificate is present.

Java documentation for android.content.pm.PackageManager.hasSigningCertificate(java.lang.String, byte[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to