Blog - Title

August, 2010

Brijs Blogging... Looking Beyond the Obvious

  • Brijs Blogging... Looking Beyond the Obvious

    Issue: Getting 'This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.' exception while building Outlook VSTO add-in in VS 2010

    • 13 Comments

    In case you have FIPS compliance enabled and you are building VSTO/Windows applications using Visual Studio 2010 then you will get exception as mentioned below:

    Error 1 Source file 'c:\users\brijs\documents\visual studio 2010\Projects\OutlookAddInFIPS\OutlookAddInFPIS\ThisAddIn.cs' could not be opened ('This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.') OutlookAddInFIPS

    Error 1 Source file 'c:\users\brijs\documents\visual studio 2010\Projects\WindowsFormsApplicationFIPS\WindowsFormsApplicationFIPS\Form1.cs' could not be opened ('This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.') WindowsFormsApplicationFIPS

    To know more about FIPS refer The effects of enabling the "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" security setting in Windows XP and in later versions of Windows

    In order to enable FIPS you need to follow steps mentioned below

    • This security setting affects the following registry value in Windows Server 2008 and in Windows Vista: HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled
      This registry value reflects the current FIPS setting. If this setting is enabled, the value is 1. If this setting is disabled, the value is 0.
    • This security setting affects the following registry value in Windows Server 2003 and in Windows XP: HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy
      This registry value reflects the current FIPS setting. If this setting is enabled, the value is 1. If this setting is disabled, the value is 0.

    After you enable or disable the System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing security setting, you must restart your application, such as Internet Explorer, for the new setting to take effect.

    To workaround the above issue you can either opt out of FIPS compliance by changing the registry as mentioned above.

    Or In order to just avoid the issue with Visual Studio 2010 one can follow the steps mentioned below:

    • Open Devenv.exe.config from
      C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE if you are on x64 OS
      or C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ on x86 OS
    • Find </runtime> tag and add the following above that line:
      <enforceFIPSPolicy enabled="false"/>
    • After the above modification devenv config would look like:
      <configuration>
      <runtime>
      .
      .
      .
      <enforceFIPSPolicy enabled="false"/>
      </runtime>
      </configuration>
    • Restart Visual Studio

    enforceFIPSPolicy is a .Net 2.0 SP1 config file switch which helps the application to opt out FIPS checking.

    Hope this helps!!!

  • Brijs Blogging... Looking Beyond the Obvious

    How to enable EWS Tracing using Exchange Web Services (EWS) Managed API in VB.net?

    • 1 Comments

    Debugging a Web service–based application can be difficult because part of the processing is performed on a computer to which you do not have access. Because you cannot step through the code on the server, it can be helpful to see the XML requests and responses that are exchanged between the client and the server to determine which part of the application is causing an error. When you are using the Microsoft Exchange Web Services (EWS) Managed API, you can use the tracing methods on the ExchangeService object to capture the XML request that is sent to Exchange Web Services and the response that the server returns to the application.

    To enable tracing on the ExchangeService object:

    Dim _exchangeService As New ExchangeService
    Dim TC As New EWSTrace.TraceListener
    _exchangeService.TraceFlags = TraceFlags.All
    _exchangeService.TraceEnabled = True
    _exchangeService.TraceListener = TC

    The following code example shows simple object that implements the ITraceListener interface and stores the traced requests and responses in XML or text files.

    'NOTE: Following programming examples is for illustration only, without warranty either expressed or implied,
    'including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. 
    'This sample code assumes that you are familiar with the programming language being demonstrated and
    'the tools used to create and debug procedures. This sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. 
    Imports System
    Imports System.Text
    Imports Microsoft.Exchange.WebServices.Data
     
    Namespace EWSTrace
     
        Class TraceListener
            Implements ITraceListener
     
            Public Sub Trace(ByVal traceType As String, ByVal traceMessage As String) Implements ITraceListener.Trace
                CreateXMLTextFile(traceType + " --- " + traceMessage.ToString())
            End Sub
     
            Private Sub CreateXMLTextFile(ByVal traceContent As String)
                'Get the path of the application to create log files at
                Dim strPath As String = System.AppDomain.CurrentDomain.BaseDirectory
                strPath = strPath + "\\EWSLog.txt"
                Dim FS As System.IO.FileStream
                If System.IO.File.Exists(strPath) = False Then
                    FS = System.IO.File.Create(strPath)
                Else
                    FS = System.IO.File.OpenWrite(strPath)
                End If
                FS.Close()
     
                ' Create an instance of StreamWriter to write text to a file.
                Dim sw As System.IO.StreamWriter = System.IO.File.AppendText(strPath)
                sw.WriteLine(System.DateTime.Now.ToString() + " : " + traceContent)
                sw.Close()
                FS = Nothing
                sw = Nothing
            End Sub
        End Class
    End Namespace

    For reference and C# sample code snippet refer:

Page 1 of 1 (2 items)