I am using this below code to generate facebook Android hash key
$ keytool -exportcert -alias androiddebugkey -keystore "C:\Documents and
Settings\Administrator.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1
-binary |"C:\OpenSSL\bin\openssl" base64
But it generates 25 characters key, It should be 29. Facebook allows to adding the key only if key length is 29.
Is that code correct?
Related
I'm not able to get SHA1 key for Firebase project. How can I do that? I'm using Angular.
I tried this one:
keytool -list -v \ -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
i created a react native android app. and then was using react-native-fbsdk to authenticate user using facebook..t i have registered the app in facebook developer portal and changed my manifest file and string file. when i launch the LoginManager.logInWithPermissions(['public_profile', 'email']) it authenticates and brings me to facebook, signs in and then gives me error "The key hash does not match any stored key hashes. Go to https://developers.facebook.com/docs/facebook-login/android for more information.".
i have created the hashkey with teh command in the help documenation with both the options here:
1.
keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%.android\debug.keystore | C:\Users\manshuk\Downloads\openssl-0.9.8k_X64\bin\openssl sha1 -binary | C:\Users\manshuk\Downloads\openssl-0.9.8k_X64\bin\openssl base64
and using the debug.keystore of the app itself like this:
keytool -exportcert -alias androiddebugkey -keystore android/app/debug.keystore | C:\Users\manshuk\Downloads\openssl-0.9.8k_X64\bin\openssl sha1 -binary | C:\Users\manshuk\Downloads\openssl-0.9.8k_X64\bin\openssl base64
i added the key in the app in facebook. in app setting, facebook.
Im not saying this works all the time. But, this worked for me.
First get you sha-1 (Read the code, youll have to EDIT it)
keytool -list -v -keystore "C:\Users\EDIT THIS\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
paste that in your Command prompt.
Now copy your sha-1
GO HERE > https://tomeko.net/online_tools/hex_to_base64.php
Paste your sha-1 key in the "HEX STRING:"
Copy the value of Output (base64):
Now paste that in your fb developer app hash keys
Save, delete your app in your phone, re-install, run.
I ma working on react-native latest version 60+. I am integrate the facebook login on debug mode but get the issue error:
Error: SERVER_ERROR: [code] 1349195 [message]: The key hash does not match any stored key hashes. Go to https://developers.facebook.com/docs/facebook-login/android for more information. [extra]:
I am open the new terminal and got the key hash using is command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
And add the bebug key hash on facebook developers. But I am get the error.
Try to use file in android/app/debug.keystore
cd <your project>
then
keytool -exportcert -alias androiddebugkey -keystore android/app/debug.keystore | openssl sha1 -binary | openssl base64
My client doesn't have MobileFirst plugin for eclipse installed and I need guide him to extract the public sign key for app authentication.
Is there a way to extract the public sign key from command line?
The keystore that is used to hold the key used to sign your APK is just a normal Java keystore in JKS format, which can be manipulated using the standard Java "keytool" command. You can extract the certificate in PEM format by doing something like:
keytool -exportcert -keystore keystore_name -alias alias_name -rfc > cert.txt
(where "keystore_name" is the name of the keystore file, and "alias_name" is the key alias for the key being used to sign the APK)
and then extract the public key from the "cert.txt" file you just created, by doing something like:
openssl x509 -in cert.txt -pubkey -noout
The public key you need will appear between the "-----BEGIN PUBLIC KEY-----" and "-----END PUBLIC KEY-----" lines.
If you wanted to do it in a single command, something like:
keytool -exportcert -keystore keystore_name -alias alias_name -storepass keystore_password -rfc | openssl x509 -pubkey -noout | grep -v PUBLIC
would extract and print just the public key, so that you could capture it in a shell variable or something.
I am trying to import a certificate into a keystore.
Therefore i execute the following steps:
Create an empty keystore.jks file
Create the file contentent with the keytool:
keytool -genkey -alias server-alias -keyalg RSA -keypass changeit -storepass changeit -keystore keystore.jks
Add my certificate to that keystore:
keytool -import -v -trustcacerts -alias server-alias -file C:\server.cert -keystore keystore.jks -keypass changeit -storepass changeit
But I always get the error:
keytool error: java.lang.Exception: Public keys in reply and keystore don't match
What am I doing wrong here and how can I fix it?
In step two you always generate a new key, but if you want to import a certificate and it's private key into the keystore you have to use the key that matches the certificate.
Hence you need the key you created before someone signed your server certificate (the one stored in C:\server.cert).
The following steps have to be performed in the right order:
Create a random public/private key pair. The private key is usually saved password protected
Create a certificate request containing the public key from step 1
Send the certificate request to a trust center which signs it and sends you back the certificate (the server.cert you have)
Save the private key from step 1 together with the returned certificate
Therefore you are always trying to re-do step 1 and 4 without step 2 and 3. Thus you are getting that "don't match" error.
Just complete all steps 1-4 after another. Or use the saved private key that belongs to the server.cert certificate (hopefully you still have it).