Arshia
Arshia

Reputation: 27

RSA with open SSL in lazarus

I have a question : How can I generate an 18-digits prime number with OpenSSL in Lazarus ? even I searched the web , I don`t know the command yet ,
thank you all

Upvotes: 0

Views: 632

Answers (1)

Maarten Bodewes
Maarten Bodewes

Reputation: 94018

So the simplest thing you can do is to look for primes yourself using random numbers generated by OpenSSL:

  1. generate pseudo-random integer r within the range 5e17 - 5e16 using the BN_rand_range function;
  2. add 5e16 to r giving you x
  3. calculate y by performing BN_add(BN_mul(2, x), 1);
  4. if BN_is_prime_ex(y) returns OK for BN_prime_checks then you found your prime, otherwise goto 1.

Upvotes: 1

Related Questions