\hypertarget{group__wickr__crypto__engine}{}\doxysection{Wickr\+\_\+crypto\+\_\+engine}
\label{group__wickr__crypto__engine}\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine}}
\begin{DoxyCompactList}\small\item\em Interface to a set of cryptographic operations used throughout the library. Currently the default implementation of this can be found along with documentation in \mbox{\hyperlink{openssl__suite_8h_source}{openssl\+\_\+suite.\+h}} and \mbox{\hyperlink{kdf_8h_source}{kdf.\+h}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} \mbox{\hyperlink{group__wickr__crypto__engine_ga4d68232f729ffeda16657582a5267d07}{wickr\+\_\+crypto\+\_\+engine\+\_\+get\+\_\+default}} (void)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga5709d94cd09ef0fb47d1a5f59232f115}{wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+cipher}} (const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} $\ast$engine, \mbox{\hyperlink{structwickr__kdf__algo}{wickr\+\_\+kdf\+\_\+algo\+\_\+t}} algo, \mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} cipher, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$value, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gab60480270e80ba34aa44385633037983}{wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+decipher}} (const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} $\ast$engine, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$input\+\_\+buffer, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)
\item 
\mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} \mbox{\hyperlink{group__wickr__crypto__engine_ga18c21501a41c97f2ba79a9366343cdcf}{wickr\+\_\+digest\+\_\+matching\+\_\+cipher}} (\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} cipher)
\item 
\mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} \mbox{\hyperlink{group__wickr__crypto__engine_ga0a708e5e46c40eae5eaeb581f6a1aed2}{wickr\+\_\+digest\+\_\+matching\+\_\+curve}} (\mbox{\hyperlink{structwickr__ec__curve}{wickr\+\_\+ec\+\_\+curve\+\_\+t}} curve)
\item 
\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} \mbox{\hyperlink{group__wickr__crypto__engine_gaf44e3be9066727bf83034d3593dc74e2}{wickr\+\_\+exchange\+\_\+cipher\+\_\+matching\+\_\+cipher}} (\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} cipher)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gae12855853c05caa473e748a62611d307}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+crypto\+\_\+random}} )(size\+\_\+t len)
\item 
\mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gabc120effc5248a491b18138f9b74b526}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+key\+\_\+random}} )(\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} cipher)
\item 
\mbox{\hyperlink{structwickr__cipher__result}{wickr\+\_\+cipher\+\_\+result\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gaf7be0d0ca0d9e7a0c5c3b1ec0fd0918e}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+encrypt}} )(const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$plaintext, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$aad, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$iv)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga459ef821cc40edb5e3c9ce1d571ddc00}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+decrypt}} )(const \mbox{\hyperlink{structwickr__cipher__result}{wickr\+\_\+cipher\+\_\+result\+\_\+t}} $\ast$cipher\+\_\+result, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$aad, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, bool only\+\_\+auth\+\_\+ciphers)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gaa77b1bc373d92d9db9d801bcc4a4d29c}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+encrypt\+\_\+file}} )(const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const char $\ast$source\+File\+Path, const char $\ast$destination\+File\+Path)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga361b843efc839e30f90ce24c15b1dd27}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+decrypt\+\_\+file}} )(const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const char $\ast$source\+File\+Path, const char $\ast$destination\+File\+Path, bool only\+\_\+auth\+\_\+ciphers)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga508c8ee796eb4e5b5881d9ac15f7e1c1}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+encrypt\+\_\+ofile}} )(FILE $\ast$fin, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, FILE $\ast$fout)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gae8edc03593fa5fa85218066a59f15c42}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+decrypt\+\_\+ofile}} )(FILE $\ast$fin, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, FILE $\ast$fout, bool only\+\_\+auth\+\_\+ciphers)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga42dfc5b4df166616d962ee4c792ceaf4}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+digest}} )(const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$buffer, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$salt, \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga298d2dea6722151c11e04458d3924823}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+digest\+\_\+file}} )(FILE $\ast$in\+\_\+file, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} mode)
\item 
\mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gad16b229b7d16cf00d3983c277ee3b88b}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+rand\+\_\+key}} )(\mbox{\hyperlink{structwickr__ec__curve}{wickr\+\_\+ec\+\_\+curve\+\_\+t}} curve)
\item 
\mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga87a069bbd3cdf509946e4ca0ca008f8f}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+key\+\_\+import}} )(const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$buffer, bool is\+\_\+private)
\item 
\mbox{\hyperlink{structwickr__ecdsa__result}{wickr\+\_\+ecdsa\+\_\+result\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gac5a36d2a53e06a75a2b818e6a5cc96a1}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+sign}} )(const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$ec\+\_\+signing\+\_\+key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data\+\_\+to\+\_\+sign, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gae541acc6433f6f5ffe84382ccd5e4f97}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+verify}} )(const \mbox{\hyperlink{structwickr__ecdsa__result}{wickr\+\_\+ecdsa\+\_\+result\+\_\+t}} $\ast$signature, const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$ec\+\_\+public\+\_\+key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data\+\_\+to\+\_\+verify)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_gab624f62e1d434c5b8222eabd656feb48}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+gen\+\_\+shared\+\_\+secret}} )(const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$local, const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$peer)
\item 
\mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga782e0e8786ecf8a55c8ae2aea2f178aa}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+hmac\+\_\+create}} )(const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$hmac\+\_\+key, \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)
\item 
bool($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga00c52a816403192af5b21d952265d0b6}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+hmac\+\_\+verify}} )(const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$hmac\+\_\+key, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} mode, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$expected)
\item 
\mbox{\hyperlink{structwickr__kdf__result}{wickr\+\_\+kdf\+\_\+result\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga5ab29968c993423df83c9f1a3d7e685d}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+kdf\+\_\+gen}} )(\mbox{\hyperlink{structwickr__kdf__algo}{wickr\+\_\+kdf\+\_\+algo\+\_\+t}} algo, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)
\item 
\mbox{\hyperlink{structwickr__kdf__result}{wickr\+\_\+kdf\+\_\+result\+\_\+t}} $\ast$($\ast$ \mbox{\hyperlink{group__wickr__crypto__engine_ga640cbc86ca36c4deb2c197de89dce7d1}{wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+kdf\+\_\+meta}} )(const \mbox{\hyperlink{structwickr__kdf__meta}{wickr\+\_\+kdf\+\_\+meta\+\_\+t}} $\ast$existing\+\_\+meta, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga4d68232f729ffeda16657582a5267d07}\label{group__wickr__crypto__engine_ga4d68232f729ffeda16657582a5267d07}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_get\_default@{wickr\_crypto\_engine\_get\_default}}
\index{wickr\_crypto\_engine\_get\_default@{wickr\_crypto\_engine\_get\_default}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_get\_default()}{wickr\_crypto\_engine\_get\_default()}}
{\footnotesize\ttfamily const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} wickr\+\_\+crypto\+\_\+engine\+\_\+get\+\_\+default (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}

