Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

azure signaturehash rejects my Base64 encoded SHA1 hash from debug.keystore

I try to authentificate my xamarin app on azure.

To create the Base64 encoded SHA1 hash for my debug.keystore i used the suggested command:

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

I get a result but it has 32 characters and gets rejected from azures frontend validation with the message:

The signature hash must be a Base64 encoded SHA1 hash.

If i use the placeholder or a substring of my hash it is working

2pmj9i4rSx0yEb/viWBYkE/ZQrk=       <- `Example from Azure (is working)`
aPz8/NARbPz8pPzg/Iz9aPz8NCg=       <- `some working example generated by me`
CAY/Pz8/NARbPz8pPzg/Iz9aPz8NCg==   <- `My base64 (is not working)`

it seems like that azure needs always 28 characters but my generated base74 has 32...

I wasted 20 hours on this problem but diddnt find any solution.

like image 329
Felix Kibellus Avatar asked Jan 25 '23 03:01

Felix Kibellus


2 Answers

I just encountered this same issue. AzureAd does not seem to want openssl sha1 -binary | openssl base64

I had to open up gradle on android/app/build.gradle

open up app/tasks/android -> signingReport

grab the sha1 from there in the form of xx:xx:xx...xx:xx

convert to base 64 here: https://base64.guru/converter/encode/hex

hope this helps

like image 50
Sam Svindland Avatar answered Feb 12 '23 01:02

Sam Svindland


Not enough rep to comment on Jorge Luiz's post, but I had to complete an additional step to make this method work. My full solution was this:

  • Go to settings (File -> Settings)
  • Go to the Experimental tab
  • Under Gradle, disable Do not build Gradle task list during Gradle sync

Then follow the steps as in Jorge's post, which I will recap here. If the task does not appear, you may need to sync your gradle files again. You can find this option under File -> Sync project with gradle files. Then follow these steps:

  • Open the Gradle view (View -> Tool Windows -> Gradle)
  • Locate the signingReport task (<projectname>(/app)/Tasks/android/signingReport)
  • Double click, or right click and select run

The Run tab should automatically open, then from there you:

  • Copy the SHA1 HEX value in the form XX:XX:XX...
  • Convert it to base64 using a tool like https://base64.guru/converter/encode/hex
like image 36
Thomas N Avatar answered Feb 12 '23 00:02

Thomas N