public static void SetProviderParameter(SafeProvHandleImpl providerHandle, int keyNumber, uint keyParamId, IntPtr keyParamValue) { if ((keyParamId == Constants.PP_KEYEXCHANGE_PIN) || (keyParamId == Constants.PP_SIGNATURE_PIN)) { if (keyNumber == Constants.AT_KEYEXCHANGE) { keyParamId = Constants.PP_KEYEXCHANGE_PIN; } else if (keyNumber == Constants.AT_SIGNATURE) { keyParamId = Constants.PP_SIGNATURE_PIN; } else { throw ExceptionUtility.NotSupported(Resources.KeyAlgorithmNotSupported); } } if (!CryptoApi.CryptSetProvParam(providerHandle, keyParamId, keyParamValue, 0)) { throw CreateWin32Error(); } }