0

I'm trying to implement a Cramer Shoup cryptography system in C but I've run into problems with generating the keys.

From what I have found on the wiki and in other papers, to generate keys for Cramer Shoup you must generate a cyclic group G of order q with generators g1 and g2, then take 5 values between 0 and (q-1) and with that you can easily generate the keys.

I initially tried doing this manually, but I ran into issues that prevented me from going forward. I was told that some OpenSSL library should have a way to do this itself. After some digging I found that I could generate what I thought was a key using the command "openssl dhparam", but after toying with it it doesn't seem that it generates keys like I thought.

I am asking if you are aware of any code (Or commands) that could be used to help generate the keys of a cramer shoup cryptosystem. If you know of any code/commands/libraries that could help with this I greatly appreatiate it.

fgrieu
  • 149,326
  • 13
  • 324
  • 622
KoiNip
  • 21
  • 2

1 Answers1

1

I'm not familiar with the Cramer-Shoup cryptosystem, but it looks like you can obtain what's wanted by generating DSA parameters $P$, $Q$, $G$, yielding a Schnorr group of prime order $Q$ and generator $G$ under multiplication modulo $P$ ; then creating another generator as $G':=G^X\bmod P$ for a uniformly random (undisclosed) $X$ in $[2,Q-1]$.

With OpenSSL on the command line, the generation of $P$, $Q$, $G$ (with 3072-bit $P$ and 256-bit $Q$, which is believed safe for a decade at least, baring theoretical breakthrough or CRQC) goes:

openssl dsaparam -text 3072

For details on the math that's designed to apply, refer to FIPSĀ 186-4 appendix B.1.

fgrieu
  • 149,326
  • 13
  • 324
  • 622