X509CollectionStoreParameters.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections;
  5. using System.Text;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  7. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store
  8. {
  9. /// <remarks>This class contains a collection for collection based <code>X509Store</code>s.</remarks>
  10. public class X509CollectionStoreParameters
  11. : IX509StoreParameters
  12. {
  13. private readonly IList collection;
  14. /// <summary>
  15. /// Constructor.
  16. /// <p>
  17. /// The collection is copied.
  18. /// </p>
  19. /// </summary>
  20. /// <param name="collection">The collection containing X.509 object types.</param>
  21. /// <exception cref="ArgumentNullException">If collection is null.</exception>
  22. public X509CollectionStoreParameters(
  23. ICollection collection)
  24. {
  25. if (collection == null)
  26. throw new ArgumentNullException("collection");
  27. this.collection = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(collection);
  28. }
  29. // TODO Do we need to be able to Clone() these, and should it really be shallow?
  30. // /**
  31. // * Returns a shallow clone. The returned contents are not copied, so adding
  32. // * or removing objects will effect this.
  33. // *
  34. // * @return a shallow clone.
  35. // */
  36. // public object Clone()
  37. // {
  38. // return new X509CollectionStoreParameters(collection);
  39. // }
  40. /// <summary>Returns a copy of the <code>ICollection</code>.</summary>
  41. public ICollection GetCollection()
  42. {
  43. return BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(collection);
  44. }
  45. /// <summary>Returns a formatted string describing the parameters.</summary>
  46. public override string ToString()
  47. {
  48. StringBuilder sb = new StringBuilder();
  49. sb.Append("X509CollectionStoreParameters: [\n");
  50. sb.Append(" collection: " + collection + "\n");
  51. sb.Append("]");
  52. return sb.ToString();
  53. }
  54. }
  55. }
  56. #pragma warning restore
  57. #endif