PolicyMappings.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.Collections;
  4. namespace BestHTTP.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. #if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
  32. public PolicyMappings(
  33. Hashtable mappings)
  34. : this((IDictionary)mappings)
  35. {
  36. }
  37. #endif
  38. /**
  39. * Creates a new <code>PolicyMappings</code> instance.
  40. *
  41. * @param mappings a <code>HashMap</code> value that maps
  42. * <code>string</code> oids
  43. * to other <code>string</code> oids.
  44. */
  45. public PolicyMappings(
  46. IDictionary mappings)
  47. {
  48. Asn1EncodableVector v = new Asn1EncodableVector();
  49. foreach (string idp in mappings.Keys)
  50. {
  51. string sdp = (string) mappings[idp];
  52. v.Add(
  53. new DerSequence(
  54. new DerObjectIdentifier(idp),
  55. new DerObjectIdentifier(sdp)));
  56. }
  57. seq = new DerSequence(v);
  58. }
  59. public override Asn1Object ToAsn1Object()
  60. {
  61. return seq;
  62. }
  63. }
  64. }
  65. #pragma warning restore
  66. #endif