Wickr default crypto engine

\begin{DoxyReturn}{Returns}
an engine containing default crypto primitive implementations (currently implemented with Open\+SSL 1.\+0.\+2, libscrypt, libbcrypt) 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga5709d94cd09ef0fb47d1a5f59232f115}\label{group__wickr__crypto__engine_ga5709d94cd09ef0fb47d1a5f59232f115}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_kdf\_cipher@{wickr\_crypto\_engine\_kdf\_cipher}}
\index{wickr\_crypto\_engine\_kdf\_cipher@{wickr\_crypto\_engine\_kdf\_cipher}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_kdf\_cipher()}{wickr\_crypto\_engine\_kdf\_cipher()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$ wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+cipher (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} $\ast$}]{engine,  }\item[{\mbox{\hyperlink{structwickr__kdf__algo}{wickr\+\_\+kdf\+\_\+algo\+\_\+t}}}]{algo,  }\item[{\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}}}]{cipher,  }\item[{const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$}]{value,  }\item[{const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$}]{passphrase }\end{DoxyParamCaption})}

Encrypt a buffer with a KDF + CIPHER

The KDF + CIPHER functions currently acts as follows\+:


\begin{DoxyEnumerate}
\item Calculate KDF(random\+Salt $\vert$$\vert$ passphrase)
\item Use the output of step 1. as a cipher key to encrypt the buffer \textquotesingle{}value\textquotesingle{} with the default engine cipher
\item The output of step 2 is then packed as $\vert$ KDF\+\_\+\+ID $\vert$ RANDOM\+\_\+\+SALT $\vert$ CIPHER\+\_\+\+TEXT $\vert$
\end{DoxyEnumerate}


