using System;
using System.Collections;
using System.Text;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.X509.Store
{
/// This class contains a collection for collection based X509Stores.
public class X509CollectionStoreParameters
: IX509StoreParameters
{
private readonly IList collection;
///
/// Constructor.
///
/// The collection is copied.
///
///
/// The collection containing X.509 object types.
/// If collection is null.
public X509CollectionStoreParameters(
ICollection collection)
{
if (collection == null)
throw new ArgumentNullException("collection");
this.collection = Platform.CreateArrayList(collection);
}
// TODO Do we need to be able to Clone() these, and should it really be shallow?
// /**
// * Returns a shallow clone. The returned contents are not copied, so adding
// * or removing objects will effect this.
// *
// * @return a shallow clone.
// */
// public object Clone()
// {
// return new X509CollectionStoreParameters(collection);
// }
/// Returns a copy of the ICollection.
public ICollection GetCollection()
{
return Platform.CreateArrayList(collection);
}
/// Returns a formatted string describing the parameters.
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("X509CollectionStoreParameters: [\n");
sb.Append(" collection: " + collection + "\n");
sb.Append("]");
return sb.ToString();
}
}
}