You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

  1. //-----------------------------------------------------------------------
  2. // <copyright file="EncryptionFactory.cs" company="Origtek">
  3. // EncryptionFactory belongs to Copyright (c) Origtek. All rights reserved.
  4. // </copyright>
  5. //-----------------------------------------------------------------------
  6. namespace OT.COM.Encryption
  7. {
  8. using OT.COM.LogisticsUtil;
  9. using System;
  10. /// <summary>
  11. /// Encryption Factory
  12. /// </summary>
  13. public partial class EncryptionFactory
  14. {
  15. /// <summary>
  16. /// For choose encryption type
  17. /// </summary>
  18. public enum EncryptionType
  19. {
  20. /// <summary>
  21. /// AES algorithm
  22. /// </summary>
  23. ET_AES = 0,
  24. /// <summary>
  25. /// DES algorithm
  26. /// </summary>
  27. ET_DES = 1,
  28. /// <summary>
  29. /// Triple DES algorithm
  30. /// </summary>
  31. ET_TripleDES = 2
  32. }
  33. /// <summary>
  34. /// Factory entry
  35. /// </summary>
  36. /// <param name="i_et">
  37. /// Encryption type
  38. /// </param>
  39. /// <returns>
  40. /// Created AEncryption object
  41. /// </returns>
  42. public AEncryption GetInstance(EncryptionType i_et)
  43. {
  44. string sName = Enum.GetName(typeof(EncryptionType), i_et);
  45. object oRes = null;
  46. ClassHelper.GetInstByClassName(sName.Substring(3), out oRes);
  47. return (oRes == null) ? null : oRes as AEncryption;
  48. }
  49. }
  50. }