Program.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Masuit.Tools.Reflection;
  2. using Masuit.Tools.Security;
  3. using Microsoft.AspNetCore;
  4. using Microsoft.AspNetCore.Hosting;
  5. using System;
  6. using System.ComponentModel;
  7. namespace NetCoreTest
  8. {
  9. public class Program
  10. {
  11. public static void Main(string[] args)
  12. {
  13. var myClass = new MyClass()
  14. {
  15. MyProperty1 = 1
  16. };
  17. myClass.SetProperty(nameof(MyClass.MyProperty1), 1);
  18. Console.ReadKey();
  19. var rsaKey = RsaCrypt.GenerateRsaKeys(RsaKeyType.PKCS8, 2048);
  20. Console.WriteLine(rsaKey.PrivateKey);
  21. Console.WriteLine(rsaKey.PublicKey);
  22. var enc = "123456".RSAEncrypt();
  23. Console.WriteLine(enc);
  24. Console.Beep();
  25. var dec = enc.RSADecrypt();
  26. Console.WriteLine(dec);
  27. Console.ReadKey();
  28. //CreateWebHostBuilder(args).Build().Run();
  29. }
  30. public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  31. WebHost.CreateDefaultBuilder(args)
  32. .UseStartup<Startup>();
  33. }
  34. public class MyClass
  35. {
  36. [Description("test")]
  37. public string MyProperty { get; set; }
  38. public int? MyProperty1 { get; set; }
  39. }
  40. }