How to get SHA1 key in my Windows I tried many ways but no use - firebase-authentication

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

Related

hashkey mismatch error android faebook app

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.

Enabling-ssl-https for the keycloak-server

I am using keycloak-8.0.1 in standalone configuration . I am trying to enable SSL/Https for Keycloak server running on my Test machine (A.B.C.D) , token request will be requested from machine (X.Y.Z.P).
(Will there be any CORS/CSRF issue for the generated token , looks like yes ? And will Keycloak over SSL help to solve this?) Nevertheless i require SSL enabling .
So went ahead with https://www.keycloak.org/docs/latest/server_installation/#enabling-ssl-https-for-the-keycloak-server
Step 1 Run command :
keytool -genkey -alias localhost -keyalg RSA -keystore keycloak.jks -validity 10950
...
two files server.key and keycloak.jks got created.
Question : should i used localhost here or better to use IP A.B.C.D of my Test machine? Though documentation says localhost so went ahead with that.
Step 2 Generate a certificate request :
$ keytool -certreq -alias yourdomain -keystore keycloak.jks > keycloak.careq
I can also generate the cert request using localhost/A.B.C.D.
Step 3: Send the cert req created in above step to CA and download the root cert from CA(root.crt) and import using command:
keytool -import -keystore keycloak.jks -file root.crt -alias root
Do i have to skip this step for localhost and if not how to generate root.crt for localhost.
step 4: last step is to import CA generated certificate to keystore
$ keytool -import -alias yourdomain -keystore keycloak.jks -file your-certificate.cer
Question: Now i have only two files generated in very first step "server.key" and keycloak.jks
and from where i should get root.crt and your-certificate.cer ? I tried uploading the ca request to CAcert.org but they dont create certificate for localhost DNS.
I already went through lot of links link1 , link2 , link3 link4 and getting confused
Please help.
Answer 1-
If you are testing this in your local machine you can use localhost but better would be if you are using IP-address or host name
Answer 3
Again if its for your testing you can use Self Sign Certificate only,No need to go to Ads Certificate authority.
Answer 4-
So for localhost or your machine IP simple Create Certificate with the help of keytool
keytool -genkey -alias initcert -ext san=ip:xxx.xxx.xxx.xx -keyalg RSA -keystore keycloak.jks-validity 365 -keysize 2048
Export the certificates
keytool -export -noprompt -trustcacerts -keystore keycloak.jks -alias initcert -file keycloak.cer -storepass changeit
Import Certificates into Client machine Java Keystore
keytool -import -noprompt -trustcacerts -alias "initcert" -file keycloak.cer -keystore /workspace/tools/jdk/java-1.7.0-openjdk-1.7.0.25.x86_64/jre/lib/security/cacerts

The key hash does not match any stored key hashes in facebook react-native app

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

How to generate trusted self signed certificate with SHA2 signing algorithm using keytool?

I am trying to establish a secure connection for my application using jetty http server version 8.1.8.v20121106 with self signed certificate.
I am generating self signed certificate with the following command,
keytool -genkey -alias mykey -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -validity 365 -keypass password -keystore keystore.jks -storepass password
keytool -export -alias mykey -file server.cer -keystore keystore.jks -storepass password
keytool -import -alias mykey -file server.cer -keystore truststore.jks -storepass password
So, totally 3 files generate (keystore.jks,server.cer,truststore.jks)
After the server gets started, I got the following error in my browser. There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).
Could anyone help me to generate a trusted self signed certificate using keytool.
Thanks in advance.
It is the problem with java jdk. I have verified using java 1.8 and jdk1.7.0_79 it is working fyn for me. Change your java jdk version and verify. For further clarification, Please refer this link.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398644

Sonatype Nexus: Where in the GUI can I add a SSL certificate?

I'm using Sonatype Nexus 2.5.0-04. I'm trying to add a SSL certificates in the user interface, as described in the documentation here:
http://books.sonatype.com/nexus-book/reference/ssl-sect-client-cert.html
The documentation says "The administration interface for SSL certificates as visible in Figure 23.1, 'SSL Certificates Administration' and can be accessed by selecting SSL Certificates in the right hand Administration menu."
Where is the "right hand Administration menu"? I've looked everywhere. I can't find a link for SSL certificates in the GUI anywhere. I thought perhaps this might be a feature available only in the professional version, but there is no mention of that in the documentation on the differences between the two versions.
This is a feature that is only available in Nexus Professional and it should be the left hand navigation.. I will fix this in the book.
Update: Documentation is now fixed.
I would like to make an appreciation about configuring Nexus front with SSL and a self-signed certificate because when you use the keytool to generate de keystore.jks file as is indicated in https://support.sonatype.com/hc/en-us/articles/213465768-SSL-Certificate-Guide?_ga=2.171695904.1899216110.1638870535-818117565.1624006959
keytool -genkeypair -keystore keystore.jks -storepass password -alias example.com \
-keyalg RSA -keysize 2048 -validity 5000 -keypass password \
-dname 'CN=*.example.com, OU=Sonatype, O=Sonatype, L=Unspecified, ST=Unspecified, C=US' \
-ext SAN=DNS:nexus.example.com,DNS:clm.example.com,DNS:repo.example.com,DNS:www.example.com'
you obtain an Invalid keystore format error bacause the default TrustStoreType of keytool is PKCS12. I had to force it to JKS to be able to start Nexus with the -storeType option.
keytool -genkeypair -keystore keystore.jks -storeType JKS -storepass password -alias example.com \
-keyalg RSA -keysize 2048 -validity 5000 -keypass password \
-dname 'CN=*.example.com, OU=Sonatype, O=Sonatype, L=Unspecified, ST=Unspecified, C=US' \
-ext SAN=DNS:nexus.example.com,DNS:clm.example.com,DNS:repo.example.com,DNS:www.example.com'
I don't know if you could correct it in the documentation or at least to make some appreciation about.
I've found this problem with the Nexus' version 3.30.1.01.