Patent Publication Number: US-8533473-B2

Title: Method and apparatus for reducing bandwidth usage in secure transactions

Description:
BACKGROUND 
     In the last several years, the Internet has grown rapidly beyond servers, desktops and laptops to include handheld devices like PDAs and smart phones. There is now a growing realization that this trend will continue as increasing numbers of even simpler, more constrained devices (sensors, home appliances, personal medical devices) get connected to the Internet. The term “embedded Internet” is often used to refer to the phase in the Internet&#39;s evolution when it is invisibly and tightly woven into our daily lives. 
     Embedded devices with sensing and communication capabilities will enable the application of computing technologies in settings where they are unusual today: device and appliance networking in the home, automated full-time monitoring of patient health, remote diagnostics and control of industrial machinery, habitat monitoring, medical monitoring and emergency response, battlefield management, intelligent irrigation. Many of these applications have strong security requirements, e.g. health information must only be made available to authorized personnel (authentication) and be protected from modification (data integrity) and disclosure (confidentiality) in transit. Even seemingly innocuous data such as temperature and pressure readings may need to be secured. Consider the case of a chemical plant where sensors are used to continuously monitor the reactions used in manufacturing the final product. Without adequate security, an attacker could feed highly abnormal readings into the monitoring system and trigger catastrophic reactions. 
     Secure Sockets Layer (SSL) also referred to as Transport Layer Security (TLS) is the most popular security protocol on the Internet today. SSL combines public-key cryptography for key-distribution/authentication with symmetric-key cryptography for data encryption and integrity. However, public-key cryptography is widely believed to be beyond the capabilities of embedded devices. This perception is primarily driven by experiments involving RSA, today&#39;s dominant public-key cryptosystem. 
     SUMMARY 
     In order to provide an end-to-end security architecture for secure communications for highly constrained embedded devices that are remote from their monitoring/control location, a method is provided for establishing a secure connection between a remote device (e.g., the embedded device) and the monitoring/control location for the remote device. The method includes utilizing a compressed message representation to communicate between a gateway and the remote device over a wireless link and an uncompressed message representation to communicate between the gateway and the monitoring/control location during the establishment of the secure connection. The method may include utilizing a first network communication protocol, such as TCP between the first location and the gateway and utilizing a second network communication protocol, e.g., that provides efficient reliable communication between the gateway system and the remote device over the RF link. The method may further include utilizing a public-key algorithm within the Secure Sockets Layer (SSL) protocol or Internet Key Exchange for key establishment in establishing the secure connection between the remote device and the monitoring/control location. 
     Another embodiment provides a system for secure end to end communication, between a remote device having capability for communicating over a wireless link and a first location that monitors and/or controls the remote device. The system includes a gateway coupled to send and receive messages to/from the remote device over a wireless interface and a second interface for communicating with the first location. The gateway is configured to utilize a compressed message representation for messages sent and received over the wireless interface and an uncompressed message representation for messages sent and received over the second interface. The compressed message representation is utilized during establishment of a secure communication link between the remote device and the first location. In an embodiment the gateway utilizes a first network communication protocol such as TCP for communicating over the second interface and a second network communication protocol for communications over the wireless link. 
     The gateway may further include a suppressor module responsive to receipt of a message on the second interface, the message received as part of establishment of secure communication between the first location and a remote device. The suppressor module removes fixed information and/or information that is implicitly known or derivable from the received message to create a compressed message representation of the received message. The gateway forwards the received message in compressed message representation to the remote device via the wireless interface. The suppressor module is configured to insert a message identifier to identify at least one message template corresponding to the fixed information removed from the message to create the compressed message representation. A data recreator module may be used to insert message data previously suppressed to recreate an uncompressed message for transmission from the gateway to the first location or for use by the remote device. 
     In another embodiment the invention provides a device that includes a wireless interface and a processing element. During establishment of a secure communication end to end communication link with a monitoring device, the device utilizes a compressed message representation for messages sent and received over the wireless interface. The device may include a suppressor module that removes fixed information from an uncompressed message that is used to establish secure communications, the suppressor module creating a compressed message representation of the uncompressed message. The suppressor module is configured to insert a message identifier to identify at least one message template corresponding to the fixed information removed from the message to create the compressed message representation. The device may further include a data recreator module to insert message data previously removed to recreate an uncompressed message for use by the device. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  illustrates an exemplary gateway based architecture for making embedded devices accessible across the Internet. 
         FIG. 2  illustrates another exemplary gateway based architecture in which embedded devices can communicate over a multi-hop network. 
         FIG. 3  illustrates the different software layers in an implementation of the SSL security protocol. 
         FIG. 4A  illustrates exemplary SSL Messages (with size in bytes) sent in a Full Handshake. 
         FIG. 4B  illustrates exemplary SSL Messages (with size in bytes) sent in an Abbreviated Handshake, i.e. a session reuse. 
         FIG. 5  illustrates exemplary SSL Messages sent in a Full Handshake including optional messages. 
         FIG. 6  illustrates exemplary byte-level contents of messages in a Full Handshake. 
         FIG. 7  illustrates exemplary byte-level contents of messages in an Abbreviated Handshake. 
         FIG. 8  illustrates the compressed contents of handshake messages after passing through the suppressor module for a Full Handshake. 
         FIG. 9  illustrates the compressed contents of handshake messages after passing through the suppressor module for an Abbreviated Handshake. 
         FIG. 10  illustrates a high level flow diagram of operation of an exemplary suppressor module. 
         FIG. 11  illustrates a high level flow diagram of operation of an exemplary recreator module. 
     
    
    
     Note that the use of the same reference symbols in different drawings indicates similar or identical items. 
     DESCRIPTION 
     In one embodiment of the invention, a small footprint implementation of Secure Sockets Layer (SSL), uses Elliptic Curve Cryptography (ECC), which allows it to be used on highly constrained, wireless, embedded devices with limited computational resources. The Berkeley/Crossbow “mote” platform and the Telos mote are examples of such devices. While the use of ECC addresses the CPU constraints of these and related devices, the size of standard SSL messages is a poor fit for their communication capabilities. In particular, the need to transmit relatively large pieces of data (e.g. X.509 certificates) in the SSL handshake has an adverse impact on both the speed of the connection setup as well as power consumption. For example, the amount of energy consumed to transmit 1 bit can be equivalent to the energy required to execute nearly 2100 CPU instructions (note that these numbers are platform specific). These mote platforms may be quite small, e.g., on the order of a size of a quarter so available power may be small. 
     That might prompt one to abandon SSL for these devices in lieu of other protocols. However, the use of SSL has many advantages worth preserving. The two most significant include the fact that the SSL protocol has been in use on the Internet since the mid-1990s during which time it has been critically reviewed for security flaws by many researchers and improved in response to those analyses. It is now widely trusted to secure sensitive transactions including on-line banking, stock trading, and E-commerce. In addition, SSL is already built into many popular applications—all of the well-known web browsers support it. By enabling browser based secure transactions with embedded devices, one avoids the cost and inconvenience of user retraining. 
     The Elliptic Curve Diffie Hellman (ECDH) key exchange and the Elliptic Curve Digital Signature Algorithm (ECDSA) are elliptic curve counterparts of the well-known Diffie-Hellman algorithm and the digital signature algorithm (DSA), respectively. In ECDH key agreement, two communicating parties A and B agree to use the same curve parameters. They generate their private keys k A  and k B , and corresponding public keys Q A =k A G and Q B =k B G. The parties exchange their public keys and each party multiplies its private key and the other&#39;s public key to arrive at a common shared secret k A Q B =k B Q A =k A k B G. While a description of ECDSA is not provided here, it similarly parallels DSA. Recently, NIST approved ECC for use by the U.S. government. Several standards organizations, such as IEEE, ANSI, OMA (Open Mobile Alliance) and the IETF, have ongoing efforts to include ECC as a required or recommended security mechanism. 
     An architecture suitable for an embodiment of the present invention connects embedded device  101  to the Internet using an intermediate gateway  103  as shown in  FIG. 1 . A gateway joins two networks together typically utilizing a combination of hardware and software. The two networks joined together by the gateway often operate using different protocols. Such an architecture provides several benefits. More specifically, the gateway  103  serves as a bridge between the embedded devices and the rest of the Internet  105 . Gateway  103  connects to the Internet using a high-speed link (e.g. ethernet) and communicates with one or more embedded devices using, e.g., a lower-speed wireless link (such as IEEE 802.15.4) optimized for power consumption. In addition, the gateway provides a single choke point for controlling access to the embedded devices. It can implement various mechanisms including, but not limited to, address based filtering to enforce selective access from across the Internet. The gateway is also the ideal place to log all interactions with the embedded devices. In an embodiment where multiple devices are connected via a single gateway, the secure web server within each device can be mapped to a distinct TCP port at the gateway. 
     Referring to  FIG. 2 , another exemplary gateway based architecture suitable for one or more embodiments of the invention is shown in which embedded devices can communicate over a multi-hop network. As shown in  FIG. 2 , the embedded devices  201  and  203  communicate with gateway  103  through embedded devices  205 . For example, embedded device  203  may communicate directly over wireless link  207  with one of the embedded devices  205 , which in turn retransmits the received packets over wireless link  209  to gateway  103 . While a maximum of two hops is illustrated in  FIG. 2 , e.g., from embedded devices  201  to  203  to  205 , the number of hops is not limited to one or two hops as illustrated. For communications from gateway  103  packets destined for embedded devices  201  and  203 , may be first transmitted over wireless link  209  to embedded devices  205 . 
     One aspect of the invention described herein is a mechanism to reduce the amount of data transmitted across the wireless link(s) without compromising the end-to-end security afforded by the use of the SSL (or other) protocol. A small increase in computation is incurred in exchange for a substantial reduction in data transmission. The resulting savings in bandwidth not only speed up the handshake but also reduce power consumption. 
     The gateway can also serve as a performance enhancing proxy. In particular, the TCP protocol over which much of the Internet traffic (including both HTTP and HTTPS) flows was originally designed for networks with different loss characteristics than those displayed by typical wireless networks. This mismatch causes TCP to perform poorly when the connection involves a wireless hop. A well-known approach for alleviating this performance degradation splits the end-to-end path at the wireless link boundary—precisely where the gateway is situated. Terminating TCP at the gateway and using a special purpose reliable protocol between the gateway and the embedded devices has several benefits. For example, the special purpose protocol can be made simpler because it need not worry about end-to-end congestion control across multiple, possibly heterogeneous, links. Further, it can be tailored for the special loss characteristics of the single link (e.g. a NACK based scheme may be used if most of the packets sent are delivered successfully). Finally, local packet loss recovery improves overall performance. 
     The goal is to enable a scenario where the connection between the monitoring/control station  107  in  FIGS. 1 and 2  and the embedded devices is protected end-to-end by, e.g., SSL, even though the TCP connection itself only extends between the station and the gateway. The monitoring/control stations may be a server in a hospital monitoring patients or a server in a chemical plant monitoring chemical processes, or a home computer controlling monitored household devices. The monitoring/control stations typically provide a control function in conjunction with their monitoring role. For example, the control function may be to generate alerts or adjustments of medication in a patient monitoring scenario, adjusting of household devices such as lighting or heating in response to the monitored condition, or adjusting complex chemical processes in response to monitored data. 
     SSL offers encryption, source authentication and integrity protection for data and is flexible enough to accommodate different cryptographic algorithms for key agreement, encryption and hashing. Particular combinations of these algorithms are called cipher suites, e.g. the cipher suite TLS_RSA_WITH_RC4 — 128_SHA uses RSA for key exchange, 128-bit RC4 for bulk encryption, and SHA for hashing. 
     The two main components of SSL are the Handshake protocol and the Record Layer protocol.  FIG. 3  illustrates software layers in an implementation of the SSL security protocol. The Handshake protocol  301  allows an SSL client  303  and server  305  to negotiate a common cipher suite, authenticate each other, and establish a shared master secret using public-key algorithms. The Record Layer  307  derives symmetric keys from the master secret and uses them with faster symmetric-key algorithms for bulk encryption and authentication of application data, thus providing secure data exchange. 
     Since public-key operations are computationally expensive, the protocol&#39;s designers added the ability for a client and server to reuse a previously established master secret. This feature is also known as “session resumption”, “session reuse” or “session caching”. The resulting abbreviated handshake does not involve any public-key cryptography, requires fewer, shorter messages and can be completed more quickly than a full handshake. 
     The gateway can play an important role in reducing the amount of data that must be transmitted across the wireless hop in setting up an SSL connection. One key observation is that due to severe resource constraints, an embedded device will preferably implement a small set of cipher suites using a small number of parameters (such as the elliptic curve). In this situation, much of the data exchanged during an SSL handshake stays fixed from one connection attempt to another and does not need to be transmitted across the wireless link every time. For example, the X.509 certificate sent by the SSL server in the embedded device is the single biggest piece of data exchanged in a handshake and does not change across distinct connection attempts using the same cipher suite. 
     In an embodiment, data suppressor/recreator modules are inserted between the SSL protocol handler and the wireless transceiver at both ends of the wireless hop. At the sender, the suppressor module strips off information that is implicitly known to the receiver or easily derivable. At the receiver, the recreator module is responsible for reinserting the suppressed information. As far as the layers above these modules are concerned, the protocol is still SSL and thus retains its desirable properties including end-to-end security. Under the reasonable assumption that an embedded device and its corresponding gateway are administered and deployed by the same organization, this architectural modification can be made easily in a manner that is completely transparent to the remote clients. That is, remote clients can use standard SSL without having to be aware of the suppressor/recreator modules. Note that these modules work together to reduce the bandwidth consumed by the handshake messages, which are sent in the clear. The suppressor/recreator modules pass through secured application data unmodified. Since that data is encrypted and the gateway is not privy to the keys used to secure the data, the gateway cannot operate on that data. 
     The general operation of an ECDH-ECDSA handshake, is shown in  FIG. 4A . The client and server first exchange random values (used for replay protection) and negotiate a cipher suite using the ClientHello and ServerHello messages. The ServerCertificate message contains the server&#39;s ECDH public key signed by a certificate authority using ECDSA. After validating the ECDSA signature, the client conveys its ECDH public key to the server in the ClientKeyExchange message. Next, each entity uses its own ECDH private key and the other&#39;s public key to perform an ECDH operation and arrive at a shared premaster secret. Both end points then use the premaster secret to create a master secret which, along with previously exchanged random values, is used to derive the cipher keys, initialization vectors and MAC (Message Authentication Code) keys for bulk encryption and authentication by the Record Layer. 
     The use of ECDH and ECDSA in SSL mimics the use of DH and DSA, respectively. The SSL specification already defines cipher suites based on DH and DSA so the incorporation of ECC is not a large change. 
     The abbreviated handshake protocol is shown in  FIG. 4B . Here, the ClientHello message includes the non-zero ID of a previously negotiated session. If the server still has that session information cached and is willing to reuse the corresponding master secret, it echoes the session ID in the ServerHello message. Otherwise, it returns a new session ID thereby signaling the client to engage in a full handshake. The derivation of symmetric keys from the master secret is identical to the full handshake scenario. 
     A number of bandwidth and memory saving options may be utilized in an embodiment especially appropriate for embedded devices. One such embodiment preferably utilizes Elliptic Curve Cryptography (ECC) rather than RSA for key exchange. ECC can provide the same level of security as RSA using much smaller keys. It brings the powerful advantages of public-key cryptography to embedded devices like the mote where traditional mechanisms like RSA are less practical. In an effort to conserve program and data memory, only a single version (3.0) of the SSL protocol, a single cipher suite (ECDH-ECDSA-RC4-SHA) and a single elliptic curve (secp160r1) is enabled in one embodiment. Other embodiments of the invention may use different cipher suites employing different public-key key exchange mechanisms. These key exchange mechanisms may be based on RSA, the Diffie-Hellman key exchange, the Digital Signature Algorithm, or other public-key algorithms that are currently not part of the SSL specifications. In addition, embodiments may support more than one cipher suite. 
     Thus, while ECC may preferably be used for key exchange instead of RSA in some embodiments, in other embodiments, e.g., where the remote devices have more robust processing capability, RSA may be utilized for key exchange. In such an RSA embodiment, the handshakes shown in  FIGS. 4A and 4B  would have more bytes transmitted, but the advantage of handshake compression would still be beneficial, particularly in terms of reduced power consumption in the remote device that takes advantage of compression. 
     In an embodiment, the cipher suite enabled requires an ECC certificate. ECC keys are already smaller than RSA keys but additional effort is made to keep the certificate small. In particular, the subject and issuer names can be deliberately chosen to be brief (but no so short that they would compromise authentication) and optional certificate extensions have been omitted. 
     A 4-byte session identifier value may be used rather than the longer 32-byte values used in other servers with much larger scalability requirements. In particular, tight memory constraints in the embedded devices may preclude the possibility of storing information for more than a handful of connections in the session cache and a four byte identifier is more than sufficient to identify each cached session uniquely. In other embodiments, the session identifier may be larger or smaller than four bytes. The tradeoff in the session identifier is between the identifier size and the possibility of identifier collisions. 
     The ServerHello, Certificate and ServerHelloDone messages may be packed in a single SSL record rather than sending them as three separate records each with its own 5-byte header. In an embodiment, the cipher suite implemented does not entail sending the ServerKeyExchange message. Also, the CertificateRequest message is not sent out, which automatically eliminates the client&#39;s Certificate and CertificateVerify messages. This also obviates the need to have any certificate (specifically, ASN.1) parsing code. Note that this does not preclude authentication of the client using passwords (one-time or otherwise) over SSL as is commonly done for on-line banking, stock trading and e-commerce. 
     In another embodiment, rather than just the server sending a certificate, the client can authenticate using a certificate as well. Mutual authentication requires additional messages be sent between the server and the client. Referring to  FIG. 5 , the message flow for a full handshake is shown in which the asterisks indicate optional or situation-dependent messages that are not always sent. For instance, the Client&#39;s Certificate and CertificateVerify messages are only sent in response to the Server&#39;s CertificateRequest message. These three messages allow a client to be authenticated within the SSL protocol (as opposed to client authentication at the application layer which typically takes the form of a password sent over an SSL secured channel). The bandwidth reduction techniques described herein are also applicable to SSL handshakes involving the transmission of these optional/situational-dependent messages. 
     With the bandwidth saving options just described, the total number of bytes exchanged in a full SSL handshake is under 600 bytes. In contrast, for an RSA-based handshake, the server&#39;s certificate alone is typically more than 600 bytes. In an exemplary embodiment involving an SSL connection with an ECC cipher suite between the OpenSSL and a remote RF device, sizes of exemplary message are shown in parenthesis in  FIGS. 4A and 4B . The asterisk within parentheses next to the ServerHello message in  FIG. 4A  indicates that a common 5-byte header is used to pack all three messages.  FIG. 4A  illustrates a Full Handshake message with total bytes of 534 (client: 177, server: 357).  FIG. 4B  illustrates an Abbreviated Handshake with total bytes of 251 (client: 129, server: 122). 
       FIGS. 6 and 7  show byte-level contents of the messages exchanged in an exemplary embodiment. A careful examination reveals that for a given server almost all SSL messages retain their size from one connection attempt to another. The only exception is the ClientHello message sent in a Full Handshake which may vary in size because different clients may propose different sets of cipher suites. Even then, the ClientKeyExchange message will have the same size since it is governed by the curve used for the server&#39;s public key. This observation suggests that there is no need to send the length information explicitly for most messages. 
     Furthermore, in most cases, not just the length of the message but significant parts of its content stay fixed. In  FIG. 6  only the parts of messages identified as  601  contain data that changes for each connection request. Similarly for message shown in  FIG. 7 , only those parts of the message identified as  701  contain data that changes for each connection request. The data suppressor and recreator modules only need to exchange this information across the wireless hop. A few additional bytes are needed to identify the rest of the message “template” (the unchanging part in each message clump). In one embodiment, there are six such templates and they can be identified using a 1-byte identifier. 
     1. ClntHellov2 template corresponding to the ClientHello message (formatted as per SSLv2.0) in a full handshake; 
     2. SvrHelloCert template corresponding to the ServerHello, Certificate and ServerHelloDone messages in a full handshake; 
     3. ClntKeyExch template corresponding to the ClientKeyExchange message in a full handshake; 
     4. ClntHellov3 template corresponding to the ClientHello message (formatted as per SSLv3.0) in the abbreviated handshake; 
     5. SvrHello template corresponding to the ServerHello message in the abbreviated handshake; 
     6. CCSFinished template corresponding to the ChangeCipherSpec and Finished messages sent in both the full and abbreviated handshakes. 
     The use of the templates allows a significant reduction in traffic. Each suppressor module, based on the message type, replaces those portions of a message that remain unchanged with a much smaller template identifier. On receipt of the compressed message, the recreator module accesses the appropriate stored template based on the template identifier and recreates the full message using the template identifier. 
     The Certificate message is an extreme example where the entire content is fixed. At each embedded device, the suppressor module can replace its certificate with a much smaller unique certificate identifier. A unique certificate identifier may be created using a cryptographic hash of the certificate (or using part of the hash). Exemplary cryptographic hash algorithms are MD5 and SHA. By storing a table of certificates at the gateway, the gateway recreator module can use this identifier to look up the corresponding certificate. 
     In  FIG. 6 , the ClientKeyExchange message includes both the x and y coordinate of the elliptic curve point representing the public key. In reality, the y coordinate can be computed from x using the elliptic curve equation. For a given x-coordinate, there can be two possible values for y so an additional bit is needed to uniquely identify the y-coordinate. While the SSL protocol includes a provision to carry compressed points in the ClientKeyExchange message, such support is not mandatory in compliant implementations. But even when the remote client does not support point compression, compressed points can be used across the wireless hop in a transparent manner. 
       FIGS. 8 and 9  illustrate how different SSL handshake messages can be “compressed” by the suppressor module as they traverse the wireless hop. For the earlier message example shown in  FIG. 4 , the use of the suppressor/recreator modules reduces the number of bytes sent across the wireless hop in a Full Handshake from 534 to 232. Of these, the suppressor layer at the gateway sends 130 bytes (1 byte for ClntHellov2 template Id, 2 bytes for cipher suite length, 12 bytes for the cipher suite list, 32 bytes of a client random value, 1 byte for the ClntKeyExch template Id, 20 bytes for the x-coordinate, 1 byte to disambiguate the y-coordinate, 1 byte for the CCSFinished template Id and 60 bytes for the encrypted payload from the Finished message) and the suppressor layer at the server sends 102 bytes (1 byte for the SvrHelloCert template Id, 32 bytes of a server random value, 4 bytes of session identifier, 4 bytes of certificate identifier, 1 byte for the CCSFinished template Id and 60 bytes for the encrypted payload from the Finished message). The compression illustrated is exemplary and other compression approaches may vary. For example, another embodiment may not utilize point compression and thus the y coordinate is sent instead of the one byte to disambiguate the y-coordinate. Note that the original size of the encrypted Finished message is 65 bytes because it has a 5-byte SSL record layer header, a 4-byte handshake layer header, 36-byte payload, a 20-byte MAC (since the hashing algorithm in the negotiated cipher suite is SHA1). Everything beyond the record layer header is encrypted with RC4 which is a stream cipher and does not add any padding. Due to encryption, these 60 bytes cannot be compressed further without violating the end-to-end security guarantee because the gateway does not have the keys needed for decryption. 
       FIG. 9  illustrates operation of the suppressor module for an Abbreviated handshake. As shown in  FIG. 9  the number of bytes sent across the wireless hop in the Abbreviated handshake is reduced from 251 (see  FIG. 5 ) to 204. Of these, the suppressor layer at the gateway sends 106 bytes (1 byte for the ClntHellov3 template Id, 32 bytes of client random, 4 bytes of session Id, 2 bytes for cipher suite length, 6 bytes for cipher suite list, 1 byte for the CCSFinished template Id and 60 bytes of encrypted Finished message) and the suppressor layer at the server sends the remaining 98 bytes (1 byte for the SvrHello template Id, 32 bytes for server random, 4 bytes for session Id, 1 byte for the CCSFinsihed template Id and 60 bytes of the encrypted Finished message). 
     The methodology described herein requires a certain amount of information (e.g. certificates) to be exchanged a priori between the gateway and the embedded device. That can be done manually at the time of deploying the embedded device network or through an automated discovery process whereby the gateway solicits any embedded devices in its vicinity to register. During this discovery phase, the embedded devices can also signal to the gateway whether or not they support the bandwidth savings mechanisms described herein. In this fashion, a common gateway can be used to service both kinds of embedded devices. When interacting with devices that do not support this mechanism, the advantages of reduced data transmission in setting up a secure connection are not realized. 
     Various techniques can be utilized for populating the templates. In one embodiment the remote device initially utilizes a full handshake without compression to establish secure communications. The gateway can monitor that traffic and derive from the handshake messages the appropriate data to populate the templates. The template identifiers may be predefined. Once the templates are established, the gateway can indicate to the remote device that it can now utilize compressed communications to establish a secure connection. In another embodiment the remote device sends the template information to gateway. The template information may be sent as part of the registration process. Alternatively, manual configuration may be used for the templates. 
     The use of the suppressor/recreator modules has the potential to reduce the amount of data transmitted by over 50% for a full SSL handshake and almost 20% for an abbreviated handshake. 
     Referring now to  FIG. 10  a high level diagram illustrates operation of an exemplary suppressor module. The suppressor module may be implemented in software on both the gateway and the embedded device. Note that a suppressor module resides on both the gateway for generating compressed messages to the remote device and on the remote device for transmission of compressed messages to the gateway. At step  1001 , the suppressor module receives an uncompressed handshake message used to establish secure communications. For the gateway suppressor module, this is a handshake message received from the monitoring control station. In  1003 , the suppressor module identifies those portions of the message that can be deleted (because the information is implicitly known (like length) or easily derivable) and fixed portions of the message that can be replaced with one or more template identifiers (see, e.g.,  FIGS. 6 and 7 ). The template identifiers correspond to the fixed portion of the message removed. Those fixed portions of the message are then replaced with appropriate template identifier(s) resulting in a compressed message in  1005 . 
     Referring to  FIG. 11 , operation of an exemplary recreator module is illustrated. The recreator module may be implemented in software on both the gateway and the embedded device. The recreator module receives the compressed handshake message in  1101 , determines where the template identifiers are in the compressed message in  1103  and recreates the full message by inserting the message data from the templates in  1105  and other implicitly known or derivable information. The uncompressed message is now ready for transmission to the monitoring/control station. If the recreator module is on the embedded device, messages uncompressed by the recreator module are ready for use by the embedded device. 
     Previous gateway-based approaches (e.g. WAP) do not guarantee end-to-end security and make the gateway privy to all communication. In such approaches the gateway decrypts data coming on one side and re-encrypts it before passing it along. That makes the gateway a very attractive target for hackers because compromising the gateway will compromise all secure connections passing through it. In contrast, the approach described herein keeps all application data encrypted as it crosses the gateway so even if the gateway is compromised, no confidential information is revealed to the attacker. 
     The approach mentioned here differs from SSL compression which aims to reduce the amount of application data transmitted rather than the data sent during connection set up. SSL compression works above the SSL record layer and uses a generic data compression algorithm such as LZS or DEFLATE. Note that the technique described herein can be used in conjunction with SSL compression. The suppressor and recreator modules described here sit underneath the SSL record layer and by using specific knowledge of the structure of SSL handshake messages achieve a much higher compression ratio. 
     While the data compression technique described here was explained in the context of SSL, the technique can also be applied to other key establishment protocols for secure communications. For example, the data compression technique can also be applied to Internet Key Exchange (IKE), which is the key establishment protocol for IPsec (an Internet security protocol commonly used to create virtual private networks (VPNs)). The data compression technique described herein can be applied to still other Internet security protocols, e.g. Secure Shell protocol (SSH). The architecture in  FIG. 1  shows a single gateway but in certain situations, multiple gateways might be deployed for fail over. The mechanism described in this document can be extended to such a scenario by having these gateways share information, e.g. the mapping of certificate identifiers to certificates. 
     The approaches described herein allow one to embed a secure web server in tiny devices suitable for remote monitoring and control. For example, various embodiments can be implemented the Mica2, the Mica2 dot, and the MicaZ mote devices, which are: wireless, battery-powered devices. In an exemplary embodiment the mote includes an 8-bit Atmel ATmega128L processor, 128 KB of instruction memory, 4 KB of EEPROM, 4 KB of SRAM and a Chipcon CC 1000 radio transceiver with a rated bandwidth of 19.2 kbits/s. Of course other embodiments may use different hardware platforms. In one embodiment, the mote devices run the TinyOS software stack. The approaches described herein are also equally applicable to other software stacks for mote-like devices, e.g., those developed by the Zigbee alliance. 
     The SSL protocol was designed to be layered atop a reliable, bi-directional, byte-stream service, typically provided by TCP. In one embodiment the operating system Tiny OS is utilized but requires a reliable data transfer mechanism for the RF link. One embodiment transmits the first and last packets in a data block with explicit ACKs. All other packets in between use a NACK-based scheme where only lost packets are explicitly signaled. In addition, three other control packets are used: (i) NEWCONNECTION indicates that the gateway has accepted a new TCP connection (ii) DISCONNECT tells the gateway to terminate a TCP connection after an HTTPS request has been fulfilled, and (iii) READY indicates a mote&#39;s readiness to receive the next SSL record from the gateway. All three are sent with explicit ACKs. SSL records are fragmented into Tiny OS packets and sent across the wireless link without the overhead of TCP or IP headers. Each Tiny OS packet has a payload of 29 bytes, but one embodiment of a reliable transmission scheme uses 6 of those bytes for housekeeping chores like sequence numbers and return addresses. Therefore, an exemplary 286-byte record containing the ServerHello, Certificate and ServerHelloDone messages is fragmented into ┌286/23┐=13 Tiny OS packets. However, when this record is transmitted on the wired link, it is sent along with a 20-byte TCP header (TCP options increase the header size) and a 20-byte IP header. Although the gateway terminates the TCP/IP connection, the security offered by SSL is end-to-end. The data transfer protocol just described is exemplary and the particular data transfer protocol utilized, including payload sizes, acknowledgements, etc., may vary in different embodiments. 
     The embodiments described above are presented as examples and are subject to other variations in structure and implementation within the capabilities of one reasonably skilled in the art. The details provided above should be interpreted as illustrative and not as limiting. Variations and modifications of the embodiments disclosed herein, may be made based on the description set forth herein, without departing from the scope of the invention as set forth in the following claims.