Get key hash for release - android

I have been trying to get my key hash for my release to work for hours now, and I must be doing something wrong because I have searched and tried so many different things,
Now lets say my alias is john_doe_key, and my keysotre is located at /Users/loaner/Downloads/UEat/app/app-release.apk
I would have my command in my terminal look like this correct?
keytool -exportcert -alias john_doe_key -keystore ~/Users/loaner/Downloads/UEat/app/app-release.apk | openssl sha1 -binary | openssl base64
or is that not right?
I have tried this and logging the key like face books says in the guide.
Thanks for the help in advance

From reading your comment and seeing what you have so far, you're trying to get the key hash for Facebook, right?
First, make sure that you have signed your apk (which is your app). You can sign your apk in Android Studio by Build -> "Generate Signed APK...". When you sign your apk, you create your keystore and an alias for that keystore. I think your are confusing "keystore" with the "apk".
Also, you have to include your alias and keystore passwords in your command.
It should look like this:
keytool -exportcert -keystore keystore_file -alias alias_name -storepass keystorepassword -keypass aliaspassword | openssl sha1 -binary | openssl base64
Also, make sure that you are creating a "Release Build", which can be selected from the Build Variants menu.

Generate a key store
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Sign an apk.
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name

Related

Manually query SHA-1 signature of release key

I tried using:
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | PATH_TO_OPENSSL_LIBRARY\bin\openssl sha1 -binary | PATH_TO_OPENSSL_LIBRARY\bin\openssl base64
This didn't seem to work for me as it said:
What do it do?
Use the following command to get SHA-1 hash of your signing key.
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Open your Gradle menu in Android studio.
Expand the "Tasks"
Inside "android", please click on "signingReport"
In you run tab, you will find the SHA-1 key.

How does Ionic/Cordova generate hash key?

I'm working on adding Facebook API integration with ionic/Cordova and am trying to find the debug hash key that is generated for my app when I do:
ionic build android
I know that it generates a new .keystore file at /userhomedir/.android/debug.keystore. But what does it set as the alias and password? And how can I retrieve this hash key after Cordova has created it for my app. I don't see the hash key being printed anywhere during the build process.
I need the generated hash key to give to Facebook API to use their sign on SDK
It seems Cordova use ~/android/debug.keystore with the password android
To get it :
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
With password : android
One answer that worked for me is this one:
Copy the apkname.apk file you want to know the hash of to the 'Java\jdk1.7.0_79\bin' folder
Run this command keytool -list -printcert -jarfile apkname.apk
Copy the SHA1 value and convert it using this site
Use the converted Keyhash value (ex. zaHqo1xcaPv6CmvlWnJk3SaNRIQ=)
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

How to sign my already made android app/.apk file

I have made an Android Live wallpaper application using a software and the app is running perfectly on my device so I thought about uploading it to Playstore.When I uploaded my app it game me following error :
**
"You uploaded an APK signed with a certificate that expires too soon.
You need to sign your APK with a certificate that expires farther into the future."
Now how I can sign my certificate again ?
Please I need detailed tutorial !
you have to create a new signing key that will expire in 25 years or so and sign your application toth that key
to generate map key:=
go to C:\users....android.
keytool -list -alias androiddebugkey -keystore C:\users....android\debug.keystore
-storepass android -keypass android
MD5 finger print:
79:9F:B9:2B:F0:51:C8:48:2E:39:5B:72:AB:42:24:91
map key:
0lujtKtuh8x_MfEUSN5OpCj6HVCxX9lvBDgCT2w
to generate certificate:=
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA
-keysize 2048 -validity 10000
password1- ...,123
password2- ....,1234
previous map key generated : 0Vd9Hpw3AaaLfuaYgC8btoNu8OkuZe4bPXD9oPg
You need to:
Create a release.keystore (it not already done):keytool -genkey -v -keystore release.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Remove the old signature:zip -d foo.apk META-INF/\*
Sign with the new key:jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore release.keystore my_application.apk alias_name
Verify the signature:
jarsigner -verify -verbose -certs my_application.apk

cannot find keytool on a mac

I am trying to find my keytool so that I can make keys to sign my app and to register for the google maps api
I'm beginning to think that I don't actually have it on my machine
If anyone could help point me in the right direction that would be great
To answer the original question, on my Mac, keytool is found at /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/keytool.
You can locate the Java home directory using the /usr/libexec/java_home command line tool on Mac OS X 10.5 or later.
If you are using Eclipse under Mac OS X you just need to
Select File -> Export -> select Android -> Export Android Application -> click next -> select your project -> click next -> here you just chose Create new keystore
The actual tool should be installed all ready, as to my knowledge it ships with the MAC. You then have to create the .keystore file http://www.androiddevelopment.org/tag/keytool/ shows how to do it
If you already have android studio installed, then keytool is located at
/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool
example to generate sha1 and sha256 using keytool
/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
I did the following and it worked for me:
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/keytool -genkey -v -keystore my-release-key.keystore -alias my_keystone -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA1 -keystore my-release-key.keystore app-release-unsigned.apk my_keystone
/Users/developer/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 app-release-unsigned.apk nameapp.apk
Simply use your keytool command in Android Studio Terminal for Mac with a random password
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
you will get -
ga0RGNYHvrrrrrrMMPWQWAPGJ8=

try to obtain the hash key on MAC for integrating facebook in my Android app

If someone has ever done this-obtained the hash key using the key tool on MAC please tell how u did it cause I'm pulling my hair out here.
Here is what I did:
First I found out that I should type these comands:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
| openssl sha1 -binary
| openssl base64
in my terminal in oder to get the hash key.
So I start typing:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
As I pressed ENTER it asked for a password!
I gave up this and try to set a password to my keystore by doing this:
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000
It asked for a password and the re-type password-All good until here.
The terminal also displayed this message:
[Storing my-release-key.keystore]
but it didn't tell where the keystore will be stored!!!
Now, I got the password and then tried again this magic command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
It asked me for the password...I entered that and then it gave me this lovely little message thet drives me insane:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
So please if u know how could I obtain that key give me some details and I will appreciate it FOREVER.
Thank u in advance!
You generated a second keystore with your selected password, you did not change the password on the debug.keystore. AFAIK, the default password for the debug-keystore is android.

Categories

Resources