Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FindByApplicationPolicy()

unsafe void Internal.Cryptography.Pal.FindPal.FindByApplicationPolicy ( string oidValue)
inline

Implements Internal.Cryptography.Pal.IFindPal.

Definition at line 416 of file FindPal.cs.

417 {
418 FindCore(oidValue, delegate(string oidValue, SafeCertContextHandle pCertContext)
419 {
420 int pcbOIDs = 0;
421 if (!global::Interop.crypt32.CertGetValidUsages(1, ref pCertContext, out var cNumOIDs, null, ref pcbOIDs))
422 {
423 return false;
424 }
425 if (cNumOIDs == -1)
426 {
427 return true;
428 }
429 fixed (byte* ptr = new byte[pcbOIDs])
430 {
431 if (!global::Interop.crypt32.CertGetValidUsages(1, ref pCertContext, out cNumOIDs, ptr, ref pcbOIDs))
432 {
433 return false;
434 }
435 IntPtr* ptr2 = (IntPtr*)ptr;
436 for (int i = 0; i < cNumOIDs; i++)
437 {
438 string value = Marshal.PtrToStringAnsi(ptr2[i]);
439 if (oidValue.Equals(value, StringComparison.OrdinalIgnoreCase))
440 {
441 return true;
442 }
443 }
444 return false;
445 }
446 });
447 }
static unsafe? string PtrToStringAnsi(IntPtr ptr)
Definition Marshal.cs:630

References System.Runtime.InteropServices.Marshal.PtrToStringAnsi(), and System.value.