<?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: Variable-value encryption in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822086#M324585</link>
    <description>&lt;P&gt;Thanks for the feedback! I'll post it there whenever I can&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 15:34:39 GMT</pubDate>
    <dc:creator>AlexBennasar</dc:creator>
    <dc:date>2022-07-07T15:34:39Z</dc:date>
    <item>
      <title>Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821902#M324504</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I've been programming with SAS in my job for 6 years. One thing I miss in Base SAS is the functionality of encrypting a single value or a collection of them, like a variable in a dataset. I'm not talking about hashing a variable, nor encrypting the entire dataset...I want to genuinely encrypt and decrypt values, with AES, PKCS, etc.&lt;/P&gt;&lt;P&gt;I have initiated a project to develop code &lt;STRONG&gt;(100% SAS code)&lt;/STRONG&gt; to implement this functionality. For now, the basic &lt;A href="https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.197.pdf" target="_blank" rel="noopener"&gt;AES&lt;/A&gt;&amp;nbsp; algorithm for encrypting and decrypting basic 128 bits-lengh blocks is done. You can encrypt them with a single macro call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/* Message to be encrypted */
%let message=00112233445566778899aabbccddeeff;
%put NOTE: Original message: &amp;amp;message;

/* Encryption with a 128-bit key */
%let key128=000102030405060708090a0b0c0d0e0f;
%let cryptogram128=%cipherAES(&amp;amp;message, &amp;amp;key128);
%put NOTE: Message encrypted with 128-bit key: &amp;amp;cryptogram128;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then decrypt with another call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/* Decryption with a 128-bit key */
%let messageDecrypted128=%invCipherAES(&amp;amp;cryptogram128, &amp;amp;key128);
%put NOTE: Message decrypted with 128-bit key: &amp;amp;messageDecrypted128;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The encryption key can have 3 lengths: 128, 192 and 256 bit, according to the AES:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/* Encryption with a 192-bit key */
%let key192=000102030405060708090a0b0c0d0e0f1011121314151617;
%let cryptogram192=%cipherAES(&amp;amp;message, &amp;amp;key192);
%put NOTE: Message encrypted with 192-bit key: &amp;amp;cryptogram192;

/* Encryption with a 256-bit key */
%let key256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f;
%let cryptogram256=%cipherAES(&amp;amp;message, &amp;amp;key256);
%put NOTE: Message encrypted with 256-bit key: &amp;amp;cryptogram256;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;These macros are, in fact, macrofunctions, but they can encrypt the N values of a dataset variable too:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/* Compute cryptograms and store them in macrovar */
proc sql noprint;
	select '%cipherAES('||m||','||k||')' into :cryptograms separated by ' ' from testMessages;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The project is a work in progress. To be fully functional, it will be needed at least:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;a key derivation function&lt;/LI&gt;&lt;LI&gt;a block cypher mode of operation&lt;/LI&gt;&lt;LI&gt;a padding scheme&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For now, the AES protocol implementation is all I have done. The project can be found here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/AlexBennasar/Crypto-SAS" target="_blank" rel="noopener"&gt;https://github.com/AlexBennasar/Crypto-SAS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this project will be interesting/useful for somebody!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 17:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821902#M324504</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-06T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821916#M324511</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406736"&gt;@AlexBennasar&lt;/a&gt;&amp;nbsp; - This is great, but I think you should post this in the Community Library as an article to get better visibility. You can do that here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/tkb-p/library" target="_blank"&gt;SAS Support Communities&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 19:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821916#M324511</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-06T19:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821918#M324513</link>
      <description>&lt;P&gt;Sure, unfortunately I still can't create an article there &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; but thanks for that feedback! I'll do it in near future, I hope&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 20:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821918#M324513</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-06T20:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821933#M324516</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406736"&gt;@AlexBennasar&lt;/a&gt;&amp;nbsp;- Maybe someone can sort that out for you. Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/14323"&gt;@ShelleySessoms&lt;/a&gt;&amp;nbsp;...&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 20:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821933#M324516</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-06T20:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821979#M324534</link>
      <description>Thanks for your help!</description>
      <pubDate>Thu, 07 Jul 2022 04:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/821979#M324534</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-07T04:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822041#M324575</link>
      <description>It is awesome. As SASKiwi said it would be better to post this in the Community Library.</description>
      <pubDate>Thu, 07 Jul 2022 11:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822041#M324575</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-07T11:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822086#M324585</link>
      <description>&lt;P&gt;Thanks for the feedback! I'll post it there whenever I can&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 15:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822086#M324585</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-07T15:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Variable-value encryption in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822527#M324809</link>
      <description>&lt;P&gt;The article is live now:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Variable-value-encryption-in-SAS/ta-p/822231" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Variable-value-encryption-in-SAS/ta-p/822231&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 11:41:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-value-encryption-in-SAS/m-p/822527#M324809</guid>
      <dc:creator>ShelleySessoms</dc:creator>
      <dc:date>2022-07-11T11:41:01Z</dc:date>
    </item>
  </channel>
</rss>

