-2

I generated a a public and a private using RSACng Classes. I used the method ToXMLString and exported to a file, then I realize there are different parameters on the file: Modulus, P, Q, DP, DQ, InverseQ and D. I know they are part of the algorithm to generate the keys. I set them as variables, but when I tried encrypt/decrypt it didn't work.

Is there a way to do that? Also, is there a way to generate only a pair? Public and Private only? Not this all parameters. We want to store the private key in a console app and call the public key to decrypt it. (Not sure if it works like that).

The output is like this below:

-- Modulus>pwerttqttervtertertert3tQ== -- Exponent>AQAB P>y87RSU6J1tcA2m3diF1rU3Ksfsdfsdf8ngS8nPL1o8ee/dWa+F/DzykgO0EGE/oBX4tVLcwM4PpFJMp8P25x0ykB9xc1VpYEsKHQTjrtapBinnYw03Gv6v1fJgYS8DM4iwtsRSRygnn21jufqaohW0uGoxZIxnXn208= -- Q>0clH/24rq34rfq3434tq43tq43t54wzws= -- DP>m0OAzw8FFdfgfsghsfjdkdui67e7543r4sg68/GxAaSM= -- DQ>frJtRfghfghfghgfhfghfghfghfghgfhgfQxLhk= -- InverseQ>ACABfghgfhfghgfhgfhfghfgvg40= -- D>Q4knEmltV8EzZJkqtXJVtTM3++DDlus9iuYzZ9r2HWGj0dKF2/rajqZ0fkJR0qsM8Yieat0eo/cvrd1/m6VUU5FMBDqijDUkSAXbKSnEUwo2 -- /RSAKeyValue> -- And I'm looking for something like that:

Public key: 0F29ebKRh5jkhdfz1PNCw/ARfvBjMd+Yt/D/AhWZ4Rovf3II

Private key: 0F29ebKRh5jkhdfz1PNCw/ARfvBjMd+Yt/D/AhWZ4Rovf3II

Not even know if is that possible. Nothing I looked on internet, helped me.

I've been searching for the past 2 days. We have to do this using C# classes, preferably official MS classes.

Thanks.

Donzera
  • 1
  • 2
  • The post formatting seems to be a bit broken. Could you take another look and wrap the output in code fences (\`\`\`)? – janw Jun 01 '22 at 09:36

1 Answers1

-1

I hope this or this helps you for your research.

However, in general, it is advisable not to develop security-critical encryption algorithms independently. The use of the encryption facilities provided e.g. by Mircosoft should be used.

The reason for this lies in security vulnerabilities that your self-developed encryption provides.

Dominik
  • 156
  • 12