Request for feedback: SQL Server encryption interoperability<p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Recently we have seen a few questions regarding interoperability between SQL Server encryption built-ins and CLR (or CAPI) encryption. While we have a very limited interoperability in SQL Server 2005 (read </font><a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1"><u><font face=Calibri color="#800080">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1</font></u></a><font face=Calibri> as a reference), we would like to understand your needs.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Please let us know about your cryptographic needs in SQL Server 2005, and why the existing functionality we have for both data at rest (encryptbykey, etc.) and data in transit (SSL) are not sufficient to solve your scenarios as well as what kind of functionality would you expect from SQL Server or the tools we ship in this area.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>We will greatly appreciate your time as we are really interested in this feedback as it will help us to improve our existing infrastructure and hopefully help solve your needs in papers, tools, examples or/and future versions of SQL Server.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Thanks a lot for all your feedback and comments in advance.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style=""> </span>-Raul Garcia</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>SDE/T</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>SQL Server Engine</font></p>© 2009 Microsoft Corporation. All rights reserved.Fri, 12 Dec 2008 05:25:20 Zd6aaca3c-91c9-4703-9f29-f5115a8a11d2http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#d6aaca3c-91c9-4703-9f29-f5115a8a11d2http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#d6aaca3c-91c9-4703-9f29-f5115a8a11d2Raul Garcia - MShttp://social.msdn.microsoft.com/Profile/en-US/?user=Raul%20Garcia%20-%20MSRequest for feedback: SQL Server encryption interoperability<p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Recently we have seen a few questions regarding interoperability between SQL Server encryption built-ins and CLR (or CAPI) encryption. While we have a very limited interoperability in SQL Server 2005 (read </font><a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1"><u><font face=Calibri color="#800080">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&amp;SiteID=1</font></u></a><font face=Calibri> as a reference), we would like to understand your needs.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Please let us know about your cryptographic needs in SQL Server 2005, and why the existing functionality we have for both data at rest (encryptbykey, etc.) and data in transit (SSL) are not sufficient to solve your scenarios as well as what kind of functionality would you expect from SQL Server or the tools we ship in this area.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>We will greatly appreciate your time as we are really interested in this feedback as it will help us to improve our existing infrastructure and hopefully help solve your needs in papers, tools, examples or/and future versions of SQL Server.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>Thanks a lot for all your feedback and comments in advance.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style=""> </span>-Raul Garcia</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>SDE/T</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>SQL Server Engine</font></p>Tue, 08 May 2007 00:48:05 Z2007-05-08T00:48:05Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#2b26ae48-b59c-42f6-b650-7b2400a3af4chttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#2b26ae48-b59c-42f6-b650-7b2400a3af4cerhmhttp://social.msdn.microsoft.com/Profile/en-US/?user=erhmRequest for feedback: SQL Server encryption interoperability<p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>I may have 25 years of development experience under my belt, but I'm a novice regarding Sql Server and security.  (btw, I've been plundering yours and Laurentiu Cristofor's blogs for information.  Thanks!)</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"></span> </p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"></span><span style="font-size:9.5pt;color:black"><font size=3>It seems to me that storing encryption keys separately from data is inherently safer than storing these in the same place.<span style="">  </span>In my current project I have users sharing the same database (same schema and same tables) but I must protect some of their records. <span style=""> </span>All my users are authenticated by Windows (Kerberos) which allows me to encrypt using the DataProtection API.<span style="">  </span>Except that DpApi isn’t directly supported by Sql Server.</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>So, I create some .NET wrappers; compile and upload the assembly to Sql Server; and it fails because of permissions. <span style=""> I get it to work with setting the db to Trustworthy only to later learn that this is a discouraged practice.  Instead, e</span>ventually, I figure out to sign the assembly with a certificate, load the same certificate to Sql Server, create a login using the  certificate, and then demand and grant the necessary permissions; except that now I need to use UNSAFE when I create the assembly.<span style="">  </span>(I think it odd that DpApi would fall under UNSAFE...)  Anyway, in AssemblyInfo.cs I end up with:</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;background:white;font-family:'Lucida Console'"><font size=3>[assembly: <span style="color:#2b91af">PermissionSet</span>( <span style="color:#2b91af">SecurityAction</span>.RequestOptional, Unrestricted = <span style="color:blue">false</span> )]</font></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;background:white;font-family:'Lucida Console'"><font size=3>[assembly: <span style="color:#2b91af">DataProtectionPermission</span>( <span style="color:#2b91af">SecurityAction</span>.RequestMinimum, Flags = <span style="color:#2b91af">DataProtectionPermissionFlags</span>.AllFlags )]</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>And in code:</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3></font></span> </p><span style="font-size:9.5pt;color:black"> <p><font size=3>[<font color="#2b91af">DataProtectionPermission</font>( <font color="#2b91af">SecurityAction</font>.Demand, Flags = <font color="#2b91af">DataProtectionPermissionFlags</font>.ProtectData )]</font></p> <p><font size=3>[<font color="#2b91af">SqlFunction</font>( Name = <font color="#a31515">&quot;EncryptDpApi&quot;</font>, DataAccess = <font color="#2b91af">DataAccessKind</font>.None, SystemDataAccess = <font color="#2b91af">SystemDataAccessKind</font>.None )]</font></p> <p><font size=3><font color="#0000ff">public</font> <font color="#0000ff">static</font> <font color="#0000ff">byte</font>[] EncryptDpApi( <font color="#0000ff">byte</font>[] data )</font></p></span> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"></span> </p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>Anyway, this seems like a lot of work to use the DpApi. <span style=""> </span>Perhaps there’s a better way?</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>Another requirement in my app is to share some records between users in the same group or business unit.<span style="">  </span>I may use the built-in Sql Server ability to create and mange shared encryption keys.<span style="">  </span>But following the DpApi model I’ve implemented, it seems easier to call an Encrypt / Decrypt pair in code and pass a shared key.</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p style="text-indent:0in"><font size=3><span style="font-size:10pt;background:white;color:blue;font-family:'Lucida Console'">public</span><span style="font-size:10pt;background:white;font-family:'Lucida Console'"> <span style="color:blue">static</span> <span style="color:blue">byte</span>[] EncryptCryptoApi( <span style="color:blue">byte</span>[] pswd, <span style="color:blue">byte</span>[] data )</span><span style="font-size:10pt;font-family:'Lucida Console'"></span></font></p> <p style="text-indent:0in"><font size=3><span style="font-size:10pt;background:white;color:blue;font-family:'Lucida Console'">public</span><span style="font-size:10pt;background:white;font-family:'Lucida Console'"> <span style="color:blue">static</span> <span style="color:blue">byte</span>[] DecryptCryptoApi( <span style="color:blue">byte</span>[] pswd, <span style="color:blue">byte</span>[] data )</span><span style="font-size:9.5pt;color:black"></span></font></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p></span> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>For various reasons it makes sense to have the encrypt / decrypt algorithm on both client and server.<span style="">  </span>Yet the EncryptByPassPhrase and DecryptByPassPhrase use a proprietary (unpublished) algorithm. <span style=""> </span>Thus I’d have to send the pass phrase key along the wire. <span style=""> </span>Don’t want to do that.<span style="">  </span>Thus another reason to implement wrappers for AES, etc. and a .NET assembly.</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3></font></span> </p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>I am not using SSL in the app, and yes this doesn't make a lot of sense.  Doing the best I can within some silly constraints and my own ignorance.</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3></font></span> </p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3>Part of why I'm taking the approach I am, is because there really isn't any good primer (at least that I've found) to show how to realistically protect app data.  Wish I had a simple shell and setup to work from, as well as explanatory docs.  Have you noticed how msft docs have gotten harder and harder to decipher over the years?</font></span></p> <p style="text-indent:0in"><span style="font-size:9.5pt;color:black"><font size=3> </font></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman"> </font></p> <p> </p>Tue, 05 Jun 2007 18:45:28 Z2007-06-05T18:45:28Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#78fc4e54-9351-43ad-87a8-358ef029c247http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#78fc4e54-9351-43ad-87a8-358ef029c247Raul Garcia - MShttp://social.msdn.microsoft.com/Profile/en-US/?user=Raul%20Garcia%20-%20MSRequest for feedback: SQL Server encryption interoperability<p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  Thanks a lot for the feedback. Let me summarize the points for interoperability and improving the encryption infrastructure from your previous post, please correct me if I am missing or misquoting something:</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in;text-indent:-0.25in"><span style=""><span style=""><font face=Calibri>1.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><font face=Calibri>Separating key storage from the protected data storage </font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in"><font face=Calibri>Motivation: Increase the level of protection of data at rest.</font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in;text-indent:-0.25in"><span style=""><span style=""><font face=Calibri>2.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><font face=Calibri>Create a layer for allowing encryption/decryption across platforms.</font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in"><font face=Calibri>Motivation: Being able to encrypt/decrypt data both in client and server independently</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  Regarding your concern on Encrypt/decyptByPassphrase, I just want to clarify that we are using conventional algorithms (i.e. 3DES), but we have some extra SQL Server specific  information that is part of the plaintext, but not documented. As an additional note, I am also making a note on the feedback regarding your concerns of sending the passphrase as plaintext (TSQL) for this call.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  Regarding your DPAPI usage, I would like to point out a couple of pitfalls of DPAPI that may not be obvious but that may affect your scenario:</font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in;text-indent:-0.25in"><span style="font-family:Symbol"><span style="">·<span style="font:7pt 'Times New Roman'">         </span></span></span><font face=Calibri>DPAPI is machine-specific unless you are using roaming profiles (</font><a title="http://msdn2.microsoft.com/en-us/library/aa380261.aspx" href="http://msdn2.microsoft.com/en-us/library/aa380261.aspx"><u><font face=Calibri color="#800080">http://msdn2.microsoft.com/en-us/library/aa380261.aspx</font></u></a><font face=Calibri>)</font></p> <p class=MsoListParagraph style="margin:0in 0in 1pt 0.5in;text-indent:-0.25in"><span style="font-family:Symbol"><span style="">·<span style="font:7pt 'Times New Roman'">         </span></span></span><font face=Calibri>DPAPI has limited concurrency support (only up to 10 simultaneous calls if I do remember).</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  Thanks a lot for all your help and support,</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>-Raul Garcia</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  SDE/T</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri>  SQL Server Engine</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p>Mon, 11 Jun 2007 20:33:37 Z2007-06-11T20:33:37Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#50e33c27-fd78-4a58-b4bb-def79503809ehttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#50e33c27-fd78-4a58-b4bb-def79503809eerhmhttp://social.msdn.microsoft.com/Profile/en-US/?user=erhmRequest for feedback: SQL Server encryption interoperability<p>My understanding is that DpApi is either machine OR user specific, from Keith Brown's book: </p> <p><font size=2></font> </p> <blockquote dir=ltr style="margin-right:0px"> <p><font size=2>Using DPAPI, you can encrypt data with a user's login credentials (which means you need to decrypt the data in the same security context in which it was encrypted), or you can encrypt the data using the machine's credentials. If you encrypt with the user’s credentials, when the user is not logged in to the machine, her key is not present on the machine at all, which is fantastic!</font></p> <p><a title="http://pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToStoreSecretsOnAMachine.html" href="http://pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToStoreSecretsOnAMachine.html"><font size=2>http://pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToStoreSecretsOnAMachine.html</font></a><font size=2> </font></p></blockquote> <p dir=ltr>I thought that the user should be able to access the same (encrypted) data from different machines, as long as the user was authenticated by the same ActiveDirectory (kerberos) server...</p> <p dir=ltr> </p> <p dir=ltr>I had even planned to allow an overnight batch process to access the encrypted data by using Protocol Transitioning and impersonation.  However, the clients have nixed this approach as to bleeding edge / risky.</p> <p dir=ltr> </p> <p dir=ltr>At any rate your summarization of my initial needs is accurate.  I'm now taking a more conventional approach: passing encrypted keys back and forth, using server side permissions to &quot;hide&quot; db objects, and server side symmetric keys mapped to users and groups.  This is semi-good, but easily compromised because it all hinges on using approle.  (Approle as the owener of the objects.)  Compromise the approle password and it all falls apart.  Sigh.</p> <p dir=ltr> </p> <p dir=ltr>Again, thanks you're blogs have really helped me ramp up to speed.</p> <p> </p> <p> </p>Tue, 12 Jun 2007 15:05:57 Z2007-06-12T15:05:57Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#0302ef21-b1cf-4ce8-974e-f022c59784fchttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#0302ef21-b1cf-4ce8-974e-f022c59784fcRaul Garcia - MShttp://social.msdn.microsoft.com/Profile/en-US/?user=Raul%20Garcia%20-%20MSRequest for feedback: SQL Server encryption interoperability<p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>DPAPI can be used to protect the information based on the machine credentials (</font><span style="font-size:8.5pt;font-family:'Verdana','sans-serif'">CRYPTPROTECT_LOCAL_MACHINE, </span><font face=Calibri>so anyone on that machine can access it), or based on the Windows user credentials, that is correct. But in the case the data is protected by the User’s credentials, the data can typically only be access on the same machine. I copied the following excerpt from the BOL link I posted earlier:</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><span style="font-size:8.5pt;font-family:'Verdana','sans-serif'">Typically, only a user with logon <a title="http://msdn2.microsoft.com/en-us/library/ms721572.aspx" href="http://msdn2.microsoft.com/en-us/library/ms721572.aspx"><i><u><font color="#0000ff">credentials</font></u></i></a> that match those of the encrypter can decrypt the data. In addition, decryption usually can only be done on the computer where the data was encrypted. However, a user with a roaming profile can decrypt the data from another computer on the network.</span></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style=""> </span><span style="">  </span>I hope this information will be useful, and once again thanks a lot for your feedback, we really appreciate it.</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri> </font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span>-Raul Garcia</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style="">  </span><span style=""> </span>SDE/T</font></p> <p class=MsoNormal style="margin:0in 0in 1pt"><font face=Calibri><span style=""> </span><span style="">  </span>SQL Server Engine</font></p>Wed, 13 Jun 2007 17:30:46 Z2007-06-13T17:30:46Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#34aeba4f-261d-43a9-b1c6-1a7cb2fdaabbhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#34aeba4f-261d-43a9-b1c6-1a7cb2fdaabbRaul Garcia - MShttp://social.msdn.microsoft.com/Profile/en-US/?user=Raul%20Garcia%20-%20MSRequest for feedback: SQL Server encryption interoperability<p>  Suggestion from a different thread in teh forum (<a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1306030&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1306030&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1306030&amp;SiteID=1</a>).</p> <p> </p> <p>  Having an option to specify the IV on Encrypt/Decrypt calls.</p>Fri, 15 Jun 2007 22:24:28 Z2007-06-15T22:24:28Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#1af473ac-ce80-4d3d-bf8e-e81d88f244cehttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#1af473ac-ce80-4d3d-bf8e-e81d88f244ceerhmhttp://social.msdn.microsoft.com/Profile/en-US/?user=erhmRequest for feedback: SQL Server encryption interoperability<p>Besides SQL Server Books Online, can you recommend a Primer and Advanced material for security and permissions in SQL Server 2005?  Books, links, anything that is more than a perfunctory chapter on &quot;defense in depth&quot; would be greatly appreciated.  </p> <p> </p> <p>I've come a long ways, but I can't quite reach critical mass.  Need some good reading material.  Thanks.</p>Tue, 19 Jun 2007 20:15:08 Z2007-06-19T20:15:08Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#e45171b7-8de3-4e72-98a0-f441919c718ehttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#e45171b7-8de3-4e72-98a0-f441919c718eRaul Garcia - MShttp://social.msdn.microsoft.com/Profile/en-US/?user=Raul%20Garcia%20-%20MSRequest for feedback: SQL Server encryption interoperability<p>  Other than BOL, have you tried Laurentiu's blog and my blog?</p> <p><a title="http://blogs.msdn.com/lcris/" href="http://blogs.msdn.com/lcris/">http://blogs.msdn.com/lcris/</a></p> <p><a title="http://blogs.msdn.com/raulga/" href="http://blogs.msdn.com/raulga/">http://blogs.msdn.com/raulga/</a></p> <p> </p> <p>  Unfortunately I don't have any good external resource at hand that I can recommend, I will also appreciate any pointers to external websites and/or books that talk about this topic in depth (SQL Server specific or DB in general).</p> <p> </p> <p>  Thanks a lot,</p> <p> </p> <p>-Raul Garcia</p> <p>  SDE/T</p>Tue, 19 Jun 2007 22:39:10 Z2007-06-19T22:39:10Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#fd272e50-51d0-4b45-9619-d58f81544a69http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#fd272e50-51d0-4b45-9619-d58f81544a69jdyoumanshttp://social.msdn.microsoft.com/Profile/en-US/?user=jdyoumansRequest for feedback: SQL Server encryption interoperability<p align=left></p> <p align=left><font face=Arial size=2></font>Here is my situation and I am sure that others have the similar issues.</p> <p align=left> </p> <p align=left>We receive files from many different clients.  Most of the files have sensitive information of some kind in them.  What we currently do is to either have the client PGP the entire file, or encrypt just the sensitive parts.  But this means that we have to decrypt the file on a file or app server, push the data clear text to a bulk load table, and then encrypt the data to the main tables using symmetric keys on SQL2005.  We tried doing this with SSIS but found that it was much slower than the way we are currently doing it.  Some of our data loads are very large.</p> <p align=left>This means that the data is in clear text on the app/file server for some short time and in the load table for some short time.</p> <p align=left> </p> <p align=left>What I would like to see is the ability to give my client a public key that they could use on different platforms (SQL or .NET or some type of PGP program) to encrypt the sensitive data and then send it to me.  I could then just load the data to my tables and never have to worry about it sitting in clear text.</p> <p align=left> </p> <p align=left>We are currently going through a PCI (Payment Card Industry) and data security is of the utmost importance with them.  We are having to put all kinds of secondary safeguards in due to the fact that our data is at rest in clear text for some short period of time.</p> <p align=left> </p> <p align=left>Thanks!</p> <p align=left> </p> <p align=left>Jim Youmans</p> <p align=left>St. Louis, Missouri</p>Tue, 31 Jul 2007 14:13:35 Z2007-07-31T14:13:35Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#2f88a4bc-047a-4bf9-972f-55490543b219http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#2f88a4bc-047a-4bf9-972f-55490543b219Michael Hotekhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20HotekRequest for feedback: SQL Server encryption interoperability<p align=left><font face=Arial size=2>One thing comes to mind in terms of interop with apps on multiple platforms.  I can create certs on a platform and sign an application with the cert.  I can load the same cert into SQL Server.  But, the two have no ability to recognize each other.  What would be nice is to be able to sign an application with a cert, load the cert to SQL Server and create a login for that cert, then be able to allow the application to login to the SQL Server by means of the cert that it is signed by.</font></p> <p align=left> </p> <p align=left>Granted, there might be all kinds of loopholes here that might crack my SQL Server wide open to attacks, but I leave that analysis up to y'all.  <img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFdA4ESFRtesEUXj11MHjIL5WMBvm3Pubiu_iWcnqAaGQ1&amp;t=633263991144971555"></p> <p> </p> <p align=left>Other than that, the further that I go into this with an unending set of progressively more complicated demos, the more I'm beginning to appreciate what is now here.  From way back in Beta 1, I knew that the security infrastructure was by far the biggest single change in SQL Server 2005.  But, until I was forced to dig into every nook and cranny of all of the features, I didn't have any idea of just how deep it goes.  It's getting rather hard to come up with business scenarios that aren't already covered.</p>Fri, 28 Sep 2007 11:04:21 Z2007-09-28T11:04:21Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#d4ba54ec-1706-46ac-b919-5c65da9f5938http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#d4ba54ec-1706-46ac-b919-5c65da9f5938erhmhttp://social.msdn.microsoft.com/Profile/en-US/?user=erhmRequest for feedback: SQL Server encryption interoperability<p align=left><font face=Arial size=2>I think this would be very useful.  I've had exactly this need--to authenticate an application (vs. a user).  I've ended up with a silly hack and then a switch to approle.  Because it is .NET my code is easily reverse engineered--not secure.  Authenticating the app via certificate signing would definitely be better!</font></p>Fri, 28 Sep 2007 11:32:56 Z2007-09-28T11:32:56Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#56a4862a-aea4-4d91-9589-bda51b53b957http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#56a4862a-aea4-4d91-9589-bda51b53b957Michael Hotekhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20HotekRequest for feedback: SQL Server encryption interoperability<p align=left><font face=Arial size=2>Sorta, kinda related to encryption since you are using the master key and cert infrastructure.  No suggestions, just feedback.</font></p> <p align=left> </p> <p align=left>When I first looked at signatures, I was baffled and couldn't see any reasonable way to really deploy them for most of the customer situations that I come across.  The examples deal with cross database ownership chaining and other things along those lines.  The more I play with signatures, the more I like them.  Does wonders for building robust and very secure auditing capability.  I can now do things like audit user actions from triggers without needing to grant users access to my audit tables.  I can ensure that users have no access whatsoever to my audit tables while at the same time applying a signature to the audit triggers that allows auditing to still function.  The longer I play with them, the more applications that I'm finding for signatures.</p>Sat, 29 Sep 2007 06:37:41 Z2007-09-29T06:37:41Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#17565114-8f8b-45dc-9e4d-f555f061994chttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#17565114-8f8b-45dc-9e4d-f555f061994cerhmhttp://social.msdn.microsoft.com/Profile/en-US/?user=erhmRequest for feedback: SQL Server encryption interoperability<p align=left><font face=Arial size=2>So, can you recommend a good text that covers the SqlServer 2005 security apparatus (including decent examples) in depth?  Something that might help with all those &quot;nooks and cranies?&quot;  OJT and &quot;learn by doing&quot; are great; but for this old dog, the new tricks are getting harder and harder.  And please don't point me back to Books Online.  Thanks!</font></p>Mon, 01 Oct 2007 12:25:34 Z2007-10-01T12:25:34Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#72411b24-2e5e-49eb-9b29-ee78b6fd8097http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/d6aaca3c-91c9-4703-9f29-f5115a8a11d2#72411b24-2e5e-49eb-9b29-ee78b6fd8097Michael Hotekhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20HotekRequest for feedback: SQL Server encryption interoperability<p>So here's one specific item.</p> <p align=left> </p> <p align=left>Authenticators exist for symmetric keys and passphrase encryption.  Why can't I specify an authenticator when I encrypt with an asymmetric key or a certificate?  This leaves asym keys and certs open to copying attacks within a table.  While symmetric keys offer better performance, it would be nice to be able to make my own choice as to what to use and I don't see any reason why an authenticator can't be specified as an option when using asym/cert.</p>Mon, 01 Oct 2007 16:59:35 Z2007-10-01T16:59:35Z