EncryptionScheme.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
  7. {
  8. public class EncryptionScheme
  9. : AlgorithmIdentifier
  10. {
  11. public EncryptionScheme(
  12. DerObjectIdentifier objectID)
  13. : base(objectID)
  14. {
  15. }
  16. public EncryptionScheme(
  17. DerObjectIdentifier objectID,
  18. Asn1Encodable parameters)
  19. : base(objectID, parameters)
  20. {
  21. }
  22. internal EncryptionScheme(
  23. Asn1Sequence seq)
  24. : this((DerObjectIdentifier)seq[0], seq[1])
  25. {
  26. }
  27. public new static EncryptionScheme GetInstance(object obj)
  28. {
  29. if (obj is EncryptionScheme)
  30. {
  31. return (EncryptionScheme)obj;
  32. }
  33. if (obj is Asn1Sequence)
  34. {
  35. return new EncryptionScheme((Asn1Sequence)obj);
  36. }
  37. throw new ArgumentException("Unknown object in factory: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
  38. }
  39. public Asn1Object Asn1Object
  40. {
  41. get { return Parameters.ToAsn1Object(); }
  42. }
  43. public override Asn1Object ToAsn1Object()
  44. {
  45. return new DerSequence(Algorithm, Parameters);
  46. }
  47. }
  48. }
  49. #pragma warning restore
  50. #endif