본문 바로가기
프로그래밍/React Native

[React Native] Keychain에 android.keystore 암호 저장하기 only for OS

by CaffeLatte 2022. 9. 24.

 

 

Publishing to Google Play Store · React Native

Android requires that all apps be digitally signed with a certificate before they can be installed. In order to distribute your Android application via Google Play store it needs to be signed with a release key that then needs to be used for all future upd

reactnative.dev

위의 문서에서 보면

Setting up Gradle variables에서 Note에

 

Avoiding plaintext passwords in gradle

Keychain Access can store passwords for gradle

pilloxa.gitlab.io

Keychain 관련 링크가 있고 문서를 참고하여 기술한다

 

 

Avoiding plaintext passwords in gradle 이라는 타이틀로 시작하며

Store Passwords in Keychain Access부분에서

1. Keychain 앱을 열고

 

2. 새로운 비밀번호를 입력하는 부분에서

+버튼이 안보인다;;

 

Mac에서 키체인에 암호 추가하기

Mac의 키체인 접근에서 키체인에 암호를 추가하여 암호를 입력하지 않고 보호된 서버나 다른 리소스에 접근할 수 있습니다.

support.apple.com

위의 사이트를 참고하여 파일 > 새로운 암호 항목을 선택을 알아냈다

키체인 접근에서 왼쪽 사이드바에 '기본 키체인'과 '시스템 키체인'이 있는데

'기본 키체인'에서 하면 다음 단락에서 나오는 명령어(security find-gene....)가 안된다

그래서 '시스템 키체인'의 '시스템'을 선택하고 '파일 > 새로운 암호 항목'을 선택하자

 

3. 키체인 항목 이름, 계정 이름 및 암호 정보를 입력하자

android_keystore나 원하는 이름으로 하면 된다

 

그 다음 Access passwords from terminal

security find-generic-password -s android_keystore -w

참고로 -s는 Match "service" string, -w는 Display only the password on stdout이라고 도움말에 나온다

 

 

만약 이렇게 나왔다면 '기본 키체인'에서 암호를 생성한 것일 수도 있다. 

 

사용자 계정과 암호를 물어보는 창이 뜨면 입력해주자

 

그 다음 Access passwords in build.gradle

여기서 build.gradle은 /app/build.gradle에 하면 될 듯하다

 

 

모든 설정이 완료되었다면 release build를 실행하자

실행시 Keychain을 묻는 창이 뜬다. (안뜨면 좋겠는데 매우 귀찮..)

 

정상적으로 설정이 되었다면

 

를 볼 수 있다

 

 

 

끝.

댓글