internal void RemoveEncryption()
{
Debug.Assert(_encryptionOption == EncryptionOptions.LOGIN, "Invalid encryption option state");
#if MANAGED_SNI
uint error = SNIProxy.Singleton.DisableSsl(_physicalStateObj.Handle);
#else
UInt32 error = 0;
// Remove SSL (Encryption) SNI provider since we only wanted to encrypt login.
error = SNINativeMethodWrapper.SNIRemoveProvider(_physicalStateObj.Handle, SNINativeMethodWrapper.ProviderEnum.SSL_PROV);
#endif // MANAGED_SNI
if (error != TdsEnums.SNI_SUCCESS)
{
_physicalStateObj.AddError(ProcessSNIError(_physicalStateObj));
ThrowExceptionAndWarning(_physicalStateObj);
}
// create a new packet encryption changes the internal packet size
try { } // EmptyTry/Finally to avoid FXCop violation
finally
{
_physicalStateObj.ClearAllWritePackets();
}
}