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

Couldn't get SecureRandomInstance #13

Open
jdediegomrt opened this issue Nov 15, 2018 · 1 comment
Open

Couldn't get SecureRandomInstance #13

jdediegomrt opened this issue Nov 15, 2018 · 1 comment

Comments

@jdediegomrt
Copy link

Hi! On android library when I make a scramble I see this exception:

E/Puzzle: Couldn't get SecureRandomInstance java.security.NoSuchProviderException: SUN at java.security.SecureRandom.getInstance(SecureRandom.java:186) at net.gnehzr.tnoodle.scrambles.Puzzle.getSecureRandom(Puzzle.java:124) at net.gnehzr.tnoodle.scrambles.Puzzle.<init>(Puzzle.java:120) at puzzle.MegaminxPuzzle.<init>(MegaminxPuzzle.java:65) at java.lang.reflect.Constructor.newInstance(Native Method) at net.gnehzr.tnoodle.utils.LazyInstantiator.newInstance(LazyInstantiator.java:85) at net.gnehzr.tnoodle.utils.LazyInstantiator.cachedInstance(LazyInstantiator.java:104)

I see this when I call the cached instance of a LazyIntantiator:

LazyInstantiator<Puzzle> lazyPuzzle = Constants.getInstance().WCA_PUZZLES.get(shortName); try { puzzle = lazyPuzzle.cachedInstance(); } catch (LazyInstantiatorException e) { Log.wtf("ScrambleConfig", e); }

Could you help me please? I'm not sure why is this happening.

This seems not to affect the scramble but I'm a little worried of the impact in production.

Thank you!

@jfly
Copy link
Contributor

jfly commented Dec 30, 2018

It looks like the code first tries to do a SecureRandom.getInstance("SHA1PRNG", "SUN"), and then falls back to a getInstance("SHA1PRNG") if that fails. I think it makes sense that the SUN algorithm wouldn't exist on Android, which it sounds like is what you're using.

It looks like I added this fallback in thewca/tnoodle@9c94691, but didn't leave much of an explanation about what was going on there.

I think this is safe to ignore. It doesn't seem valuable to me to be logging at level SEVERE, though. If you want to send in a PR removing that log message, I'd be ok with that!

@gregorbg gregorbg transferred this issue from thewca/tnoodle Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants