keytool can't find alias - ssl

I've got a pfx certificate that I need to reference by alias. The problem is that keytool can't find that alias, even though it shows on the list.
keytool -list -keystore temp.pfx -storetype pkcs12
gives me this:
...
0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c, 08/03/2013, PrivateKeyEntry,
...
But whenever I try to use keytool to do anything with that alias (i.e., export, rename), it gives me an error:
keytool error: java.lang.Exception: Alias <0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c> does not exist
Any ideas?

It turns out that after inspecting the output of keytool -list on vim, I found a null character at the end of the alias (which doesn't get printed to the console). Once I added that to the command that references an alias, it worked:
keytool -keyclone -changealias -v -dest "new_alias" -new newpass -keystore temp.pfx -storetype pkcs12 -alias 0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c$'\x00'
Where the very end is what really matters: $'\x00' stands for null character in bash. Keep in mind that this is pretty shell-dependent.

my case was similar to Andre, but the alias was
letsencryptisrgx1 [jdk]
so using alias "letsencryptisrgx1 [jdk]" it worked for me

Related

How to Get SHA-1 key in React Native cli?

In React Native when I'm trying to get Google GPS API key in Google console, I have seen package name and SHA-1 key where to I get SHA-1 key in React Native
How to get SHA-1 key in React Native cli? (not in Expo).
Windows:
– Open a terminal window
– Change the directory to the JDK bin directory. The path of the JDK depends upon the operating system you are using
cd C:\Program Files\Java\jdk1.8.0_121\bin
– Now we have to run the following command using the keytool.exe file in JDK/bin
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Ubuntu/Mac
– Open a terminal window
– Now run the following command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
For more details click Here
From React-native Project:
– Run this command in React-Native App directory
cd android && ./gradlew signingReport
– copy the SHA1 from the debug key (This generates two variant keys. You can copy the 'SHA1' that belongs to the debugAndroidTest variant key option.)
There is debug.keystore available by default in android => app folder so we can use it to generate SHA1 key.
The command is as follows
keytool -exportcert -keystore ./android/app/debug.keystore -list -v
It will ask for password so just press Enter.
As far as I understand you, it's about Android.
You need input certificate fingerprint, what you use for sign *.apk file.
For generate SHA-1 fingerprint, open a terminal window and enter the following:
keytool -list -v -keystore PATH_TO_YOUR_KEYSTORE.keystore -alias YOUR_ALIAS_NAME -storepass YOUR_STORE_PASS -keypass YOUR_KEY_PASS
This should look something like this:
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75
You can find more information here
If you don't have a certificate yet, I recommend you create it.
How to create a certificate you can read here.
Get SHA1 Key
Simple run below command :
keytool -list -v -keystore ./android/App/debug.keystore -alias androiddebugkey -storepass android -keypass android
if your are Using react native
and using
keytool -list -v -keystore ./android/App/debug.keystore -alias androiddebugkey -storepass android -keypass android
there are Chances getting ERROR
to Avoid ERROR in WINDOWS
1)Run your Command Prompt As Administrator
Navigate to your react-native project's root folder
3)cd android
4)type in ./gradlew signingReport
this will generate All kinds of SHA-1 And SHA-256 and many more details
Even though running keytool on jdk/bin and ./gradlew signingReport command gives SHA-1 & SHA-256 keys I had troubles when using those keys on firebase / gcp to register my app. For some reason running keytool command on project root folder output gives you a SHA-1 key which can be use to register the app in gcp. In windows, there are the steps you should follow
Make sure keytool is the enviroment variable path
Open the cmd in your root project folder (eg: C:/myreactnativeproject/)
run keytool -list -v -keystore ./android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android
And there is your SHA-1
my solution: keytool -J-Duser.language=en -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
first move to android folder cd android
and than simply run .\gradlew signingReport command
this help me on windows operating system
First Go To Your Project Directory And Just Simple Run This Command
keytool -list -v -keystore ./android/App/debug.keystore -alias androiddebugkey -storepass android -keypass android
And You Can Get

Failed to generate apk due to error "error: uncompiled PNG file passed as argument. Must be compiled first into .flat file.."

I'm attempting to generate a signed APK for my react-native project. I've received the error message error: "uncompiled PNG file passed as argument. Must be compiled first into .flat file.."
How do I resolve this issue? I've looked at this question and have also tried adding android.enableAapt2=false to the gradle-wrapper.properties file.
I have also tried manually creating a debug build as instructed here:
Finally, I noticed that there's a key component missing in the rn documentation
The first step is to
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
However, I did not see anywhere about specifying the location for the my-release-key.keystore file. I was not able to get this to work until I used
keytool -genkey -v -keystore d:\my_private_key.keystore -alias my_key_alias -keyalg RSA -keysize 2048 -validity 10000
android.enableAapt2=false
should be placed inside gradle.properties NOT gradle-wrapper.properties!

Error While Generating .bks file

I am using wso2-emm 2.0.1 with ubuntu x64 system. While configuring the product I am getting one error in genrating .bks file for android agent certificate.
I've used this cmd:
keytool -noprompt -import -v -trustcacerts -alias 'openssl x509 -inform PEM -subject_hash -noout -in ca_cert.pem' -file ca_cert.pem -keystore emm_truststore.bks -storetype BKS -providerclass org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath bcprov-jdk16-146.jar -storepass 'wso2carbon'
And the correspoding errror is :
keytool error: java.io.IOException: Wrong version of key store.
java.io.IOException: Wrong version of key store.
at org.bouncycastle.jce.provider.JDKKeyStore.engineLoad(Unknown Source)
Thanks in advance

Can't get MD5 to get maps api key?

I made a map app for Android. But when I try to get the MD5 for Map API kety,using the command keytool.exe
-list -alias androiddebugkey
-keystore "C:\android\debug.keystore"
-storepass android -keypass android
I get only one sha1 and not the MD5. I am using jdk 7 and Windows 7 32 bit. Any help is much appreciated. Thanks.
With JDK 1.7 installed, keytool outputs by default SHA1 fingerprint, not MD5. Adding -v option allows to see MD5 as well.
-v for verbose..

Trying to obtain MD5 fingerprint for debug certificates, getting Errors

While in the keytool directory I type in what I am supposed to as instructed by the Google code website.
To generate an MD5 fingerprint of the debug certificate, first locate the debug keystore. By default, build tools create the debug keystore in the active AVD directory. The location of the AVD directories varies by platform:
MY CODE IN CMD:
C:\Program Files\Java\jdk1.6.0_23\bin>keytool -list -alias androiddebugkey -keys
tore C:\Documents and Settings\nwashington.android\debug.keystore -storepass an
droid -keypass android
MY ERROR:
keytool error: java.lang.RuntimeException: Usage error, and is not a legal command
I have already checked:
-If the files are actually located in these directories
-Tried out this website: http://remwebdevelopment.com/dev/a35/Android-How-To-Set-Up-an-API-Key-for-Google-Maps.html
Please Help!
Thanks
Make sure that you put the path to your debug keystore in quotes because Windows does not recognise spaces in Documents and Settings. Your command should be like this:
keytool -list -alias androiddebugkey -keys tore "C:\Documents and Settings\nwashington.android\debug.keystore" -storepass an droid -keypass android
Copy it just the way it is and paste it in your command prompt. It should be able to run !!!!