\begin{DoxyParams}{Parameters}
{\em engine} & the engine to use for ciphering / kdf functions \\
\hline
{\em algo} & the kdf algorithm to use for key derivation \\
\hline
{\em cipher} & the cipher to use to encrypt \textquotesingle{}value\textquotesingle{} with the output of the KDF function with \textquotesingle{}passphrase\textquotesingle{} as input \\
\hline
{\em value} & the value to protect with the KDF cipher \\
\hline
{\em passphrase} & the KDF input to use for getting a cipher key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer serialized in the following format\+: 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gab60480270e80ba34aa44385633037983}\label{group__wickr__crypto__engine_gab60480270e80ba34aa44385633037983}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_kdf\_decipher@{wickr\_crypto\_engine\_kdf\_decipher}}
\index{wickr\_crypto\_engine\_kdf\_decipher@{wickr\_crypto\_engine\_kdf\_decipher}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_kdf\_decipher()}{wickr\_crypto\_engine\_kdf\_decipher()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$ wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+decipher (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{structwickr__crypto__engine}{wickr\+\_\+crypto\+\_\+engine\+\_\+t}} $\ast$}]{engine,  }\item[{const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$}]{input\+\_\+buffer,  }\item[{const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$}]{passphrase }\end{DoxyParamCaption})}


\begin{DoxyParams}{Parameters}
{\em engine} & the engine to use for deciphering / kdf functions \\
\hline
{\em input\+\_\+buffer} & the output of a kdf + cipher operation with \textquotesingle{}wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+cipher\textquotesingle{} \\
\hline
{\em passphrase} & the passphrase for the kdf + cipher operation \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the original buffer protected by \textquotesingle{}wickr\+\_\+crypto\+\_\+engine\+\_\+kdf\+\_\+cipher\textquotesingle{} or NULL if the KDF + cipher function fails due to an incorrect passphrase 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga18c21501a41c97f2ba79a9366343cdcf}\label{group__wickr__crypto__engine_ga18c21501a41c97f2ba79a9366343cdcf}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_digest\_matching\_cipher@{wickr\_digest\_matching\_cipher}}
\index{wickr\_digest\_matching\_cipher@{wickr\_digest\_matching\_cipher}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_digest\_matching\_cipher()}{wickr\_digest\_matching\_cipher()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} wickr\+\_\+digest\+\_\+matching\+\_\+cipher (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}}}]{cipher }\end{DoxyParamCaption})}

Get the matching digest type for a function based on size

DEPRECATED IN FAVOR OF wickr\+\_\+exchange\+\_\+kdf\+\_\+matching\+\_\+cipher

NOTE\+: Currently only 256bit AES ciphers are supported, so this function always returns SHA\+\_\+256


\begin{DoxyParams}{Parameters}
{\em cipher} & the cipher to find the matching digest for \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a digest that has an output which is the same size as the length of the cipher\textquotesingle{}s key 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga0a708e5e46c40eae5eaeb581f6a1aed2}\label{group__wickr__crypto__engine_ga0a708e5e46c40eae5eaeb581f6a1aed2}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_digest\_matching\_curve@{wickr\_digest\_matching\_curve}}
\index{wickr\_digest\_matching\_curve@{wickr\_digest\_matching\_curve}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_digest\_matching\_curve()}{wickr\_digest\_matching\_curve()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} wickr\+\_\+digest\+\_\+matching\+\_\+curve (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structwickr__ec__curve}{wickr\+\_\+ec\+\_\+curve\+\_\+t}}}]{curve }\end{DoxyParamCaption})}

Get the matching digest for a curve, this is to be used for signature operations using this curve


\begin{DoxyParams}{Parameters}
{\em curve} & a curve to get the matching digest for \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the digest to use for signature operations using \textquotesingle{}curve\textquotesingle{} 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gaf44e3be9066727bf83034d3593dc74e2}\label{group__wickr__crypto__engine_gaf44e3be9066727bf83034d3593dc74e2}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_exchange\_cipher\_matching\_cipher@{wickr\_exchange\_cipher\_matching\_cipher}}
\index{wickr\_exchange\_cipher\_matching\_cipher@{wickr\_exchange\_cipher\_matching\_cipher}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_exchange\_cipher\_matching\_cipher()}{wickr\_exchange\_cipher\_matching\_cipher()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} wickr\+\_\+exchange\+\_\+cipher\+\_\+matching\+\_\+cipher (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}}}]{cipher }\end{DoxyParamCaption})}

Get the matching exchange cipher given a message packet cipher

