Ejemplo n.º 1
0
        public MonoBtlsX509Lookup AddLookup(MonoBtlsX509LookupType type)
        {
            if (lookupHash == null)
            {
                lookupHash = new Dictionary <IntPtr, MonoBtlsX509Lookup> ();
            }

            /*
             * X509_STORE_add_lookup() returns the same 'X509_LOOKUP *' for each
             * unique 'X509_LOOKUP_METHOD *' (which is supposed to be a static struct)
             * and we want to use the same managed object for each unique 'X509_LOOKUP *'.
             */
            var lookup       = new MonoBtlsX509Lookup(this, type);
            var nativeLookup = lookup.GetNativeLookup();

            if (lookupHash.ContainsKey(nativeLookup))
            {
                lookup.Dispose();
                lookup = lookupHash [nativeLookup];
            }
            else
            {
                lookupHash.Add(nativeLookup, lookup);
            }

            return(lookup);
        }
Ejemplo n.º 2
0
        static BoringX509LookupHandle Create_internal(MonoBtlsX509Store store, MonoBtlsX509LookupType type)
        {
            var handle = mono_btls_x509_lookup_new(
                store.Handle.DangerousGetHandle(), type);

            if (handle == IntPtr.Zero)
            {
                throw new MonoBtlsException();
            }
            return(new BoringX509LookupHandle(handle));
        }
Ejemplo n.º 3
0
 extern static IntPtr mono_btls_x509_lookup_new(IntPtr store, MonoBtlsX509LookupType type);
Ejemplo n.º 4
0
 internal MonoBtlsX509Lookup(MonoBtlsX509Store store, MonoBtlsX509LookupType type)
     : base(Create_internal(store, type))
 {
     this.store = store;
     this.type  = type;
 }
Ejemplo n.º 5
0
		static BoringX509LookupHandle Create_internal (MonoBtlsX509Store store, MonoBtlsX509LookupType type)
		{
			var handle = mono_btls_x509_lookup_new (
				store.Handle.DangerousGetHandle (), type);
			if (handle == IntPtr.Zero)
				throw new MonoBtlsException ();
			return new BoringX509LookupHandle (handle);
		}
Ejemplo n.º 6
0
		extern static IntPtr mono_btls_x509_lookup_new (IntPtr store, MonoBtlsX509LookupType type);
Ejemplo n.º 7
0
		internal MonoBtlsX509Lookup (MonoBtlsX509Store store, MonoBtlsX509LookupType type)
			: base (Create_internal (store, type))
		{
			this.type = type;
		}
Ejemplo n.º 8
0
		public MonoBtlsX509Lookup AddLookup (MonoBtlsX509LookupType type)
		{
			if (lookupHash == null)
				lookupHash = new Dictionary<IntPtr,MonoBtlsX509Lookup> ();

			/*
			 * X509_STORE_add_lookup() returns the same 'X509_LOOKUP *' for each
			 * unique 'X509_LOOKUP_METHOD *' (which is supposed to be a static struct)
			 * and we want to use the same managed object for each unique 'X509_LOOKUP *'.
			*/
			var lookup = new MonoBtlsX509Lookup (this, type);
			var nativeLookup = lookup.GetNativeLookup ();
			if (lookupHash.ContainsKey (nativeLookup)) {
				lookup.Dispose ();
				lookup = lookupHash [nativeLookup];
			} else {
				lookupHash.Add (nativeLookup, lookup);
			}

			return lookup;
		}