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

◆ PropagateKeyAlgorithmParametersFromChain()

unsafe byte[] Internal.Cryptography.Pal.CertificatePal.PropagateKeyAlgorithmParametersFromChain ( )
inlineprivate

Definition at line 283 of file CertificatePal.cs.

284 {
286 try
287 {
288 int pcbData = 0;
289 if (!global::Interop.crypt32.CertGetCertificateContextProperty(_certContext, CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, null, ref pcbData))
290 {
292 pChainPara.cbSize = sizeof(CERT_CHAIN_PARA);
293 if (!global::Interop.crypt32.CertGetCertificateChain((IntPtr)0, _certContext, null, SafePointerHandle<SafeCertStoreHandle>.InvalidHandle, ref pChainPara, CertChainFlags.None, IntPtr.Zero, out ppChainContext))
294 {
295 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
296 }
297 if (!global::Interop.crypt32.CertGetCertificateContextProperty(_certContext, CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, null, ref pcbData))
298 {
299 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
300 }
301 }
302 byte[] array = new byte[pcbData];
303 if (!global::Interop.crypt32.CertGetCertificateContextProperty(_certContext, CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, array, ref pcbData))
304 {
305 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
306 }
307 return array;
308 }
309 finally
310 {
311 ppChainContext?.Dispose();
312 }
313 }
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.Cryptography.Pal.CertificatePal._certContext, System.array, System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error(), and System.IntPtr.Zero.