https://github.com/simon-greatrix/sec-prng
Secure random number generation
https://github.com/simon-greatrix/sec-prng
cryptography java prng security
Last synced: 5 months ago
JSON representation
Secure random number generation
- Host: GitHub
- URL: https://github.com/simon-greatrix/sec-prng
- Owner: simon-greatrix
- License: mit
- Created: 2015-03-30T20:44:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-04-10T12:24:54.000Z (about 1 year ago)
- Last Synced: 2025-07-14T04:32:49.018Z (11 months ago)
- Topics: cryptography, java, prng, security
- Language: Java
- Size: 1.19 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sec-prng : Secure pseudo-random number generation
## TL;DR
JavaDoc for this project can be found [here](http://simon-greatrix.github.io/sec-prng/apidocs/).
## What is this?
Good cryptography needs securely generated random numbers. Java does not provide a random number generator that meets the needs of modern strong cryptography. This library fixes that.
## How do I use it?
Read the installation instructions. Use it.
## Installation Instructions
To use this library in an application, you should do one of the following:
### As a normal security Provider
```java
SecureRandom rand = new SecureRandom("Nist-SHA256",new prng.SecureRandomProvider());
```
### As a default security Provider
```java
prng.SecureRandomProvider.install(true);
```
Installs the secure random provider as the default secure random provider, so calls to new SecureRandom() will use on of its algorithms.
### As an application override
```
java -javaagent:prng-1.0.0.jar ...rest of command line
```
Install the secure random provider and the default secure random number generator implementation prior to invoking the application's main method.
### As a platform extension
The provider may be made a standard provider for all applications using a given Java Runtime Environment.
1. Copy `prng-1.0.0.jar` to `[java home]/jre/lib/ext`
2. Open the file `[java home]/jre/lib/security/java.security` in a text editor.
3. Add a line such as:
`security.provider.1=prng.SecureRandomProvider`
4. Adjust all the other `security.provider.N` entries so each one has a unique name with the order you desire
5. Save the file