AsymmetricKeyEntry.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.Collections.Generic;
  4. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto;
  6. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Pkcs
  7. {
  8. public class AsymmetricKeyEntry
  9. : Pkcs12Entry
  10. {
  11. private readonly AsymmetricKeyParameter key;
  12. public AsymmetricKeyEntry(AsymmetricKeyParameter key)
  13. : base(new Dictionary<DerObjectIdentifier, Asn1Encodable>())
  14. {
  15. this.key = key;
  16. }
  17. public AsymmetricKeyEntry(AsymmetricKeyParameter key,
  18. IDictionary<DerObjectIdentifier, Asn1Encodable> attributes)
  19. : base(attributes)
  20. {
  21. this.key = key;
  22. }
  23. public AsymmetricKeyParameter Key
  24. {
  25. get { return this.key; }
  26. }
  27. public override bool Equals(object obj)
  28. {
  29. AsymmetricKeyEntry other = obj as AsymmetricKeyEntry;
  30. if (other == null)
  31. return false;
  32. return key.Equals(other.key);
  33. }
  34. public override int GetHashCode()
  35. {
  36. return ~key.GetHashCode();
  37. }
  38. }
  39. }
  40. #pragma warning restore
  41. #endif