2 // MemoryCertificateStore.cs: Handles an in-memory certificate store.
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
12 namespace Microsoft
.Web
.Services
.Security
.X509
{
14 internal class MemoryCertificateStore
: ICertificateStore
{
16 private string _storeName
;
17 private X509CertificateStore
.StoreOpenFlags _flags
;
18 private X509CertificateStore
.StoreLocation _location
;
19 private IntPtr _handle
;
20 private X509CertificateCollection _coll
;
22 public MemoryCertificateStore (X509CertificateStore
.StoreLocation location
, string storeName
, X509CertificateStore
.StoreOpenFlags flags
)
25 _storeName
= storeName
;
27 _coll
= new X509CertificateCollection ();
34 public IntPtr Handle
{
35 get { return (IntPtr) _coll.GetHashCode (); }
38 public X509CertificateCollection
GetCollection ()
40 if (_flags
== X509CertificateStore
.StoreOpenFlags
.ReadOnly
) {
41 // return a copy of the collection so changes aren't persisted
42 X509CertificateCollection copy
= new X509CertificateCollection ();
43 foreach (X509Certificate x
in _coll
) {