Browse Source

Print also e, N in metadata.

This is for the cluster to spit out also various Ns, on which maybe we can do the gcd().
Michele Orrù 11 years ago
parent
commit
3e7ecd1c37
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/questions/metadata.c

+ 12 - 0
src/questions/metadata.c

@@ -23,6 +23,8 @@
 #define PKEY    "public key"
 #define NBITLEN "N bits"
 #define EBITLEN "e bits"
+#define MODULUS "modulus"
+#define E       "pub exp"
 
 static BIO* out;
 
@@ -88,12 +90,22 @@ metadata_question_ask_crt(X509* crt)
 
 RSA *metadata_question_ask_rsa(const RSA* rsa)
 {
+  char *s;
+
   BIO_printf(out, "%-10s: %d\n", NBITLEN,
              BN_num_bits(rsa->n));
 
   BIO_printf(out, "%-10s: %d\n", EBITLEN,
              BN_num_bits(rsa->e));
 
+  s = BN_bn2hex(rsa->e);
+  BIO_printf(out, "%-10s: %s\n", E, s);
+  OPENSSL_free(s);
+
+  s = BN_bn2hex(rsa->n);
+  BIO_printf(out, "%-10s: %s\n", MODULUS, s);
+  OPENSSL_free(s);
+
   return NULL;
 }