CertBag.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
  5. {
  6. public class CertBag
  7. : Asn1Encodable
  8. {
  9. // private readonly Asn1Sequence seq;
  10. private readonly DerObjectIdentifier certID;
  11. private readonly Asn1Object certValue;
  12. public CertBag(
  13. Asn1Sequence seq)
  14. {
  15. if (seq.Count != 2)
  16. throw new ArgumentException("Wrong number of elements in sequence", "seq");
  17. // this.seq = seq;
  18. this.certID = DerObjectIdentifier.GetInstance(seq[0]);
  19. this.certValue = DerTaggedObject.GetInstance(seq[1]).GetObject();
  20. }
  21. public CertBag(
  22. DerObjectIdentifier certID,
  23. Asn1Object certValue)
  24. {
  25. this.certID = certID;
  26. this.certValue = certValue;
  27. }
  28. public DerObjectIdentifier CertID
  29. {
  30. get { return certID; }
  31. }
  32. public Asn1Object CertValue
  33. {
  34. get { return certValue; }
  35. }
  36. public override Asn1Object ToAsn1Object()
  37. {
  38. return new DerSequence(certID, new DerTaggedObject(0, certValue));
  39. }
  40. }
  41. }
  42. #pragma warning restore
  43. #endif