Coder Social home page Coder Social logo

Comments (10)

cyberrob-zz avatar cyberrob-zz commented on June 7, 2024

I got the same problem only when I running a apk with minifyEnabled is true:

Caused by: java.lang.SecurityException: new SecureRandom() backed by wrong Provider: class com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes$LinuxPRNGSecureRandomProvider
at com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes.d(Unknown Source)
at com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes.a(Unknown Source)
at com.tozny.crypto.android.AesCbcWithIntegrity.c(Unknown Source)
at com.tozny.crypto.android.AesCbcWithIntegrity.a(Unknown Source)
at com.tozny.crypto.android.AesCbcWithIntegrity.a(Unknown Source)

in the proguard config I add:

-keep class com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes$* { *; }

running on Genymotion Android Emulator 4.2.2

Is this related to tozny/java-aes-crypto#13 or this post ?

from secure-preferences.

cyberrob-zz avatar cyberrob-zz commented on June 7, 2024

I've tested all versions from Android 4.1.1, 4.2.2, 4.3 (Genymotion Emulator) They all crashed.

However if change the version of secure-preference from 1.0.3 to 1.0.2๏ผŒit all worked!

This might not completely solve the problem but it could help for now.

from secure-preferences.

scottyab avatar scottyab commented on June 7, 2024

Thanks Robert, I'll take a look today

On Tue, 13 Oct 2015 07:54 Robert Wang [email protected] wrote:

I've tested all versions from 4.1.1, 4.2.2, 4.3 (Genymotion Emulator) They
all crashed.

However I change the version of secure-preference from 1.0.3 to 1.0.2๏ผŒit
all worked!

This might not completely solve the problem but it could help for now.

โ€”
Reply to this email directly or view it on GitHub
#31 (comment)
.

from secure-preferences.

scottyab avatar scottyab commented on June 7, 2024

The PrngFixes class is doing several equals checks on class names i.e getProvider().getClass().getSimpleName().equals("LinuxPRNGSecureRandomProvider") but this was failing due to the obfuscation. Even when using -keep on the two inner classes of PrngFixes ( LinuxPRNGSecureRandomProvider and LinuxPRNGSecureRandom) still the equals wasn't satisfied.

I changed the equals check to use LinuxPRNGSecureRandomProvider.class.getSimpleName() rather than "LinuxPRNGSecureRandomProvider". This way it doesn't matter if proguard (or whatever) changes the class name.

Tested on devices and genymotion.

I'll add the fixed the java-aes-crypto lib (my fork) it'll be in version 'com.scottyab:aes-crypto:0.0.4' and I'll PR to the original.

from secure-preferences.

scottyab avatar scottyab commented on June 7, 2024

Fixed in v0.1.4 of Secure-preferences

from secure-preferences.

fernandospr avatar fernandospr commented on June 7, 2024

This is not fixed in v0.1.4. Please, reopen. I still see the exception:

Caused by java.lang.SecurityException: new SecureRandom() backed by wrong Provider: class org.apache.harmony.security.provider.crypto.CryptoProvider
       at com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes.installLinuxPRNGSecureRandom(AesCbcWithIntegrity.java:767)

GT-I8190L
Android 4.1.2

from secure-preferences.

ankitgoyal1009 avatar ankitgoyal1009 commented on June 7, 2024

I can still see the issue. Interesting thing is it is happening to my users but none of my test devices has this issue.

from secure-preferences.

0w60 avatar 0w60 commented on June 7, 2024

Still crashes on 4.1.1

Fatal Exception: java.lang.RuntimeException
Unable to create application: java.lang.SecurityException: SecureRandom.getInstance("SHA1PRNG") backed by wrong Provider: class org.apache.harmony.security.provider.crypto.CryptoProvider

from secure-preferences.

bmacedo avatar bmacedo commented on June 7, 2024

Is there any solution available for this? I get this crash as well on a Samsung 4.1.2 device.

from secure-preferences.

gilshallem avatar gilshallem commented on June 7, 2024

Still happening

Runining this code:
SecurePreferences.Editor prefs = new SecurePreferences(mContext).edit();

Gives this error:

Fatal Exception: java.lang.SecurityException: new SecureRandom() backed by wrong Provider: class org.apache.harmony.security.provider.crypto.CryptoProvider
at com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes.installLinuxPRNGSecureRandom(AesCbcWithIntegrity.java:764)
at com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes.apply(AesCbcWithIntegrity.java:680)
at com.tozny.crypto.android.AesCbcWithIntegrity.fixPrng(AesCbcWithIntegrity.java:347)
at com.tozny.crypto.android.AesCbcWithIntegrity.generateKeyFromPassword(AesCbcWithIntegrity.java:184)
at com.securepreferences.SecurePreferences.generateAesKeyName(SecurePreferences.java:228)
at com.securepreferences.SecurePreferences.(SecurePreferences.java:149)
at com.securepreferences.SecurePreferences.(SecurePreferences.java:134)
at com.securepreferences.SecurePreferences.(SecurePreferences.java:107)
at com.securepreferences.SecurePreferences.(SecurePreferences.java:82)

Device Info:
image

API:
com.scottyab:secure-preferences-lib:0.1.7

from secure-preferences.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.