generation of safe primes

I need to generate a safe prime which has the form 2p + 1 where p is also prime of a certain bit length (lets say 1024 bits). It is to be used in a DH key exchange.

I believe openssl can do this via

openssl gendh 1024

however this return's a base64 pem format

-----BEGIN DH PARAMETERS-----
MIGHAoGBANzQ1j1z7RGB8XUagrGWK5a8AABecNrovcIgalv1hQdkna2PZorHtbOa
wYe1eDy1t/EztsM2Cncwvj5LBO3Zqsd5tneehKf8JoT35/q1ZznfLD8s/quBgrH8
es2xjSD/9syOMMiSv7/72GPJ8hzhLrbTgNlZ+kYBAPw/GcTlYjc7AgEC
-----END DH PARAMETERS-----
  • How can I extract the safe prime number from this base64 pem?

  • is it easier to generate my own safe prime with my own code?

how can i test that a prime is 'safe' and of a certain bit length.

6
задан Rudi 12 August 2013 в 08:05
поделиться