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

◆ X500DistinguishedNameEncode()

byte[] Internal.Cryptography.Pal.X509Pal.X500DistinguishedNameEncode ( string distinguishedName,
X500DistinguishedNameFlags flag )
inline

Implements Internal.Cryptography.Pal.IX509Pal.

Definition at line 490 of file X509Pal.cs.

491 {
492 CertNameStrTypeAndFlags dwStrType = CertNameStrTypeAndFlags.CERT_X500_NAME_STR | MapNameToStrFlag(flag);
493 int pcbEncoded = 0;
494 if (!global::Interop.crypt32.CertStrToName(CertEncodingType.All, distinguishedName, dwStrType, IntPtr.Zero, null, ref pcbEncoded, IntPtr.Zero))
495 {
496 throw Marshal.GetLastWin32Error().ToCryptographicException();
497 }
498 byte[] array = new byte[pcbEncoded];
499 if (!global::Interop.crypt32.CertStrToName(CertEncodingType.All, distinguishedName, dwStrType, IntPtr.Zero, array, ref pcbEncoded, IntPtr.Zero))
500 {
501 throw Marshal.GetLastWin32Error().ToCryptographicException();
502 }
503 return array;
504 }
static CertNameStrTypeAndFlags MapNameToStrFlag(X500DistinguishedNameFlags flag)
Definition X509Pal.cs:531
static readonly IntPtr Zero
Definition IntPtr.cs:18

References System.array, System.Runtime.InteropServices.Marshal.GetLastWin32Error(), Internal.Cryptography.Pal.X509Pal.MapNameToStrFlag(), and System.IntPtr.Zero.