<?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 Nate Sanchez-Goodwin on Medium]]></title>
        <description><![CDATA[Stories by Nate Sanchez-Goodwin on Medium]]></description>
        <link>https://medium.com/@natesg?source=rss-f8b6cbba9d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7HAsBdTJ6CmyCzZBETm-Zg.jpeg</url>
            <title>Stories by Nate Sanchez-Goodwin on Medium</title>
            <link>https://medium.com/@natesg?source=rss-f8b6cbba9d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:43:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@natesg/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[Comparing end-to-end encrypted protocols in messaging applications]]></title>
            <link>https://medium.com/@natesg/comparing-end-to-end-encrypted-protocols-in-messaging-applications-b65a51fb5006?source=rss-f8b6cbba9d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b65a51fb5006</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[signal]]></category>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Nate Sanchez-Goodwin]]></dc:creator>
            <pubDate>Thu, 03 May 2018 00:00:00 GMT</pubDate>
            <atom:updated>2018-06-04T03:03:14.758Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cShRdxFkhUra0aDE" /></figure><p>This was originally written for the Network Security subject at Griffith University in April 2017. You can <a href="https://www.dropbox.com/s/bw8uim5w4vxdvpz/Signal-PGP-Assignment.pdf?dl=0">download it as a PDF here</a>.</p><p><strong><em>Abstract</em></strong>- Some Protocols can provide a large amount of overhead in comparison to others. This report explains how the simple Pretty Good Privacy protocol works as well as the sophisticated Signal protocol in the context of end-to-end encrypted instant messaging applications. This detailed analysis will develop insights into the mechanics of each protocol, identifying potential overheads and additional security services provided by each protocol.</p><h3>I. Introduction</h3><p>Encrypted messaging applications are becoming more and more common as Internet users focus on their privacy. These applications focus more on usage by personal users than that of an enterprise or government setting. Various security services are provided depending on the protocol implemented that users find favourable to prevent exposing their personal information on the Internet.</p><p>Two approaches are outlined in this paper, with an explanation on how they work to provide the target security services. Pretty Good Privacy (PGP) protocol, designed in 1991 was developed for electronic mail security and has been adopted in instant messaging applications [1]. A more recent approach is the Signal protocol developed in 2013 by Open Whisper systems to provide additional security services that aren’t provided by PGP. Services provided by Signal include; perfect forward secrecy, deniability and future secrecy [3].</p><h3>II. Approach 1. PGP Protocol Model</h3><p>Initially intended for electronic mail encryption, this simple approach to providing end to end encryption and is known as the PGP protocol [1]. Security services provided include; confidentiality, authentication, integrity and non-repudiation.</p><p>This method has been implemented in various iOS messaging applications including Apple’s iMessage [2], Sudo and other messaging applications.</p><p>Minor changes may be made when implemented to better suit an application needs but the core theory of the protocol remains the same.</p><h4>A. The Protocol</h4><p>Shown in figure 1, a new symmetric encryption key (usually AES with 256 bit keys) is generated for each message, referenced in figure 1 as KS. The sender and receiver each hold their own asymmetric (usually RSA 2048 bit) public/private key pairs that are generated at registration time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*dpvvBQ7lnDIXmf25ZmOxHQ.png" /><figcaption>Fig. 1. PGP protocol providing confidentiality and authentication [1].</figcaption></figure><h4>B. Sending a Message</h4><p>As depicted in figure 1, the following steps are taken each time a message is sent. Note that these steps have been modified to suit the use case of a messaging application rather than email.</p><ol><li>Generate KS.</li><li>Get KUB from the server.</li><li>Encrypts the message with KS.</li><li>Generate a digest of the message and sign it with KRA.</li><li>Encrypt KS with KUB.</li><li>To and from phone numbers are kept in plaintext to allow the server to route messages and verify the sender.</li><li>Send the message to the server.</li></ol><h4>C. Receiving a Message</h4><p>When a user receives a message they must do the following to obtain the plaintext.</p><ol><li>Retrieve message and KUA from the server, presenting the device id, and deleting the copy on the server for that device id.</li><li>Verify the signature with KUA (Discard if invalid).</li><li>Decrypt KS with KRB.</li><li>Decrypt the message with KS.</li></ol><h4>D. Multiple Devices</h4><p>A user may have multiple devices connected to one phone number or username, these devices must be registered ahead of time. This allows for the server to know the number of copies it needs to store for each device and can delete them when they have been received [2]. Depending on the implementation the user may need to encrypt multiple copies of the message with a different key for each device.</p><h4>E. Group Messaging</h4><p>To ensure all parties in a conversation receive the message and are able to encrypt it, the steps in sending a message are repeated for each of the recipients, along with passing metadata for a conversation identifier to allow the app to correctly handle and display the message [2].</p><p>For the purpose of efficiency all of the encrypted copies are sent to the server in one request to ensure group messaging does not take substantially longer than direct messaging.</p><h3>III. Approach 2. Signal Protocol</h3><p>Formerly known as the TextSecure protocol, this protocol was invented with the use cases of encrypting voice calls, video calls and messaging. It was developed by Open Whisper Systems in 2013.</p><p>Signal protocol provides the same security services as PGP protocol as well as perfect forward secrecy and deniability. Note that in signals implementation they use Google’s Cloud Messaging service (GCM) to deliver messages and add another layer of encryption done on the Signal server to prevent Google from being able to see the sender of a message, this will be ignored in this section as the protocol can be implemented without GCM.</p><p>Unlike the PGP protocol where all messages are handled the same way, Signal protocol derives a key from previous message keys using a Key derivation function (KDF) as shown in figure 2.</p><p>A KDF takes in a secret and random KDF key with input to return output [9].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*JHR8PvOKY2zII00FvhEIqg.png" /><figcaption>Fig. 2. Key Derivation Function concept [9].</figcaption></figure><h4>A. Registration</h4><p>At the time of registration, a user confirms ownership of the phone number it’s using to register. They then provide the server with their signaling keys, 100 pre-keys (each key is referenced with an ID), long-term public key [3].</p><p>Pre-keys are used to initiate a conversation between users who have no previous messages, each time one is used it is deleted on the server. When the server is running low on pre-keys it the user can add more, if there are no more pre- keys the last pre-key is used, known as the last resort key and it remains on the server [3].</p><h4>B. Initial Message</h4><p>Before a message can be sent a long lived symmetric secret key called the root key must be generated.</p><p>The sender requests a pre-key and the long term key for the receiver from the server. The sender then chooses a new ephemeral key and combines this with the pre-key and the long-term key and inputs it into a Hash Message Authentication Code (HMAC) key derivation function (HKDF) to provide the root key [10].</p><p>Using the signal protocol’s advanced ratcheting algorithm [9], a chaining key and new root key is derived from the old root key, the pre-key and a new Diffie- Hellman share using HKDF.</p><p>Encryption and Message Authentication Code (MAC) keys are then derived from the chaining key via HKDF [3] and these keys used to compute the chaining key can then be deleted as shown in figure 3.</p><p>The message can then be encrypted and have a digest with the encryption and mac keys, the pre-key id that the server gave the sender is appended to the message before encryption. To ensure messages are ordered correctly when being displayed, fields ctr and pctr (simply two counter fields) are added to a message where ctr is incremented on each message and pctr references the value of ctr for the message it is replying to [3].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*QyEb4nn7tuVA9ko-SDQzAA.png" /><figcaption>Fig. 3. Ratcheting keys to derive new keys and removing keys after computing [9].</figcaption></figure><h4>C. Receiving Messages</h4><p>The receiver looks up the long-lived private key and the one-time private key that corresponds to the pre-key id given with the message and calculates the first root key. It then does the same remaining steps as the sender to compute the encryption and MAC keys and can verify the MAC and decrypt the message [3].</p><h4>D. Replying to a Message</h4><p>When replying to a message where the sender and receiver have already established previous keys, fresh ephemeral key-pairs are used in combination with the last ephemeral private key to calculate a new root key. A chaining key is then derived from the new root key, and then encryption and MAC keys are derived from the chaining key via HKDF.</p><h4>E. Follow up Messages</h4><p>If a user sends multiple messages before receiving a reply from their last message, a new chaining key is derived for that message to ensure messages aren’t encrypted with the same keys over and over.</p><h3>IV. Comparison Of Approaches</h3><p>This section will compare and contrast the security services provided by each approach as well as talk about any security issues with each approach.</p><h4>A. Deniability</h4><p>Deniability in the context of message applications is the ability to deny that you and another party ever shared any communications even if their keys are compromised. Both parties A and B should be able to deny that they’ve ever communicated. Signal protocol provides this service via malleable encryption. Deniability is not provided by the implementation in approach 1 and in place of that, authentication is provided, if both keys are compromised then there is no doubt who the messages were sent from and addressed to.</p><p>In contrast, if the keys are compromised with the PGP protocol it can confirm with certainty that the communications occurred between the two parties, their contents and related metadata such as timestamps.</p><h4>B. Perfect Forward Secrecy (PFS)</h4><p>If keys are compromised with the PGP protocol approach, then all previous and future messages can be decrypted as session keys are encrypted with the same key every time. Signal protocol does not have this issue as it provides PFS [6], a security service that states that if a long term secret is exposed, session keys for future messages are not vulnerable.</p><p>With the PGP protocol, given your messages are encrypted with the same keys over and over, it would be important to generate new keys at a regular interval to ensure that if the previous key you were using is compromised, your communications moving forward would be secure again. This can add overhead both in development time as well as managing public keys, if a user encrypts a message with an old key, the user may not be able to decrypt the message and will discard it.</p><p>Keys could have an expiry date but when a user is offline for a period of time they may have a point in time where there is no valid key. These issues are avoided in the Signal protocol given a derived key is used for each message rather than the same key.</p><h4>C. Unknown Key Share Attack in Signal</h4><p>A research paper released early 2016 determined that the implementation of the Signal protocol was vulnerable to a “unknown key share attack” [3]. Due to the way the Signal server handles registration of new devices, a device could take someone else’s public key (user c) and claim it as their own. The attack would not allow the user to read other peoples messages but they could forward messages sent to them (by user a) and make them appear to user c that they were sent by user a to them.</p><p>The paper proposed a solution that the message should include the intended recipient as a tag to check the integrity of the source and destination.</p><p>An alternate solution that the paper did not mention was to require that the private key be used to sign a piece of data after sending the public key to ensure that the user providing the public key has the corresponding private key. This would make it infeasible to mount an unknown key share attack as the attacker would require the private key that corresponds to the user’s public key the attacker is attempting to register with.</p><h4>D. Messages Received out of Order</h4><p>Some implementations base timestamps off of the client side time, then converted to GMT zero to ensure differences between time zones are not affected. However, as this information is encrypted when reaching the server, the server cannot access the timestamp to verify it is correct at the time it is being processed and if the client has their time set incorrectly, messages will appear out of order for the receiver. Which can be really confusing for the user especially in group messaging scenarios [4]. Signal protocol solves this issue by storing the message number in the chain of messages, as this is critical information to ensure correct keys are being used [3]. The same approach that the signal protocol takes to ensure messages are received in the correct order could be used for messaging apps the implement the PGP protocol.</p><h4>E. Backdoors</h4><p>On January 13th 2017 The Guardian wrote an article claiming a new security vulnerability had been found due to the way WhatsApp implemented the Signal protocol [8]. Research from Tobias Boelter of the University of California in Berkeley was the source from these claims. Moxie Marlinspike of Open Whisper Systems responded on the same day as the guardian article claiming there was no vulnerabilities with WhatsApp or their implementation of the Signal Protocol and the article falsely reported the backdoor [7]. After publishing the article and being challenged, The Guardian changed the title of their article to exclude the wording from “backdoor” to “vulnerability”.</p><p>The vulnerability in question was referring to when keys are changed due to a new device being registered or the app being reinstalled. The server responds saying a different key should be used and the message is re-encrypted using the new key [7]. If the server is compromised and new public keys are registered that an attacker has a private key for, messages after that period of time would be encrypted using the attackers key and they could decrypt the messages.</p><p>All end to end encryption protocols and certificate authorities will have this issue if they are compromised, which is why it is assumed that the authority holding the keys is secure.</p><h4>F. Personal Identity</h4><p>Many encrypted messaging applications require you verify a phone number or identifiable information before being able to use the app. Seen in WhatsApp, Google Allo, Facebook Messenger, Signal, Telegram and more, these applications then allow users to message you via that phone number. Whilst this isn’t explicitly a security issue, Anonyome Labs have determined it a privacy issue and have patented masking a real user’s personal information with a synthetic identity [5]. They implement this in their app, Sudo, by allowing users to register without providing any personal information and providing phone numbers for a user.</p><h4>G. Verifying Keys Offline</h4><p>An additional feature provided by the Signal app, is the ability to verify a “safety number” for person you’re communicating with, either in person or via another channel that you can confirm the user is who you believe.</p><p>Signal app allows you to scan the QR code of your safety number in person to verify that the long term public key received by the user on one device from the server is the same that is being sent to the server by a user on the other device. Alternatively, to scanning a QR code you can verify the safety number via a phone call or any other communication channel.</p><h3>V. Conclusion</h3><p>The Signal protocol is an excellent development in instant messaging applications and is preferable for a user as they can be confident their privacy is protected with more layers than an implementation of the PGP protocol. The Signal protocol is still very new in comparison to the PGP protocol, but providing a user with Perfect Forward Secrecy and deniability can be seen as a huge advantage.</p><p>While the Signal protocol is new it has been implemented in messaging apps that affect over a billion users and a real vulnerability in the Signal protocol would be critical. PGP protocol can definitely be seen as a weaker encryption algorithm because of the lack of forward secrecy and as soon as a key is compromised, all of the future and past messages are compromised.</p><p>It is easy to tell that the Signal protocol and the Signal app have been designed for a modern experience with modern issues in mind. This includes the forethought around out of order messages, verifying keys offline and the additional security services provided.</p><p>PGP protocol has been around for a long time and is a trusted approach to securing communications from end-to- end. In the context of messaging applications, it’s a dated solution that doesn’t provide as many features as users in 2017 demand.</p><p><strong>References</strong></p><p>Both protocols definitely provide protection if users a worried about mass surveillance or from service providers using messaging data to profile your interests for advertising profiles.</p><p>[1] W. Stallings, “Electronic Mail Security” in Cryptography and Network Security Principles and Practice, 6th ed. Pearson</p><p>[2] Apple “iOS Security Guide” May. 2016. [Online]. Available: <a href="https://images.apple.com/au/business/docs/iOS_Security_Guide.pdf">https://images.apple.com/au/business/docs/iOS_Security_Guide.pdf</a></p><p>[3] T. Frosch, C. Mainka, C. Bader, F. Bergsma, J. Schwenk, T. Holz, “How Secure is TextSecure?” presented at the 2016 IEEE European Symposium on Security and Privacy (EuroS&amp;P), Mar. 21–24, 2016.</p><p>[4] X. Luo, G. Kloss. (2016, Jan). Multi-Party Encrypted Messaging Protocol design document. M e g a L i m i t e d . Auckland, New Zealand. [Online].Available: <a href="https://arxiv.org/abs/1606.04598">https://arxiv.org/abs/1606.04598</a></p><p>[5] P. Ashley, S. Shillingford, G. Clark, T. Bartley, N. Readshaw, C. Choi “Apparatus and Method for Masking a Real User Controlling Synthetic Identities” U.S. Patent 9 372 987, Dec. 19, 2014.</p><p>[6] Open Whisper Systems, “Advanced Cryptographic Ratcheting” Nov. 2013. [Online]. Available: <a href="https://whispersystems.org/blog/advanced-">https://whispersystems.org/blog/advanced-</a> ratcheting/</p><p>[7] Open Whisper Systems, “There is no WhatsApp backdoor” Jan. 2017. [Online]. Available: <a href="https://whispersystems.org/blog/there-is-no-">https://whispersystems.org/blog/there-is-no-</a> whatsapp-backdoor/</p><p>[8] The Guardian, “WhatsApp backdoor allows snooping on encrypted messages” Jan. 2017. [Online]. Available: <a href="https://www.theguardian.com/technology/2017/jan/13/whatsapp-">https://www.theguardian.com/technology/2017/jan/13/whatsapp-</a> backdoor-allows-snooping-on-encrypted-messages</p><p>[9] T. Perrin, M. Marlinspike (2016, Nov). The Double Ratchet Algorithm Open Whisper Systems [Online]. Available: <a href="https://whispersystems.org/docs/specifications/doubleratchet/">https://whispersystems.org/docs/specifications/doubleratchet/</a></p><p>[10] H. Krawczyk and P. Eronen, “HMAC-based Extract-and-Expand Key Derivation Function (HKDF).” Internet Engineering Task Force; RFC 5869 (Informational); IETF, May-2010. <a href="http://www.ietf.org/rfc/rfc5869.txt">http://www.ietf.org/rfc/rfc5869.txt</a></p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/comparing-end-to-end-encrypted-protocols-messaging-sanchez-goodwin/"><em>https://www.linkedin.com</em></a><em> on May 3, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b65a51fb5006" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>