<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by DataPeps by WALLIX on Medium]]></title>
        <description><![CDATA[Stories by DataPeps by WALLIX on Medium]]></description>
        <link>https://medium.com/@datapeps?source=rss-869450c605a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*akDJZhZgXSOgjnwQ.</url>
            <title>Stories by DataPeps by WALLIX on Medium</title>
            <link>https://medium.com/@datapeps?source=rss-869450c605a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:25:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@datapeps/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to encrypt data in your app in just 50 lines of code]]></title>
            <link>https://medium.com/@datapeps/how-to-encrypt-data-in-your-app-in-just-50-lines-of-code-453f6685cb67?source=rss-869450c605a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/453f6685cb67</guid>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[DataPeps by WALLIX]]></dc:creator>
            <pubDate>Tue, 29 May 2018 14:27:49 GMT</pubDate>
            <atom:updated>2018-05-29T14:27:49.205Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFmtJmK6f-W6F-SlKgrclg.png" /><figcaption>Photo Credit: Eavesdropping (Hello Hello anyone there) by Julie anne Johnson (2014), See: <a href="https://www.flickr.com/photos/pyride/13873732903/;">https://www.flickr.com/photos/pyride/13873732903/</a></figcaption></figure><p>Endless reports on data leaks reaffirm how important it is for developers to secure data and guarantee users privacy. <a href="https://blog.gemalto.com/security/2017/09/21/new-breach-level-index-findings-for-first-half-of-2017/">Gemalto estimates</a>, that since 2013 over 9 billion records have been lost, stolen or compromised. A trend which is, even more worryingly, increasing extremely rapidly with a 164% year-to-year increase.</p><p><strong>End-to-End Encryption (E2EE)</strong> ensures that only intended users can access private data: All the exchanged information is encrypted and decrypted directly on users devices and never leaves them in plain. Thus, the E2EE data stored on servers (cloud servers, in particular) is not accessible to unauthorized third parties: hackers, server admins, governments and institutions, service providers, etc. E2EE reduces the risk of attacks: Why would anyone steal data that is encrypted and, therefore, cannot be read?</p><p>E2EE is still not universally used, since implementing E2EE is hard. It is notoriously difficult to carry out all the necessary cryptographic schemes without introducing flaws that reduce the security of the application to nothing. A <a href="https://info.veracode.com/state-of-software-security-developer-supplement-report-veracode-resource.html">recent study</a> by Veracode showed that more than a half of applications are affected by cryptographic issues. The complexity of E2EE implementation also rises abruptly with the number of features: Users don’t only want to store static information, but they also desire to share it with other users (e.g. <a href="https://www.snapchat.com/">Snapchat</a> messaging) or groups of users (e.g. <a href="https://slack.com/">Slack</a>); and developers need to compute statistics directly on the encrypted data.</p><p><a href="https://datapeps.com/"><strong>DataPeps</strong></a> is a cloud-based solution that encourages the use of E2EE by simplifying its integration into your applications. By using the open source <a href="https://github.com/wallix/datapeps-sdk-js"><strong>DataPeps </strong>SDK</a>, you can easily encrypt users private data from end to end, as well as share and audit it — in short, treat the sensitive information with care and respect.</p><p>This technical tutorial will show you how to use <strong>DataPeps</strong> to add E2EE to a simple note keeper application <em>MyPrivateNote</em>.</p><h3>Tour of MyPrivateNote</h3><p>Our sample app <em>MyPrivateNote</em> allows to create and delete notes. In addition, users can download notes and import them back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNDBcBiJJ1_gCy18OqW97Q.png" /><figcaption>MyPrivateNote UI</figcaption></figure><p>For simplicity, <em>MyPrivateNote</em> has no server part and the notes are stored in plain in the browser using <strong>IndexedDB</strong>. Users log in to get access to their own notes, and multiple users can work on the same machine using different logins.</p><p><em>MyPrivateNote</em> is built in JavaScript using <a href="https://reactjs.org/docs/"><strong>React</strong></a>, <a href="https://bulma.io/"><strong>Bulma</strong></a> and <a href="https://fontawesome.com/"><strong>Font Awesome</strong></a> for CSS. You can find the complete code of <em>MyPrivateNote</em> <a href="https://github.com/wallix/myprivatenote">here</a>.</p><p><em>MyPrivateNote</em> suffers, however, from a major problem: Created notes are stored in plain and are not secured at all.</p><p>Obviously, we lack an authentication mechanism: An attacker can log in as another user and access the user’s personal notes. Indeed, we can easily add a password authentication; however, the lack of privacy would still exist. As <em>MyPrivateNote</em> uses<strong> IndexedDB</strong>, a malicious user can read the confidential notes by inspecting them directly in the browser. Moreover, the data is stored in plain, so even if we used a server-side database, an admin could read the users notes or a hacker could steal and leak them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scBQDT1_UYxMnBnYYjStYg.png" /><figcaption>Reading another user’s notes</figcaption></figure><p>The good news is, we can mitigate this problem by using <strong>DataPeps</strong> to add E2EE into the app. The app will store only encrypted notes and will decrypt them on demand of the notes owner.</p><p>In what follows we will see how to integrate E2EE functionality into <em>log-in</em> and <em>notes</em> components of <em>MyPrivateNote</em>.</p><h3>Preparing MyPrivateNote for E2EE integration</h3><p>To add E2EE to <em>MyPrivateNote</em> using <strong>DataPeps</strong>, the application developer creates a <strong>DataPeps</strong> application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4PNByyooPWoKLoOGVJaphw.png" /><figcaption>Creating an application</figcaption></figure><p><strong>DataPeps</strong> generates a secret token for each registered application. An application uses the secret token to authenticate itself against <strong>DataPeps</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uoupHMgBJWCeemZdHUFKdw.png" /><figcaption><strong><em>DataPeps</em></strong><em> </em>applications dashboard</figcaption></figure><h3>MyPrivateNote log-in</h3><p>When E2E is not integrated into <em>MyPrivateNote</em>, logging in only initializes the user’s notes store in <strong>IndexedDB</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/725eebf811eb5978df30f9bca0ace79b/href">https://medium.com/media/725eebf811eb5978df30f9bca0ace79b/href</a></iframe><p>To enable E2EE functions via <strong>DataPeps</strong> a user links his <a href="https://datapeps.com/dashboard/register">registered <strong>DataPeps</strong> account</a> to <em>MyPrivateNote</em> by logging into <strong>DataPeps</strong> and authorizing the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WbzClqjsHPWGv9mejEpfYg.png" /><figcaption>Authorizing MyPrivateNote</figcaption></figure><p>When the user hits the Login button, the application requests <em>Delegated access</em> to the <strong>DataPeps</strong> account of the user. It allows the app to use E2EE functions on behalf of the user; see <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Delegated-access">docs</a> for details.</p><p>After the user accepts the request, the application establishes a <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Session">session</a> with <strong>DataPeps</strong>.</p><p>We add session establishment like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/570d48347baaf9ce92f75564b7b9b687/href">https://medium.com/media/570d48347baaf9ce92f75564b7b9b687/href</a></iframe><p>After the user grants access, <strong>DataPeps</strong> creates a new <em>delegate </em>for the application. A <em>delegate </em>is an isolated application account managed by the user that allows the client application to use the E2EE functions. The user can access all the E2EE data that the application creates and applications can access only their own data.</p><p>The sign() callback function, that <em>MyPrivateNote</em> passes to requestDelegatedAccess(), signs the request using the app’s secret token and, thus, authenticates the application. In the real world, sign()should delegate signature generation to the app’s server:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edb00b2dfbc12f117e893328ba70cc9a/href">https://medium.com/media/edb00b2dfbc12f117e893328ba70cc9a/href</a></iframe><p>As <em>MyPrivateNote</em> is only client-side, <a href="https://github.com/wallix/myprivatenote/blob/E2EE-with-sharing/src/Sign.js#L14">sign()</a> (and the secret token) is exposed to client.</p><h3>Notes handling in MyPrivateNote</h3><p>Without E2EE support, <em>MyPrivateNote </em>stores the notes in plain in <strong>IndexedDB</strong>.</p><p>To secure the notes we will ensure that:</p><ol><li>only encrypted notes are stored in <strong>IndexedDB</strong>; the applications decrypts them after fetching from the store</li><li>the user downloads and imports encrypted notes</li></ol><p>We will also use <strong>DataPeps </strong>to add a new feature: Sharing encrypted notes with other users.</p><h3>Saving notes</h3><p>Without E2EE integration <em>MyPrivateNote</em> <a href="https://github.com/wallix/myprivatenote/blob/no-E2EE-integration/src/Store.js#L39">saves a user’s note in the store in plain</a>.</p><p>Encrypting a note before saving takes only two steps:</p><ol><li>create a new <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Resource"><strong>DataPeps</strong> resource</a></li><li>encrypt the note using the resource</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7149213573588c2d42db3233867d648c/href">https://medium.com/media/7149213573588c2d42db3233867d648c/href</a></iframe><p>The array passed to the Resource.create() method are <strong>DataPeps</strong> users (more specifically, <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Identity"><strong>DataPeps</strong> identities</a>) that can use the resource to encrypt and decrypt data. These users are the <a href="https://github.com/wallix/gopeps/wiki/Resource#anchor-sharing-group">resource sharing group</a>.</p><p>Resource description is visible to the resource sharers in their DataPeps dashboards and gives a hint about what piece of data was encrypted with the resource. For <em>MyPrivateNote</em> the description contains the ID of an encrypted note.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nn4gLpaqEdKBMuEfLnXJAQ.png" /><figcaption>Resources description in the <strong>DataPeps</strong> resources dashboard</figcaption></figure><p>Notes content does not leak anymore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3ccu1bgQi5RxRVtnThtNw.png" /><figcaption>An encrypted note in <strong>IndexedDB</strong></figcaption></figure><p>When the user expands the note, the application decrypts the note’s content and shows it.</p><p>Decrypting a note is similar to encrypting it:</p><ol><li>fetch the note’s resource from <strong>DataPeps</strong>, using dataPepsId, i.e. the resource ID</li><li>decrypt the note using the resource</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3796dfc9f632f86bb56b93bb0e192102/href">https://medium.com/media/3796dfc9f632f86bb56b93bb0e192102/href</a></iframe><h3>Downloading notes</h3><p>Users download notes in plaintext like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cf784670940e5b410f67e840c0f1200/href">https://medium.com/media/4cf784670940e5b410f67e840c0f1200/href</a></iframe><p>We just slightly change onDownloadNote() to download encrypted notes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f5df5facd464a952b1b9c3917323ba0/href">https://medium.com/media/8f5df5facd464a952b1b9c3917323ba0/href</a></iframe><h3>Importing notes</h3><p>Users import back the notes downloaded in plaintext like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27f091d8584ce86ba182859382ff1623/href">https://medium.com/media/27f091d8584ce86ba182859382ff1623/href</a></iframe><p>Importing an encrypted note is the same as putting an encrypted note to the store:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b52575e7133345c59832fa8c8fa92c2/href">https://medium.com/media/2b52575e7133345c59832fa8c8fa92c2/href</a></iframe><p><a href="https://github.com/wallix/myprivatenote/blob/master/src/Store.js#L63">saveEncrypted()</a> just adds the encrypted note into the store without decrypting it.</p><h3>Sharing encrypted notes</h3><p>With E2EE integrated, <em>MyPrivateNote</em> allows to download only encrypted notes, so users cannot exchange them directly. <strong>DataPeps</strong> makes it easy to add support for notes sharing between users</p><p>To share a note with a user the note creator adds him to the <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Resource#anchor-sharing-group">sharing group</a> of the note’s <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Resource"><strong>DataPeps</strong> resource</a>. A user in the sharing group can use the note’s resource to decrypt the note.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/512f75a5d7b0da8e642f905c90456f96/href">https://medium.com/media/512f75a5d7b0da8e642f905c90456f96/href</a></iframe><p>In practice, Alice clicks the <em>Share</em> icon, enters <em>MyPrivateNote</em> delegate ID of Bob and clicks <em>Share the note</em> button. After that Alice downloads the encrypted note and sends it to Bob. Bob simply imports the note to read it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jVfLVYG5jEwZSsmtGdNK4w.png" /><figcaption>MyPrivateNote delegate ID</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MtTjpLIoJJZ7-KFLhSnbQg.png" /><figcaption>Using the delegate ID to share a note</figcaption></figure><h3>Conclusion</h3><p>E2EE is an effective method for securing sensitive data during client-server interactions. The <em>MyPrivateNote</em> use case is a straightforward example of how E2EE guarantees information privacy.</p><p><strong>DataPeps</strong> considerably simplifies the integration of E2EE into your applications: In many cases, E2EE integration requires just a few lines of code.</p><p><strong>DataPeps</strong> also prevents you from introducing bugs into your E2EE implementation: All functions are ready-to-use, fail-safe and well documented.</p><p>With <strong>DataPeps</strong>, E2EE integration into your app has never been easier. To try it now, create a <a href="https://datapeps.com/dashboard/register"><strong>DataPeps</strong> account</a>, get the <a href="https://github.com/wallix/datapeps-sdk-js">SDK</a> and <a href="https://github.com/wallix/datapeps-sdk-js/wiki/Setting-up">start hacking</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=453f6685cb67" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>