PollReqContent.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cmp
  6. {
  7. public class PollReqContent
  8. : Asn1Encodable
  9. {
  10. private readonly Asn1Sequence content;
  11. private PollReqContent(Asn1Sequence seq)
  12. {
  13. content = seq;
  14. }
  15. public static PollReqContent GetInstance(object obj)
  16. {
  17. if (obj is PollReqContent)
  18. return (PollReqContent)obj;
  19. if (obj is Asn1Sequence)
  20. return new PollReqContent((Asn1Sequence)obj);
  21. throw new ArgumentException("Invalid object: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
  22. }
  23. public virtual DerInteger[][] GetCertReqIDs()
  24. {
  25. DerInteger[][] result = new DerInteger[content.Count][];
  26. for (int i = 0; i != result.Length; ++i)
  27. {
  28. result[i] = SequenceToDerIntegerArray((Asn1Sequence)content[i]);
  29. }
  30. return result;
  31. }
  32. private static DerInteger[] SequenceToDerIntegerArray(Asn1Sequence seq)
  33. {
  34. DerInteger[] result = new DerInteger[seq.Count];
  35. for (int i = 0; i != result.Length; ++i)
  36. {
  37. result[i] = DerInteger.GetInstance(seq[i]);
  38. }
  39. return result;
  40. }
  41. /**
  42. * <pre>
  43. * PollReqContent ::= SEQUENCE OF SEQUENCE {
  44. * certReqId INTEGER
  45. * }
  46. * </pre>
  47. * @return a basic ASN.1 object representation.
  48. */
  49. public override Asn1Object ToAsn1Object()
  50. {
  51. return content;
  52. }
  53. }
  54. }
  55. #pragma warning restore
  56. #endif