An exchange cipher is used for wrapping / unwrapping packet content decryption key material (see wickr\+\_\+key\+\_\+exchange\+\_\+create\+\_\+with\+\_\+packet\+\_\+key) This function currently always returns CIPHER\+\_\+\+ID\+\_\+\+AES256\+\_\+\+CTR The lack of authentication on this layer is a performance / space optimization, since it is ultimately protecting authenticated mode key material (currently always CIPHER\+\_\+\+ID\+\_\+\+AES256\+\_\+\+GCM) to be used for packet content decryption If bits are flipped in the key exchange itself, the resulting unauthenticated output will not be able to decrypt the GCM mode packet content


\begin{DoxyParams}{Parameters}
{\em cipher} & the cipher being used for packet content encryption / decryption \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the exchange cipher matching \textquotesingle{}cipher\textquotesingle{} 
\end{DoxyReturn}


\doxysubsection{Variable Documentation}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga459ef821cc40edb5e3c9ce1d571ddc00}\label{group__wickr__crypto__engine_ga459ef821cc40edb5e3c9ce1d571ddc00}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_cipher\_decrypt@{wickr\_crypto\_engine\_cipher\_decrypt}}
\index{wickr\_crypto\_engine\_cipher\_decrypt@{wickr\_crypto\_engine\_cipher\_decrypt}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_cipher\_decrypt}{wickr\_crypto\_engine\_cipher\_decrypt}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+decrypt) (const \mbox{\hyperlink{structwickr__cipher__result}{wickr\+\_\+cipher\+\_\+result\+\_\+t}} $\ast$cipher\+\_\+result, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$aad, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, bool only\+\_\+auth\+\_\+ciphers)}

Decrypt a cipher\+\_\+result


\begin{DoxyParams}{Parameters}
{\em cipher\+\_\+result} & a cipher result generated from \textquotesingle{}wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+encrypt\textquotesingle{} \\
\hline
{\em aad} & additional data to authenticate with the ciphertext (only works with authenticated ciphers) \\
\hline
{\em key} & the key to use to attempt to decrypt \textquotesingle{}cipher\+\_\+result\textquotesingle{} \\
\hline
{\em only\+\_\+auth\+\_\+ciphers} & if true, only authenticated ciphers may be used for decryption \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing decrypted bytes. If the AES mode is authenticated, NULL will be returned if key is incorrect. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gaf7be0d0ca0d9e7a0c5c3b1ec0fd0918e}\label{group__wickr__crypto__engine_gaf7be0d0ca0d9e7a0c5c3b1ec0fd0918e}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_cipher\_encrypt@{wickr\_crypto\_engine\_cipher\_encrypt}}
\index{wickr\_crypto\_engine\_cipher\_encrypt@{wickr\_crypto\_engine\_cipher\_encrypt}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_cipher\_encrypt}{wickr\_crypto\_engine\_cipher\_encrypt}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__cipher__result}{wickr\+\_\+cipher\+\_\+result\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+encrypt) (const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$plaintext, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$aad, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$iv)}

Encrypt a buffer

NOTE\+: IV is randomly chosen using a secure random function if one is not provided


\begin{DoxyParams}{Parameters}
{\em plaintext} & the content to encrypt using \textquotesingle{}key\textquotesingle{} \\
\hline
{\em aad} & additional data to authenticate with the ciphertext (only works with authenticated ciphers) \\
\hline
{\em key} & the cipher key to use to encrypt \textquotesingle{}plaintext\textquotesingle{} \\
\hline
{\em iv} & an initialization vector to use with the cipher mode, or NULL if one should be chosen at random \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a cipher result containing encrypted bytes, or NULL if the cipher mode fails or is not supported 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gabc120effc5248a491b18138f9b74b526}\label{group__wickr__crypto__engine_gabc120effc5248a491b18138f9b74b526}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_cipher\_key\_random@{wickr\_crypto\_engine\_cipher\_key\_random}}
\index{wickr\_crypto\_engine\_cipher\_key\_random@{wickr\_crypto\_engine\_cipher\_key\_random}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_cipher\_key\_random}{wickr\_crypto\_engine\_cipher\_key\_random}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+cipher\+\_\+key\+\_\+random) (\mbox{\hyperlink{structwickr__cipher}{wickr\+\_\+cipher\+\_\+t}} cipher)}

Generate a secure random cipher key for a particular cipher


