-
Notifications
You must be signed in to change notification settings - Fork 38
Update IP phone app teams signature constants to use SHA-512 format #2700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
73e0573
Update IP phone app signature constants to use SHA-512 format
p3dr0rv 8f5bc38
update changelog
p3dr0rv 5871fca
Add comment to clarify usage of Cipher.getInstance in ProviderFactory
p3dr0rv 70c34a7
Merge branch 'dev' into pedroro/update-teams-signature
p3dr0rv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,9 @@ | |
|
||
package com.microsoft.identity.common.internal.broker; | ||
|
||
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_DEBUG_SIGNATURE; | ||
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_PACKAGE_NAME; | ||
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_SIGNATURE; | ||
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_SHA512_DEBUG_SIGNATURE; | ||
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_SHA512_RELEASE_SIGNATURE; | ||
|
||
import android.content.Context; | ||
import android.content.pm.ApplicationInfo; | ||
|
@@ -124,7 +124,7 @@ private static String getSigningCertificateThumbprintForPackage(final PackageInf | |
final Signature[] signatures = getSignatures(packageInfo); | ||
if (signatures != null && signatures.length > 0) { | ||
final Signature signature = signatures[0]; | ||
MessageDigest md = MessageDigest.getInstance(useSha512 ? "SHA-512" : "SHA"); | ||
MessageDigest md = MessageDigest.getInstance(useSha512 ? "SHA-512" : "SHA"); // CodeQL [SM05136] MSAL still uses SHA-1 format in redirect url. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHA or SHA-1? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "SHA" is a standard alias for SHA-1 in Android. |
||
md.update(signature.toByteArray()); | ||
return Base64.encodeToString(md.digest(), Base64.NO_WRAP); | ||
} | ||
|
@@ -293,9 +293,9 @@ public boolean verifyIfValidTeamsPackage(final String packageName) { | |
|
||
if (packageName.equals(IPPHONE_APP_PACKAGE_NAME) && | ||
isPackageInstalledAndEnabled(IPPHONE_APP_PACKAGE_NAME)) { | ||
final String currentSignatureForTeamsApp = getSha1SignatureForPackage(IPPHONE_APP_PACKAGE_NAME); | ||
if (IPPHONE_APP_SIGNATURE.equals(currentSignatureForTeamsApp) || | ||
IPPHONE_APP_DEBUG_SIGNATURE.equals(currentSignatureForTeamsApp)) { | ||
final String currentSignatureForTeamsApp = getSha512SignatureForPackage(IPPHONE_APP_PACKAGE_NAME); | ||
if (IPPHONE_APP_SHA512_RELEASE_SIGNATURE.equals(currentSignatureForTeamsApp) || | ||
IPPHONE_APP_SHA512_DEBUG_SIGNATURE.equals(currentSignatureForTeamsApp)) { | ||
return true; | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are these signatures generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
teams provided the APKS, and we run package inspector (package-inspector/src/main/java/com/microsoft/inspector/MainActivity.java) a test app inside MSAL.
More details in this PR
https://github.com/AzureAD/microsoft-authentication-library-for-android/pull/2324/files