<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>There&amp;#39;s a problem encrypting the sensor values.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78120/there-s-a-problem-encrypting-the-sensor-values</link><description>Hello 
 I am using SDK v17.0.2 and nrf52DK. I am trying to encrypt and output the saadc value of the sensor. 
 I used the AES CTR example almost exactly the same. 
 And I encrypted the value of the sensor using sprintf as shown below. 
 
 
 And when encryption</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Aug 2021 11:57:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78120/there-s-a-problem-encrypting-the-sensor-values" /><item><title>RE: There's a problem encrypting the sensor values.</title><link>https://devzone.nordicsemi.com/thread/322854?ContentTypeID=1</link><pubDate>Mon, 02 Aug 2021 11:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8c55064-8d08-4bb6-b6ce-7814f503b7c2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If I recall correctly, the plaintext has to be the same number of bytes or more as the size of the block chiper (16 bytes if you use 128 bit AES&amp;nbsp; key, or 32if you use 256-bit). Can you try to append &amp;#39;0&amp;#39; padding to your sensor data and see if it works then?&lt;/p&gt;
&lt;p&gt;e.g.,&lt;/p&gt;
&lt;p&gt;uint8_t sensor_data_w_padding[32];&lt;/p&gt;
&lt;p&gt;memset(sensor_data_w_padding, 0, sizeof(sensor_data_w_padding));&lt;/p&gt;
&lt;p&gt;memcpy(sensor_data_w_padding, sensor data, &amp;lt;len of sensor data in bytes));&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>