martinwithaar / Encryptor4j

Strong encryption for Java simplified
MIT License
101 stars 26 forks source link

PBKDF2WithHmacSHA256 SecretKeyFactory not available #4

Closed dri94 closed 6 years ago

dri94 commented 7 years ago

I am getting this when i am running this on android with proguard. The full error is

Caused by: java.lang.RuntimeException: java.security.NoSuchAlgorithmException: PBKDF2WithHmacSHA256 SecretKeyFactory not available
    at org.encryptor4j.factory.AbsKeyFactory.keyFromPassword(AbsKeyFactory.java:94)
    at org.encryptor4j.util.TextEncryptor.<init>(TextEncryptor.java:49)
MichalStranik commented 7 years ago

I am getting this without proguard on Android API 19.

dri94 commented 7 years ago

It seems to have to do with the java version on different phones. It will work fine on the pixel, but cause an error on the S7.

thanhthang90 commented 6 years ago

Samsung A7100 android 6.0.1, LG f260s android 19 similar error as above. SecretKeyFactory PBKDF2WithHmacSHA256 implementation not found

martinwithaar commented 6 years ago

These types of errors are unfortunately beyond my control. Device manufacturers decide for themselves what kind of algorithms they support.

A solution would be to use https://github.com/rtyley/spongycastle as your security provider. This is a fully complete rename of Bouncy Castle specifically for use with Android. Vendors tend to strip down the Bouncy Castle implementations shipped with their phones.