반응형

이번 포스팅은  Android Build 오류에 대하여 알아보도록 하겠습니다.


< Error >


java.security.KeyStoreException: entries cannot be protected with passwords

     at android.security.keystore.AndroidKeyStoreSpi.engineSetKeyEntry(AndroidKeyStoreSpi.java:308)

     at java.security.KeyStore.setKeyEntry(KeyStore.java:1179)


< Solution > 


setKeyEntry method가 분명히 존재하고 passwords 매개 변수를 사용한다는 사실에도 불구하고 AndroidKeystore 구현은 이를 지원하지 않습니다.

어떤 경우든 장치의 어느 곳에 저장되어 있는 강력한 암호든 약한 암호는 안전하지 않습니다. 이는 특히 소스 코드(일반적으로 소스 코드, not-android Context 포함)에 해당됩니다. 당신의 앱 APK를 손에 넣으면, 몇 가지 훌륭한 APK 분석 도구 중 하나를 사용하여 Class의 constants pool에 액세스할 수 있는데, 이 pool은 일반 텍스트로 되어 있을 것입니다. 아무리 난독화해도 이것을 막을 수 없었고, 심지어 더 어렵게 만들 수도 없습니다. 이것이 아마도 AndroidKeystore 구현이 이것을 허용하지 않는 이유일 것입니다.

안드로이드 장치의 키 저장소 서비스의 전체 포인트(실제로 Unix socket을 통해 대화할 수 있는 별도의 프로세스로 구현됨)는 사용자가 암호를 입력하여 중요한 자료에 대한 액세스를 보호하는 것이므로 Key 쌍이나 다른 비밀 암호를 입력하는 것은 의미가 없습니다. 더 최근의 스마트폰에서는, 이 모든 것이 Hardware에 내장되어 있어, 매우 강력한 보안을 제공합니다.

Apparently despite the fact that the method takes a password parameter, the AndroidKeystoreimplementation does not support this, take a look at line 200 in the source.

In any case, a password, whether strong or weak that is stored anywhere on the device is unsafe. This is especially true of source code (including source code in general, non-android contexts). If I get my hands on your app's APK, I can use one of several excellent APK analysis tools to access the class's constant pool, which will contain the password in plain text. No amount of obfuscation could prevent this, or even make it more difficult. This is perhaps the reason that the AndroidKeystoreimplementation doesn't allow this.

The whole point of the key store service on android device (it's actually implemented as a separate process you can talk to via a unix socket) is to protect access to sensitive material by requiring a users passcode to unlock it, so there's no point in putting a password on your key pairs or other secrets.. In more recent phones, this is all implmented in hardware, which provides very strong security.

참조 링크 : https://stackoverflow.com/questions/27575059/android-entries-cannot-be-protected-with-passwords

반응형

+ Recent posts