\begin{DoxyParams}{Parameters}
{\em cipher} & the cipher to generate a random key for \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a cipher key containing key material generated by a secure random function or NULL if random byte generation fails 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gae12855853c05caa473e748a62611d307}\label{group__wickr__crypto__engine_gae12855853c05caa473e748a62611d307}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_crypto\_random@{wickr\_crypto\_engine\_crypto\_random}}
\index{wickr\_crypto\_engine\_crypto\_random@{wickr\_crypto\_engine\_crypto\_random}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_crypto\_random}{wickr\_crypto\_engine\_crypto\_random}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+crypto\+\_\+random) (size\+\_\+t len)}

Generate secure random bytes


\begin{DoxyParams}{Parameters}
{\em len} & the number of bytes to generate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing \textquotesingle{}len\textquotesingle{} secure random bytes or NULL if random byte generation fails 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga361b843efc839e30f90ce24c15b1dd27}\label{group__wickr__crypto__engine_ga361b843efc839e30f90ce24c15b1dd27}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_decrypt\_file@{wickr\_crypto\_engine\_decrypt\_file}}
\index{wickr\_crypto\_engine\_decrypt\_file@{wickr\_crypto\_engine\_decrypt\_file}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_decrypt\_file}{wickr\_crypto\_engine\_decrypt\_file}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+decrypt\+\_\+file) (const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const char $\ast$source\+File\+Path, const char $\ast$destination\+File\+Path, bool only\+\_\+auth\+\_\+ciphers)}

Decrypt a file


\begin{DoxyParams}{Parameters}
{\em in\+\_\+file} & the encrypted file to decrypt \\
\hline
{\em key} & the key to use for decryption \\
\hline
{\em out\+\_\+file} & the file to write the decrypted data from \textquotesingle{}in\+\_\+file\textquotesingle{} \\
\hline
{\em only\+\_\+auth\+\_\+ciphers} & if true, only authenticated ciphers may be used for decryption \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if the decryption operation succeeds, and \textquotesingle{}out\+\_\+file\textquotesingle{} can be written 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gae8edc03593fa5fa85218066a59f15c42}\label{group__wickr__crypto__engine_gae8edc03593fa5fa85218066a59f15c42}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_decrypt\_ofile@{wickr\_crypto\_engine\_decrypt\_ofile}}
\index{wickr\_crypto\_engine\_decrypt\_ofile@{wickr\_crypto\_engine\_decrypt\_ofile}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_decrypt\_ofile}{wickr\_crypto\_engine\_decrypt\_ofile}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+decrypt\+\_\+ofile) (FILE $\ast$fin, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, FILE $\ast$fout, bool only\+\_\+auth\+\_\+ciphers)}

Decrypt an open file


\begin{DoxyParams}{Parameters}
{\em fin} & read encrypted data from this FILE pointer \\
\hline
{\em key} & the key to use for decryption \\
\hline
{\em fout} & write decrypted data to this FILE pointer \\
\hline
{\em only\+\_\+auth\+\_\+ciphers} & if true, only authenticated ciphers may be used for decryption \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if the decryption operation succeeds 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga42dfc5b4df166616d962ee4c792ceaf4}\label{group__wickr__crypto__engine_ga42dfc5b4df166616d962ee4c792ceaf4}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_digest@{wickr\_crypto\_engine\_digest}}
\index{wickr\_crypto\_engine\_digest@{wickr\_crypto\_engine\_digest}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_digest}{wickr\_crypto\_engine\_digest}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+digest) (const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$buffer, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$salt, \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)}

Calculate a hash of a buffer using an optional salt value


\begin{DoxyParams}{Parameters}
{\em buffer} & the buffer to hash \\
\hline
{\em salt} & a salt value mix with buffer before taking the hash Passing NULL will allow for no salt to be used \\
\hline
{\em mode} & the mode of the hash \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing the derived hash or NULL if the hashing operation fails 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga298d2dea6722151c11e04458d3924823}\label{group__wickr__crypto__engine_ga298d2dea6722151c11e04458d3924823}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_digest\_file@{wickr\_crypto\_engine\_digest\_file}}
\index{wickr\_crypto\_engine\_digest\_file@{wickr\_crypto\_engine\_digest\_file}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_digest\_file}{wickr\_crypto\_engine\_digest\_file}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+digest\+\_\+file) (FILE $\ast$in\+\_\+file, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} mode)}

Calculate the hash of a file


