Questions tagged [secure-random]

SecureRandom is a Java class that provides a cryptographically strong random number generator (RNG).

SecureRandom is a Java class that provides a cryptographically strong random number generator (RNG).

A cryptographically strong random number minimally complies with the statistical random number generator tests specified in FIPS 140-2, Security Requirements for Cryptographic Modules, section 4.9.1. Additionally, SecureRandom must produce non-deterministic output. Therefore any seed material passed to a SecureRandom object must be unpredictable, and all SecureRandom output sequences must be cryptographically strong, as described in RFC 1750: Randomness Recommendations for Security.

http://docs.oracle.com/javase/7/docs/api/java/security/SecureRandom.html

84 questions
0
votes
2 answers

How to get entropy from JVM?

Let's say I need good seed to initialize pseudo random generator (PRNG) in Java program and I don't have access to any hardware random generator. How to get entropy from JVM without any user interaction?
Michal Zmuda
  • 5,381
  • 3
  • 43
  • 39
0
votes
1 answer

(AES Encryption) Code flaws, what should I be carefull with? [Code Provided][Java]

Thank you for taking you time to assist me with this! THIS POST HAS BEEN EDITED FOR LESS INFORMATION SEE THE EDITED PART Well I have spend ours of research on this matter and I ended up with a working piece of code.. But Encryption is not a place to…
0
votes
2 answers

How to exit while loop for JOptionPane when user clicks no?

I am trying to write a while loop (Not a do...while) that exits once the user clicks "No" on the showConfirmDialog window. However, when I run the program, it keeps iterating through the loop even if I click No or try to exit out. I suspect this is…
Jason_Silva
  • 127
  • 3
  • 13
0
votes
1 answer

Why would you use declare an object reference variable static final?

I am reading the Java How to Program 10th edition and going through the first few chapters. For this example, we are show how to make sure of the SecureRandom class but there is a part which totally puzzles me. // Fig. 6.8: Craps.java // Craps class…
Scorpiorian83
  • 469
  • 1
  • 4
  • 17
0
votes
1 answer

How to decide which is the most secure way to generate random numbers in java using SecureRandom class

I am wondering which is the best way to generate highly secured random number in range 0-255 and moreover with fast speed performance. It comes to me that for sure i have to use SecureRandom class but i am not sure if i have to use…
ENIO MARKU
  • 97
  • 1
  • 1
  • 8
0
votes
3 answers

Why the encryption of Java Cipher with the same string, key and SecureRandom always differ?

Thanks the comments from everyone. However, I have to explain this question. I know that we shouldn't compare the result of encryption by using a fix random generator due to it may reduce the secure. However, I just want to do it in testing and…
Xanadu Wang
  • 161
  • 1
  • 7
-1
votes
3 answers

Writing program to help elementary students learn multiplication

Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers (you will need to look up how to do this). The program should then prompt the user with a…
Homsey
  • 1
  • 2
-1
votes
1 answer

How to use SecureRandom output in a byte array properly?

I am trying generate a random key with SecureRandom, but I am facing issues when putting the output in a byte array. It doesn't recognize the output of the SecureRandom. public static String byteToHex(byte[] hash) { StringBuilder sb = new…
Bab
  • 433
  • 5
  • 12
-1
votes
2 answers

Magic 8ball Using securerandom with switch statements and while loops

I have my following code working like this: import java.util.Scanner; import java.lang.Math; public class Magiceightball { private static void Number() { int magic = (int) Math.ceil(Math.random() * 10); String x; switch (magic) { …
1 2 3 4 5
6