\hypertarget{structwickr__stream__ctx}{}\doxysection{wickr\+\_\+stream\+\_\+ctx Struct Reference}
\label{structwickr__stream__ctx}\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}}


A context that is used for encrypting or decrypting a sequenced stream of data packets The stream context manages the state of stream operations including key evolution management based on the sequence number of the being encrypted / decrypted. The stream context is assigned a direction, and can only be used for encoding OR decoding of packets, and not both.  




{\ttfamily \#include $<$stream\+\_\+ctx.\+h$>$}

\doxysubsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} \mbox{\hyperlink{structwickr__stream__ctx_a14ef322bbeec579ded7f35c5aeb0d3fa}{engine}}
\item 
\mbox{\hyperlink{structwickr__stream__key}{wickr\+\_\+stream\+\_\+key\+\_\+t}} $\ast$ \mbox{\hyperlink{structwickr__stream__ctx_a3598b3c0415d13fafab6633f8c00a3c8}{key}}
\item 
\mbox{\hyperlink{structwickr__stream__iv}{wickr\+\_\+stream\+\_\+iv\+\_\+t}} $\ast$ \mbox{\hyperlink{structwickr__stream__ctx_a67c5066e87dbdc026358563daa51f174}{iv\+\_\+factory}}
\item 
uint64\+\_\+t \mbox{\hyperlink{structwickr__stream__ctx_abf2c6ab54e1663e6a47e310fd68b3b3f}{last\+\_\+seq}}
\item 
wickr\+\_\+stream\+\_\+direction \mbox{\hyperlink{structwickr__stream__ctx_a34c622c3ca61348321261ee7a9c3ff91}{direction}}
\item 
size\+\_\+t \mbox{\hyperlink{structwickr__stream__ctx_aa0e74b2c117666501373a5947d92e8c4}{ref\+\_\+count}}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
A context that is used for encrypting or decrypting a sequenced stream of data packets The stream context manages the state of stream operations including key evolution management based on the sequence number of the being encrypted / decrypted. The stream context is assigned a direction, and can only be used for encoding OR decoding of packets, and not both. 

Key evolution happens based on sequence number. Keyn+1 is generated by HMAC(\+Keyn, evolution\+\_\+key). Gaps in sequence numbers are allowed and if the key needs to evolove multiple times, it will do so in a loop until the key is current, and data ciphering is possible. Sequence numbers can NOT go backwards due to the evolution\textquotesingle{}s use of HMAC. Once Keyn+1 is generated, it is not possible to go back and calculate Keyn. 

\doxysubsection{Field Documentation}
\mbox{\Hypertarget{structwickr__stream__ctx_a34c622c3ca61348321261ee7a9c3ff91}\label{structwickr__stream__ctx_a34c622c3ca61348321261ee7a9c3ff91}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!direction@{direction}}
\index{direction@{direction}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{direction}{direction}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::direction}

the direction of this stream context. direction can either be encoding or decoding \mbox{\Hypertarget{structwickr__stream__ctx_a14ef322bbeec579ded7f35c5aeb0d3fa}\label{structwickr__stream__ctx_a14ef322bbeec579ded7f35c5aeb0d3fa}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!engine@{engine}}
\index{engine@{engine}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{engine}{engine}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::engine}

crypto engine to be used for cipher operations, as well as key evolution using HMAC \mbox{\Hypertarget{structwickr__stream__ctx_a67c5066e87dbdc026358563daa51f174}\label{structwickr__stream__ctx_a67c5066e87dbdc026358563daa51f174}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!iv\_factory@{iv\_factory}}
\index{iv\_factory@{iv\_factory}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{iv\_factory}{iv\_factory}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::iv\+\_\+factory}

the iv generator that this stream is using to create IVs \mbox{\Hypertarget{structwickr__stream__ctx_a3598b3c0415d13fafab6633f8c00a3c8}\label{structwickr__stream__ctx_a3598b3c0415d13fafab6633f8c00a3c8}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!key@{key}}
\index{key@{key}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{key}{key}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::key}

the current stream key that the stream context is using for encryption or decryption depending on direction the stream key will change over the course of packet encoding due to it\textquotesingle{}s evolutions \mbox{\Hypertarget{structwickr__stream__ctx_abf2c6ab54e1663e6a47e310fd68b3b3f}\label{structwickr__stream__ctx_abf2c6ab54e1663e6a47e310fd68b3b3f}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!last\_seq@{last\_seq}}
\index{last\_seq@{last\_seq}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{last\_seq}{last\_seq}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::last\+\_\+seq}

the most recent sequence number that successfully encrypted or decrypted a packet \mbox{\Hypertarget{structwickr__stream__ctx_aa0e74b2c117666501373a5947d92e8c4}\label{structwickr__stream__ctx_aa0e74b2c117666501373a5947d92e8c4}} 
\index{wickr\_stream\_ctx@{wickr\_stream\_ctx}!ref\_count@{ref\_count}}
\index{ref\_count@{ref\_count}!wickr\_stream\_ctx@{wickr\_stream\_ctx}}
\doxysubsubsection{\texorpdfstring{ref\_count}{ref\_count}}
{\footnotesize\ttfamily wickr\+\_\+stream\+\_\+ctx\+::ref\+\_\+count}

current reference count of the stream 

The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
src/wickrcrypto/include/wickrcrypto/stream\+\_\+ctx.\+h\end{DoxyCompactItemize}