\begin{DoxyParams}{Parameters}
{\em in\+\_\+file} & a file to take the hash of it\textquotesingle{}s contents \\
\hline
{\em mode} & the mode to use for calculating the hash \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing the output of the chosen mode of the contents of in\+\_\+file 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga87a069bbd3cdf509946e4ca0ca008f8f}\label{group__wickr__crypto__engine_ga87a069bbd3cdf509946e4ca0ca008f8f}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_ec\_key\_import@{wickr\_crypto\_engine\_ec\_key\_import}}
\index{wickr\_crypto\_engine\_ec\_key\_import@{wickr\_crypto\_engine\_ec\_key\_import}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_ec\_key\_import}{wickr\_crypto\_engine\_ec\_key\_import}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+key\+\_\+import) (const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$buffer, bool is\+\_\+private)}

Import an Elliptic Curve key from a buffer


\begin{DoxyParams}{Parameters}
{\em buffer} & the buffer representing Elliptic Curve key material \\
\hline
{\em is\+\_\+private} & false if the buffer represents a public key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an Elliptic Curve key pair parsed from buffer or NULL if buffer does not contain a valid key, or is\+\_\+private is incorrectly set 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gad16b229b7d16cf00d3983c277ee3b88b}\label{group__wickr__crypto__engine_gad16b229b7d16cf00d3983c277ee3b88b}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_ec\_rand\_key@{wickr\_crypto\_engine\_ec\_rand\_key}}
\index{wickr\_crypto\_engine\_ec\_rand\_key@{wickr\_crypto\_engine\_ec\_rand\_key}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_ec\_rand\_key}{wickr\_crypto\_engine\_ec\_rand\_key}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+rand\+\_\+key) (\mbox{\hyperlink{structwickr__ec__curve}{wickr\+\_\+ec\+\_\+curve\+\_\+t}} curve)}

Generate a random Elliptic Curve keypair


\begin{DoxyParams}{Parameters}
{\em curve} & the curve parameters to use for random key pair generation \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a random Elliptic Curve key pair or NULL if the random generation fails 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gac5a36d2a53e06a75a2b818e6a5cc96a1}\label{group__wickr__crypto__engine_gac5a36d2a53e06a75a2b818e6a5cc96a1}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_ec\_sign@{wickr\_crypto\_engine\_ec\_sign}}
\index{wickr\_crypto\_engine\_ec\_sign@{wickr\_crypto\_engine\_ec\_sign}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_ec\_sign}{wickr\_crypto\_engine\_ec\_sign}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__ecdsa__result}{wickr\+\_\+ecdsa\+\_\+result\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+sign) (const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$ec\+\_\+signing\+\_\+key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data\+\_\+to\+\_\+sign, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)}

Sign data using an Elliptic Curve key Data is hashed before signing. This function will calculate ECDSA(\+SHA2(data\+\_\+to\+\_\+sign))


\begin{DoxyParams}{Parameters}
{\em ec\+\_\+signing\+\_\+key} & private signing key to use for the ECDSA algorithm \\
\hline
{\em data\+\_\+to\+\_\+sign} & the data to hash with \textquotesingle{}digest\+\_\+mode\textquotesingle{}, and then sign with \textquotesingle{}ec\+\_\+signing\+\_\+key\textquotesingle{} \\
\hline
{\em digest\+\_\+mode} & the digest mode to use for SHA2 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an ecdsa result containing the output of ECDSA(\+SHA2(data\+\_\+to\+\_\+sign)) or NULL if the \textquotesingle{}ec\+\_\+signing\+\_\+key\textquotesingle{} is not a private key 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gae541acc6433f6f5ffe84382ccd5e4f97}\label{group__wickr__crypto__engine_gae541acc6433f6f5ffe84382ccd5e4f97}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_ec\_verify@{wickr\_crypto\_engine\_ec\_verify}}
\index{wickr\_crypto\_engine\_ec\_verify@{wickr\_crypto\_engine\_ec\_verify}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_ec\_verify}{wickr\_crypto\_engine\_ec\_verify}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+verify) (const \mbox{\hyperlink{structwickr__ecdsa__result}{wickr\+\_\+ecdsa\+\_\+result\+\_\+t}} $\ast$signature, const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$ec\+\_\+public\+\_\+key, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data\+\_\+to\+\_\+verify)}

Verify ECDSA signatures


\begin{DoxyParams}{Parameters}
{\em signature} & a signature produced with \textquotesingle{}wickr\+\_\+crypto\+\_\+engine\+\_\+ec\+\_\+sign\textquotesingle{} \\
\hline
{\em ec\+\_\+public\+\_\+key} & the public signing key to use for verification \\
\hline
{\em data\+\_\+to\+\_\+verify} & the original data that should have been signed with \textquotesingle{}ec\+\_\+public\+\_\+key\textquotesingle{}. It will be hashed inside this function as part of the verification process \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if \textquotesingle{}signature\textquotesingle{} can be verified by \textquotesingle{}ec\+\_\+public\+\_\+key\textquotesingle{} 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gaa77b1bc373d92d9db9d801bcc4a4d29c}\label{group__wickr__crypto__engine_gaa77b1bc373d92d9db9d801bcc4a4d29c}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_encrypt\_file@{wickr\_crypto\_engine\_encrypt\_file}}
\index{wickr\_crypto\_engine\_encrypt\_file@{wickr\_crypto\_engine\_encrypt\_file}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_encrypt\_file}{wickr\_crypto\_engine\_encrypt\_file}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+encrypt\+\_\+file) (const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, const char $\ast$source\+File\+Path, const char $\ast$destination\+File\+Path)}

Encrypt a file


\begin{DoxyParams}{Parameters}
{\em in\+\_\+file} & the file to encrypt \\
\hline
{\em key} & the key to use for encryption \\
\hline
{\em out\+\_\+file} & a file that should contain the encrypted data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if encryption succeeds, and \textquotesingle{}out\+\_\+file\textquotesingle{} can be written 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga508c8ee796eb4e5b5881d9ac15f7e1c1}\label{group__wickr__crypto__engine_ga508c8ee796eb4e5b5881d9ac15f7e1c1}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_encrypt\_ofile@{wickr\_crypto\_engine\_encrypt\_ofile}}
\index{wickr\_crypto\_engine\_encrypt\_ofile@{wickr\_crypto\_engine\_encrypt\_ofile}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_encrypt\_ofile}{wickr\_crypto\_engine\_encrypt\_ofile}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+encrypt\+\_\+ofile) (FILE $\ast$fin, const \mbox{\hyperlink{structwickr__cipher__key}{wickr\+\_\+cipher\+\_\+key\+\_\+t}} $\ast$key, FILE $\ast$fout)}

Encrypt an open file


\begin{DoxyParams}{Parameters}
{\em fin} & read data to be encrypted from this FILE pointer \\
\hline
{\em key} & the key to use for decryption \\
\hline
{\em fout} & write encrypted data to this FILE pointer \\
\hline
{\em only\+\_\+auth\+\_\+ciphers} & if true, only authenticated ciphers may be used for decryption \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if the decryption operation succeeds 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_gab624f62e1d434c5b8222eabd656feb48}\label{group__wickr__crypto__engine_gab624f62e1d434c5b8222eabd656feb48}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_gen\_shared\_secret@{wickr\_crypto\_engine\_gen\_shared\_secret}}
\index{wickr\_crypto\_engine\_gen\_shared\_secret@{wickr\_crypto\_engine\_gen\_shared\_secret}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_gen\_shared\_secret}{wickr\_crypto\_engine\_gen\_shared\_secret}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+gen\+\_\+shared\+\_\+secret) (const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$local, const \mbox{\hyperlink{structwickr__ec__key}{wickr\+\_\+ec\+\_\+key\+\_\+t}} $\ast$peer)}

Generate a shared secret given Elliptic Curve Diffie-\/\+Hellman parameters


\begin{DoxyParams}{Parameters}
{\em local} & the local elliptic curve private key \\
\hline
{\em peer} & the remote elliptic curve public key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing the shared secret computed with \textquotesingle{}local\textquotesingle{} private key and \textquotesingle{}peer\textquotesingle{} public key 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga782e0e8786ecf8a55c8ae2aea2f178aa}\label{group__wickr__crypto__engine_ga782e0e8786ecf8a55c8ae2aea2f178aa}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_hmac\_create@{wickr\_crypto\_engine\_hmac\_create}}
\index{wickr\_crypto\_engine\_hmac\_create@{wickr\_crypto\_engine\_hmac\_create}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_hmac\_create}{wickr\_crypto\_engine\_hmac\_create}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+hmac\+\_\+create) (const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$hmac\+\_\+key, \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} digest\+\_\+mode)}

Generate an HMAC


\begin{DoxyParams}{Parameters}
{\em data} & the data to take the HMAC of \\
\hline
{\em hmac\+\_\+key} & a key to use for HMAC \\
\hline
{\em mode} & the digest mode to perform HMAC with. This will determine the length of the output \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer containing the HMAC of \textquotesingle{}data\textquotesingle{} with \textquotesingle{}hmac\+\_\+key\textquotesingle{} 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga00c52a816403192af5b21d952265d0b6}\label{group__wickr__crypto__engine_ga00c52a816403192af5b21d952265d0b6}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_engine\_hmac\_verify@{wickr\_crypto\_engine\_hmac\_verify}}
\index{wickr\_crypto\_engine\_hmac\_verify@{wickr\_crypto\_engine\_hmac\_verify}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_engine\_hmac\_verify}{wickr\_crypto\_engine\_hmac\_verify}}
{\footnotesize\ttfamily bool($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+engine\+\_\+hmac\+\_\+verify) (const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$data, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$hmac\+\_\+key, const \mbox{\hyperlink{structwickr__digest}{wickr\+\_\+digest\+\_\+t}} mode, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$expected)}

Verify an HMAC against an expected result


\begin{DoxyParams}{Parameters}
{\em data} & the data to calculate the expected HMAC with \\
\hline
{\em hmac\+\_\+key} & the key to use along with \textquotesingle{}data\textquotesingle{} to create the expected HMAC with \\
\hline
{\em mode} & the mode to use for generating the expected HMAC \\
\hline
{\em expected} & the value to compare the generated HMAC with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if \textquotesingle{}expected\textquotesingle{} is equal to the HMAC of \textquotesingle{}data\textquotesingle{} and \textquotesingle{}hmac\+\_\+key\textquotesingle{} 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga5ab29968c993423df83c9f1a3d7e685d}\label{group__wickr__crypto__engine_ga5ab29968c993423df83c9f1a3d7e685d}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_kdf\_gen@{wickr\_crypto\_kdf\_gen}}
\index{wickr\_crypto\_kdf\_gen@{wickr\_crypto\_kdf\_gen}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_kdf\_gen}{wickr\_crypto\_kdf\_gen}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__kdf__result}{wickr\+\_\+kdf\+\_\+result\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+kdf\+\_\+gen) (\mbox{\hyperlink{structwickr__kdf__algo}{wickr\+\_\+kdf\+\_\+algo\+\_\+t}} algo, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)}

Execute a KDF function given an input buffer


\begin{DoxyParams}{Parameters}
{\em algo} & the algorithm info to use for execution of the KDF \\
\hline
{\em passphrase} & bytes to use as input to the KDF function. There are no restrictions for the content of the buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the output of the KDF function, including the generated random salt that was used for the computation 
\end{DoxyReturn}
\mbox{\Hypertarget{group__wickr__crypto__engine_ga640cbc86ca36c4deb2c197de89dce7d1}\label{group__wickr__crypto__engine_ga640cbc86ca36c4deb2c197de89dce7d1}} 
\index{Wickr\_crypto\_engine@{Wickr\_crypto\_engine}!wickr\_crypto\_kdf\_meta@{wickr\_crypto\_kdf\_meta}}
\index{wickr\_crypto\_kdf\_meta@{wickr\_crypto\_kdf\_meta}!Wickr\_crypto\_engine@{Wickr\_crypto\_engine}}
\doxysubsubsection{\texorpdfstring{wickr\_crypto\_kdf\_meta}{wickr\_crypto\_kdf\_meta}}
{\footnotesize\ttfamily \mbox{\hyperlink{structwickr__kdf__result}{wickr\+\_\+kdf\+\_\+result\+\_\+t}}$\ast$($\ast$ wickr\+\_\+crypto\+\_\+engine\+::wickr\+\_\+crypto\+\_\+kdf\+\_\+meta) (const \mbox{\hyperlink{structwickr__kdf__meta}{wickr\+\_\+kdf\+\_\+meta\+\_\+t}} $\ast$existing\+\_\+meta, const \mbox{\hyperlink{structwickr__buffer}{wickr\+\_\+buffer\+\_\+t}} $\ast$passphrase)}

Execute a KDF function given an input buffer and specified parameters


\begin{DoxyParams}{Parameters}
{\em existing\+\_\+meta} & the parameters to use for execution, including a specific salt \\
\hline
{\em passphrase} & bytes to use as input to the KDF function. There are no restrictions for the content of the buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the output of the KDF function, including the generated random salt that was used for the computation 
\end{DoxyReturn}
