Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,7 @@ private boolean isValidAuthenticatorRedirectUri() {
if (AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_RELEASE_SIGNATURE_SHA512.equalsIgnoreCase(sha512_signingCertThumbprint)
|| AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_DEBUG_SIGNATURE_SHA512.equalsIgnoreCase(sha512_signingCertThumbprint)) {

// MSAL still uses SHA-1 format in redirect url.
final MessageDigest md_sha1 = MessageDigest.getInstance("SHA");
final MessageDigest md_sha1 = MessageDigest.getInstance("SHA"); // CodeQL [SM05136] MSAL still uses SHA-1 format in redirect url.
md_sha1.update(signature.toByteArray());
final String sha1_signingCertThumbprint = Base64.encodeToString(md_sha1.digest(), Base64.NO_WRAP);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,24 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon
getPackageManagerFlag()
);

String packageSigningSha = "";
String signingCertificateHashes = "";

final Signature[] signatures = getSignatures(packageInfo);
if (null != signatures
&& signatures.length > 0) {
final Signature signature = signatures[0];
final MessageDigest digest = MessageDigest.getInstance("SHA");
digest.update(signature.toByteArray());
packageSigningSha = Base64.encodeToString(digest.digest(), Base64.NO_WRAP);
final MessageDigest digestSha1 = MessageDigest.getInstance("SHA-1"); // CodeQL [SM05136] This is only for test purposes, not used in production.
digestSha1.update(signature.toByteArray());
final String packageSigningSha1 = Base64.encodeToString(digestSha1.digest(), Base64.NO_WRAP);

final MessageDigest digestSha512 = MessageDigest.getInstance("SHA-512");
digestSha512.update(signature.toByteArray());
final String packageSigningSha512 = Base64.encodeToString(digestSha512.digest(), Base64.NO_WRAP);

signingCertificateHashes = "SHA-1: " + packageSigningSha1 + "\nSHA-512: " + packageSigningSha512;
}

String msg = packageSigningSha;
String msg = signingCertificateHashes;

if (isAnAuthenticatorApp(pkgName)) {
msg += "\n\n" + getAuthenticatorAppMetadata(pkgName);
Expand Down