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

◆ GetDefaultProvider()

static string Internal.NativeCrypto.CapiHelper.GetDefaultProvider ( int dwType)
inlinestaticpackage

Definition at line 455 of file CapiHelper.cs.

456 {
457 int pcbProvName = 0;
458 if (!global::Interop.Advapi32.CryptGetDefaultProvider(dwType, IntPtr.Zero, global::Interop.Advapi32.GetDefaultProviderFlags.CRYPT_MACHINE_DEFAULT, null, ref pcbProvName))
459 {
460 throw GetErrorCode().ToCryptographicException();
461 }
462 StringBuilder stringBuilder = new StringBuilder(pcbProvName);
463 if (!global::Interop.Advapi32.CryptGetDefaultProvider(dwType, IntPtr.Zero, global::Interop.Advapi32.GetDefaultProviderFlags.CRYPT_MACHINE_DEFAULT, stringBuilder, ref pcbProvName))
464 {
465 throw GetErrorCode().ToCryptographicException();
466 }
467 string text = stringBuilder.ToString();
468 string text2 = null;
469 switch (dwType)
470 {
471 case 1:
472 text2 = UpgradeRSA(dwType, text);
473 break;
474 case 13:
475 text2 = UpgradeDSS(dwType, text);
476 break;
477 }
478 if (text2 == null)
479 {
480 return text;
481 }
482 return text2;
483 }
static string UpgradeDSS(int dwProvType, string wszProvider)
static string UpgradeRSA(int dwProvType, string wszProvider)
override string ToString()
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.NativeCrypto.CapiHelper.GetErrorCode(), System.text, System.Text.StringBuilder.ToString(), Internal.NativeCrypto.CapiHelper.UpgradeDSS(), Internal.NativeCrypto.CapiHelper.UpgradeRSA(), and System.IntPtr.Zero.

Referenced by Internal.NativeCrypto.CapiHelper.OpenCSP().