Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] EncryptedSharedPreference 관련 오류사항 #424

Closed
1 task done
2chang5 opened this issue Sep 28, 2023 · 0 comments
Closed
1 task done

[fix] EncryptedSharedPreference 관련 오류사항 #424

2chang5 opened this issue Sep 28, 2023 · 0 comments

Comments

@2chang5
Copy link
Member

2chang5 commented Sep 28, 2023

화면 이름

로그인

기능 설명

  • EncryptedSharedPreference 사용시 앱 업데이트 문제가 우테코 슬랙에 공유되어 관련 처리를 선제적으로 진행

EncryptedSharedPreference 를 사용했을 때 오류가 발생해서 찾아본 결과 공유합니다.

오류 발생 과정

로그인 -> EncryptedSharedPreference 에 토큰 저장-> 앱 삭제 -> 재설치 ->  토큰 저장소 접근

Crashlytics 에서 원인 분석

Caused by android.security.KeyStoreException Signature/MAC verification failed

구글링 결과

https://github.com/google/tink/issues/535#issuecomment912170221 tink-crypto/tink#535 (comment)

공식 문서

https://developer.android.com/guide/topics/data/autobackup#IncludingFiles

문제 인식

sharedPreference 가 default 로 backup 되는데 EncryptedSharedPreference 를 다시 불러올 때 암호화 할 때 사용한 키가 유효하지 않음.

해결 방법 -> 셋중 하나만 적용해도됨

  1. allowBackup = “false” -> 문제는 데이터 백업 안됨 패스
  2. try catch 로 잡고 EncryptedSharedPreference 재설정
  3. EncryptedSharedPreference 가 Auto Backup 되지 않도록 제외 -> 결론적으로 3번적용함
  • 멧돼지의 추가내용

EncryptedSharedPreferences  |  Android Developers

스크린샷 2023-09-28 오후 6 30 27

베르가 열심히 찾아주었지만 난 알아듣기 힘들어서 마저 찾음

베르가 겪었던 문제점을 공식문서에서 논하고있음 → backup rules를 통해서 autobackup에서 제외하라함

backup rules 타고들어가면 베르가 링크 달아놓은 곳이 나온다.

결론

sharedpreference 에 현재 저장하는 내용들이 앱을 삭제했을때 굳이 백업되어야할 필요성을 못느끼고 오히려 백업되면 안되는 정보들만 가득하기에 모든 sharedpreference를 백업에서 제외시켰다.

필요 태스크

  • EncryptedSharedPreference 가 Auto Backup 되지 않도록 제외
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant