0
$\begingroup$

I have a certified random number generator (TRNG, it does not matter what it is for the question).

I would like to use it as a source to generate secp384r1 ECDSA keys. What is the algorithm I should use? Is it possible?

I know that it is generally not a good idea to implement one's own cryptographic algorithms, so is there any library that can be used for this? (something like Bouncy Castle?)

$\endgroup$
1
  • 1
    $\begingroup$ This probably depends on how the TRNG interfaces with the host computer. Depending on the details a crypto library may technically be able to use it as an (additional) randomness source. $\endgroup$
    – SEJPM
    Commented Feb 6, 2018 at 21:18

2 Answers 2

1
$\begingroup$

Many libraries allow you to specify your own random number generator. In BouncyCastle, for example, you can specify a SecureRandom in the initialize method of the KeyPairGenerator class; while in Go you can specify a io.Reader to the GenerateKey function.

Therefore, you would need to write a class that implements SecureRandom or io.Reader and reads the specified number of bytes from your TRNG, assuming your TRNG actually produces uniformly distributed random output. Be careful though, if you mess it up, the whole security of your system is compromised.

(A safer approach would be to make a program that reads from the TRNG and writes to /dev/random, mixing up the system PRNG, assuming it's Linux)

$\endgroup$
1
  • $\begingroup$ Thank you. SecureRandom implementation with appropriate provider that can handle my TRNG is working. $\endgroup$ Commented Feb 7, 2018 at 16:40
0
$\begingroup$

Sure thing, you can use any NIST SP-800-90A compatible provider. There are a few available from Bouncy Castle in SP800SecureRandomBuilder. Depending on how you plan to retrieve the entropy from your TRNG, it may be required to implement an EntropySource and EntropySourceProvider, of course.

There are quite a few providers available in the Java runtime, but it may be tricky to get the details of those. SHA1PRNG has been present for a long time, but the algorithm is unknown and there are even different implementations of it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.