MsmqEncryptionAlgorithm.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel
  5. {
  6. using System.ServiceModel.Channels;
  7. public enum MsmqEncryptionAlgorithm
  8. {
  9. RC4Stream,
  10. Aes
  11. }
  12. static class MsmqEncryptionAlgorithmHelper
  13. {
  14. public static bool IsDefined(MsmqEncryptionAlgorithm algorithm)
  15. {
  16. return algorithm == MsmqEncryptionAlgorithm.RC4Stream || algorithm == MsmqEncryptionAlgorithm.Aes;
  17. }
  18. public static int ToInt32(MsmqEncryptionAlgorithm algorithm)
  19. {
  20. switch (algorithm)
  21. {
  22. case MsmqEncryptionAlgorithm.RC4Stream:
  23. return UnsafeNativeMethods.CALG_RC4;
  24. case MsmqEncryptionAlgorithm.Aes:
  25. return UnsafeNativeMethods.CALG_AES;
  26. default:
  27. return -1;
  28. }
  29. }
  30. }
  31. }