PocGenerateKeyAndCer.cs 482 B

12345678910111213141516171819
  1. 
  2. using PCC2.Security;
  3. namespace PCC2.Pocs;
  4. internal static class PocGenerateKeyAndCer
  5. {
  6. public static void RunPoc()
  7. {
  8. var k = RsaUtility.GenerateKey(1024);
  9. var rsa = RsaUtility.FromKey(k);
  10. var cer = RsaUtility.GenerateShortLivedCertificate(rsa);
  11. var rsaPub = Convert.ToHexString(rsa.ExportRSAPublicKey());
  12. var strPub = cer.GetPublicKeyString();
  13. var tp = cer.Thumbprint;
  14. var isMatched = rsaPub == strPub;
  15. }
  16. }