internal static bool CertSetCertificateContextProperty([In] System.Security.Cryptography.SafeCertContextHandle pCertContext, [In] uint dwPropId, [In] uint dwFlags, [In] IntPtr pvData)
 {
     if (pvData == IntPtr.Zero)
     {
         throw new ArgumentNullException("pvData");
     }
     if (((dwPropId != 0x13) && (dwPropId != 11)) && ((dwPropId != 0x65) && (dwPropId != 2)))
     {
         throw new ArgumentException(SR.GetString("Security_InvalidValue"), "dwFlags");
     }
     if (((dwPropId == 0x13) || (dwPropId == 11)) || (dwPropId == 2))
     {
         new PermissionSet(PermissionState.Unrestricted).Demand();
     }
     return(CAPIUnsafe.CertSetCertificateContextProperty(pCertContext, dwPropId, dwFlags, pvData));
 }
 internal static bool CertSetCertificateContextProperty([In] System.Security.Cryptography.SafeCertContextHandle pCertContext, [In] uint dwPropId, [In] uint dwFlags, [In] SafeLocalAllocHandle safeLocalAllocHandle)
 {
     if (pCertContext == null)
     {
         throw new ArgumentNullException("pCertContext");
     }
     if (pCertContext.IsInvalid)
     {
         throw new CryptographicException(SR.GetString("Cryptography_InvalidHandle"), "pCertContext");
     }
     if (((dwPropId != 0x13) && (dwPropId != 11)) && ((dwPropId != 0x65) && (dwPropId != 2)))
     {
         throw new ArgumentException(SR.GetString("Security_InvalidValue"), "dwFlags");
     }
     if (((dwPropId == 0x13) || (dwPropId == 11)) || (dwPropId == 2))
     {
         new PermissionSet(PermissionState.Unrestricted).Demand();
     }
     return(CAPIUnsafe.CertSetCertificateContextProperty(pCertContext, dwPropId, dwFlags, safeLocalAllocHandle));
 }