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); }
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)); }
extern static IntPtr mono_btls_x509_lookup_new(IntPtr store, MonoBtlsX509LookupType type);
internal MonoBtlsX509Lookup(MonoBtlsX509Store store, MonoBtlsX509LookupType type) : base(Create_internal(store, type)) { this.store = store; this.type = type; }
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); }
extern static IntPtr mono_btls_x509_lookup_new (IntPtr store, MonoBtlsX509LookupType type);
internal MonoBtlsX509Lookup (MonoBtlsX509Store store, MonoBtlsX509LookupType type) : base (Create_internal (store, type)) { this.type = type; }
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; }