AsymmetricKeyEntry.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  7. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs
  8. {
  9. public class AsymmetricKeyEntry
  10. : Pkcs12Entry
  11. {
  12. private readonly AsymmetricKeyParameter key;
  13. public AsymmetricKeyEntry(
  14. AsymmetricKeyParameter key)
  15. : base(BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateHashtable())
  16. {
  17. this.key = key;
  18. }
  19. #if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
  20. [Obsolete]
  21. public AsymmetricKeyEntry(
  22. AsymmetricKeyParameter key,
  23. Hashtable attributes)
  24. : base(attributes)
  25. {
  26. this.key = key;
  27. }
  28. #endif
  29. public AsymmetricKeyEntry(
  30. AsymmetricKeyParameter key,
  31. IDictionary attributes)
  32. : base(attributes)
  33. {
  34. this.key = key;
  35. }
  36. public AsymmetricKeyParameter Key
  37. {
  38. get { return this.key; }
  39. }
  40. public override bool Equals(object obj)
  41. {
  42. AsymmetricKeyEntry other = obj as AsymmetricKeyEntry;
  43. if (other == null)
  44. return false;
  45. return key.Equals(other.key);
  46. }
  47. public override int GetHashCode()
  48. {
  49. return ~key.GetHashCode();
  50. }
  51. }
  52. }
  53. #pragma warning restore
  54. #endif