PolicyMappings.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.Collections.Generic;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
  5. {
  6. /**
  7. * PolicyMappings V3 extension, described in RFC3280.
  8. * <pre>
  9. * PolicyMappings ::= Sequence SIZE (1..MAX) OF Sequence {
  10. * issuerDomainPolicy CertPolicyId,
  11. * subjectDomainPolicy CertPolicyId }
  12. * </pre>
  13. *
  14. * @see <a href="http://www.faqs.org/rfc/rfc3280.txt">RFC 3280, section 4.2.1.6</a>
  15. */
  16. public class PolicyMappings
  17. : Asn1Encodable
  18. {
  19. private readonly Asn1Sequence seq;
  20. /**
  21. * Creates a new <code>PolicyMappings</code> instance.
  22. *
  23. * @param seq an <code>Asn1Sequence</code> constructed as specified
  24. * in RFC 3280
  25. */
  26. public PolicyMappings(
  27. Asn1Sequence seq)
  28. {
  29. this.seq = seq;
  30. }
  31. /**
  32. * Creates a new <code>PolicyMappings</code> instance.
  33. *
  34. * @param mappings a <code>HashMap</code> value that maps
  35. * <code>string</code> oids
  36. * to other <code>string</code> oids.
  37. */
  38. public PolicyMappings(IDictionary<string, string> mappings)
  39. {
  40. Asn1EncodableVector v = new Asn1EncodableVector();
  41. foreach (var entry in mappings)
  42. {
  43. string idp = entry.Key;
  44. string sdp = entry.Value;
  45. v.Add(
  46. new DerSequence(
  47. new DerObjectIdentifier(idp),
  48. new DerObjectIdentifier(sdp)));
  49. }
  50. seq = new DerSequence(v);
  51. }
  52. public override Asn1Object ToAsn1Object()
  53. {
  54. return seq;
  55. }
  56. }
  57. }
  58. #pragma warning restore
  59. #endif