<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamic data decryption in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465232#M14466</link>
    <description>&lt;P&gt;Also I don't think you named your ODBC driver correctly. It is more likely to be SQL Server not SQLServer. Check with your SAS administrator to get the correct name.&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 23:14:42 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-05-25T23:14:42Z</dc:date>
    <item>
      <title>Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/439152#M13542</link>
      <description>&lt;P&gt;Forgive me if this isn't the correct forum to post this question.. i'm VERY new to SAS and still learning new things everyday.&amp;nbsp; My question is: I need to do column level decryption with SaS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the setup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL Server 2016:&lt;/P&gt;&lt;P&gt;-- SYMMETRIC KEY has been created with AES_256 bit for the database.&lt;/P&gt;&lt;P&gt;-- This table has been created.&amp;nbsp; The FooPassB will hold the encrypted data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CREATE TABLE Foo&lt;BR /&gt;(&lt;BR /&gt;FooId INT IDENTITY(1,1) PRIMARY KEY,&lt;BR /&gt;FooPassN NVARCHAR(25),&lt;BR /&gt;FooPassB VARBINARY(MAX) NULL,&lt;BR /&gt;LoadDate DATETIME DEFAULT(GETDATE())&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--In SQL I would add data to this table like this:&lt;/P&gt;&lt;P&gt;OPEN SYMMETRIC KEY CERT_KEY&lt;BR /&gt;DECRYPTION BY CERTIFICATE Cert;&lt;BR /&gt;GO&lt;/P&gt;&lt;P&gt;&amp;nbsp;INSERT INTO Foo (FooPassN, FooPassB)&lt;BR /&gt;&amp;nbsp;VALUES&lt;BR /&gt;&amp;nbsp;('1234', ENCRYPTBYKEY(KEY_GUID('CERT_KEY'), N'1234')),&lt;BR /&gt;&amp;nbsp;('5678', ENCRYPTBYKEY(KEY_GUID('CERT_KEY'), N'5678'))&lt;/P&gt;&lt;P&gt;CLOSE SYMMETRIC KEY CERT_KEY;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now here is my issue... how do I decrypt that data in sas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SQL I would:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OPEN SYMMETRIC KEY CERT_KEY&lt;BR /&gt;DECRYPTION BY CERTIFICATE Cert;&lt;BR /&gt;GO&lt;/P&gt;&lt;P&gt;SELECT FooPassN, FooPassB, CONVERT(NVARCHAR(25), DECRYPTBYKEY(FooPassB)) AS 'Decrypted Foo'&lt;BR /&gt;FROM DBO.Foo&lt;/P&gt;&lt;P&gt;CLOSE SYMMETRIC KEY CERT_KEY;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I don't think I can wrap that SQL statement in a SaS statement.&amp;nbsp; Does SaS have a way to send that whole command? or do I have to create a API or a Sproc that SaS can connect to and pull data from that instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers and thanks for any insight on this!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 02:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/439152#M13542</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-02-22T02:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/439157#M13543</link>
      <description>&lt;P&gt;Yes you can by wrapping the SQL Server-specific SQL in a pass-thru query:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 connect to odbc (noprompt = "server=MyServerName;DRIVER=SQL Server;Trusted Connection=yes;");
  create table Want  as 
  select * from connection to odbc
  (---- Put your SQL Server query here
   )
  ;
  disconnect from odbc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2018 02:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/439157#M13543</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-02-22T02:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/461564#M14332</link>
      <description>&lt;P&gt;Thanks for the response SASKiwi (I have been out for a bit and haven't had a chance to get back to this until now).&amp;nbsp; Looks like the SQL stuff changed just a bit since I last posted.&amp;nbsp; Operations has put in place a SQL Server 2016 with always on encryption.&amp;nbsp; They have given me a cert that allows me to query the data via SSMS.&amp;nbsp; However I'm still having issues with SaS.&amp;nbsp; Here is what i'm attempting to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I create a ODBC 64 bit DNS entry to my point to my SQL box and try to call it this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname odbclib odbc noprompt="dsn=odbclib;&lt;/P&gt;&lt;P&gt;DRIVER=SQLServer;Trusted Connection=yes;database=AlwaysEncryptedLab";&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this as a result with no data.&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NOTE: Libref ODBCLIB was successfully assigned as follows:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ODBC&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Physical Name: odbclib&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;If I try this way&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;libname odbclib odbc noprompt="server=xxxxx;&lt;/P&gt;&lt;P&gt;DRIVER=SQLServer;Trusted Connection=yes;&lt;SPAN&gt;ColumnEncryption=Enabled;&lt;/SPAN&gt;database=AlwaysEncryptedLab";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error:&lt;/P&gt;&lt;P&gt;ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified&lt;/P&gt;&lt;P&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So really all I want to do is know how to create a odbc connection with columnEncryption=Enabled and set that to a libname.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 11 May 2018 14:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/461564#M14332</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-05-11T14:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/461813#M14341</link>
      <description>&lt;P&gt;I would check out if you have the latest SQL Server ODBC driver which you can do on the Microsoft website - if not download the latest one. It is probably also worth opening a track with SAS Tech Support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 02:34:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/461813#M14341</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-05-13T02:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465003#M14464</link>
      <description>&lt;P&gt;I too have exactly the same question.&amp;nbsp; Do you have any solution now?&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 10:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465003#M14464</guid>
      <dc:creator>Nartlada</dc:creator>
      <dc:date>2018-05-25T10:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465232#M14466</link>
      <description>&lt;P&gt;Also I don't think you named your ODBC driver correctly. It is more likely to be SQL Server not SQLServer. Check with your SAS administrator to get the correct name.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 23:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465232#M14466</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-05-25T23:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465233#M14467</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211989"&gt;@Nartlada&lt;/a&gt; - have you tried? I think &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194884"&gt;@shivxy&lt;/a&gt; has other problems with his connection string, not just encryption.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 23:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465233#M14467</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-05-25T23:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465261#M14471</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;- Yes. After multiple tries, after many failures, I've finally made it.&amp;nbsp; I also had some problems with connection string so I changed to dsn.&amp;nbsp; Thank you very much for your suggestion.&amp;nbsp; Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; connect to odbc(dsn=&amp;lt;Data source name&amp;gt;);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; execute (open master key decryption by password = '&amp;lt;Master key encryption password&amp;gt;') by odbc;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; create table table2 as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; select * from connection to odbc&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (select convert(nvarchar, decryptbykeyautocert(cert_id('&amp;lt;Certificate name&amp;gt;'), null, &amp;lt;encrypted column&amp;gt;))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; from table1);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; disconnect from odbc;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194884"&gt;@shivxy&lt;/a&gt;- I used DecryptByKeyAutoCert that combines the functionality of OPEN SYMMETRIC KEY and DecryptByKey so I don't need to separately open and close symmetric key.&lt;/P&gt;</description>
      <pubDate>Sat, 26 May 2018 10:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465261#M14471</guid>
      <dc:creator>Nartlada</dc:creator>
      <dc:date>2018-05-26T10:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465294#M14472</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211989"&gt;@Nartlada&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark your report of a solution as&amp;nbsp;the solution.&amp;nbsp; Just because this is a bit uncommon (you are both the original poster and the solution reporter) doesn't mean this topic should remain unsolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Sat, 26 May 2018 23:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465294#M14472</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-05-26T23:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465359#M14473</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;-&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194884"&gt;@shivxy&lt;/a&gt;&amp;nbsp;was the original poster.&lt;/P&gt;</description>
      <pubDate>Sun, 27 May 2018 20:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465359#M14473</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-05-27T20:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465366#M14474</link>
      <description>Oops. Thanks..</description>
      <pubDate>Sun, 27 May 2018 21:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/465366#M14474</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-05-27T21:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/466118#M14530</link>
      <description>We also think we have a key store issue and looking into this. My security guy is out until next week and we're going to hit this again. With everyone replies I think we will get this!!</description>
      <pubDate>Wed, 30 May 2018 16:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/466118#M14530</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-05-30T16:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468564#M14656</link>
      <description>&lt;P&gt;Looks like updating the driver and adding the schema was able to do the trick!&amp;nbsp; ODBC 13.1 (not 13)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.microsoft.com/en-us/download/details.aspx?id=50420" target="_blank"&gt;https://www.microsoft.com/en-us/download/details.aspx?id=50420&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then we setup the DSN called A and used the code below and it worked..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname aaaa odbc datasrc=A user= alwayson password= password schema="dbo";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 01:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468564#M14656</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-06-08T01:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468565#M14657</link>
      <description>we moved to always on encryption in SQL 2016</description>
      <pubDate>Fri, 08 Jun 2018 01:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468565#M14657</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-06-08T01:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468566#M14658</link>
      <description>we had some odd problems and had to run everything as admin. hold down select and right click on the app.. pick run as admin.not sure if that will help</description>
      <pubDate>Fri, 08 Jun 2018 01:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468566#M14658</guid>
      <dc:creator>shivxy</dc:creator>
      <dc:date>2018-06-08T01:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic data decryption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468568#M14659</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194884"&gt;@shivxy&lt;/a&gt;&amp;nbsp;- I'd be interested to know what your connection string looks like now you have it working.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 01:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Dynamic-data-decryption/m-p/468568#M14659</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-06-08T01:50:26Z</dc:date>
    </item>
  </channel>
</rss>

