개발

Android KeyStore 정보 확인

TigerFish 2022. 3. 18. 13:42

글을 쓰는 목적 

 

KeyStore 비밀 번호 생성시 비밀번호가 보이지 않아 제대로 비밀번호를 입력했는지 의문이 들 때가 있다. 비밀번호를 정상적으로 입력했는지 확인하기 위해 글을 찾던 중 생각보다 정리되어있는 글이 별로 없어 기록을 남긴다.


작업 환경

 

OpenSSL : openssl-0.9.8k_X64

JAVA : jre1.8.0_311


KeyStore 정보 확인

 

KeyStore 생성 방법

 

https://thekingofviral.com/how-to-generate-google-play-app-signing-key-hash-2021/

 

How To Generate Google play app signing key hash 2021 - The King Of Viral

How To Generate Google play app signing key hash For Facebook Key Hashes In this article, we will tell you ... Read more

thekingofviral.com

 

KeyStore 정보 확인

 

keytool -v -list -keystore .keystore

 

특정 Alias 정보 확인 

 

keytool -list -keystore .keystore -alias foo

 

KeyStore 비밀 번호 확인 

 

keytool -list -keystore <keystorefile> -storepass <passwordtocheck>

 

KeyStore 비밀번호, Alias 비밀 번호 확인 

 

-keypass -new 명령어를 치면 Alias의 새로운 비밀번호를 입력하라고 하는데 이전에 넣은 Alias 비밀번호를 넣으면 같은 비밀번호를 넣지 말라고 에러를 낸다. 같은 비밀번호를 넣면 안된다고 에러가 나면 비밀번호 정상 입력했다는 것이다. 목표는 비밀번호 확인이므로 에러만 확인하고 새로운 비밀번호를 넣지 말자. 

keytool -keypasswd -keystore <keystore> -alias <alias> -storepass <storepass> -keypass <keypass> -new <keypass>

 

Hash Key 추출

 

Google이나 Facebook에서 사용하는 해쉬 키가 필요하다. Keystore에서 해쉬키를 뽑아야하는데 아래와 같이 하는 경우 잘못된 비밀번호를 입력해도 해쉬키가 나온다. keytool -exportcert -alias <alias >-keystore <.keystore> 를 먼저 돌려보고 키가 맞는지 확인 후 아래의 명령어를 입력하면 정상적인 해쉬키가 나온다. 

keytool -exportcert -alias <alias >-keystore <.keystore> | openssl.exe sha1 -binary | Copenssl.exe base64
Enter keystore password:  <keystore password>

참고

 

https://stackoverflow.com/questions/12893995/how-to-check-certificate-name-and-alias-in-keystore-files

 

How to check certificate name and alias in keystore files?

I have a bunch of .keystore files and need to find one with specific CN and alias. Is there a way to do it with keytool, jarsigner or some other tool? I found a way to check if specific keystore wa...

stackoverflow.com

https://stackoverflow.com/questions/23945936/check-android-keystore-keypass-for-correctness

 

Check android keystore keypass for correctness

I'm automating some things that involve the android keytool and jarsigner. The tool takes a keystore, the password for the keystore, the alias name, and the password for the alias / key, and I'm tr...

stackoverflow.com

https://recordsoflife.tistory.com/697

 

keytool 소개

1. 개요 이 짧은 사용방법(예제)에서는 keytool 명령 을 소개합니다 . keytool 을 사용하여 새 인증서를 만들고 해당 인증서에 대한 정보를 확인하는 방법을 배웁니다 . 2. keytool 이란 무엇입니까 ? Java

recordsoflife.tistory.com