/// <summary> /// This method helps reduce the duplicate code in the GetProviderParameter method /// </summary> internal static int GetProviderParameterWorker(SafeProvHandle safeProvHandle, byte[] impType, ref int cb, CryptGetProvParam flags) { int impTypeReturn = 0; if (!Interop.CryptGetProvParam(safeProvHandle, (int)flags, impType, ref cb, 0)) { throw new CryptographicException(SR.Format(SR.CryptGetProvParam_Failed, Convert.ToString(GetErrorCode()))); } if (null != impType && cb == Constants.SIZE_OF_DWORD) { impTypeReturn = BitConverter.ToInt32(impType, 0); } return impTypeReturn; }
public static extern bool CryptSetProvParam(SafeProvHandle safeProvHandle, CryptGetProvParam dwParam, ref IntPtr pbData, int dwFlags);