\hypertarget{group__Eet__Cipher__Group}{\section{Cipher, Identity and Protection Mechanisms}
\label{group__Eet__Cipher__Group}\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
}


Eet allows one to protect entries of an \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} individually.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{typedef struct \-\_\-\-Eet\-\_\-\-Key \hyperlink{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{Eet\-\_\-\-Key}}\label{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}

\begin{DoxyCompactList}\small\item\em Opaque handle that defines an identity (also known as key) in Eet's cipher system. \end{DoxyCompactList}\item 
typedef int($\ast$ \hyperlink{group__Eet__Cipher__Group_ga874d97b532dbdc0a14bf12aa9a5202d5}{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback} )(char $\ast$buffer, int size, int rwflag, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Callback used to request if needed the password of a private key. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} \hyperlink{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{Eet\-\_\-\-Key} $\ast$ \hyperlink{group__Eet__Cipher__Group_gae8be5ad35c585cdf5034309bc97f1af8}{eet\-\_\-identity\-\_\-open} (const char $\ast$certificate\-\_\-file, const char $\ast$private\-\_\-key\-\_\-file, \hyperlink{group__Eet__Cipher__Group_ga874d97b532dbdc0a14bf12aa9a5202d5}{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback} cb)
\begin{DoxyCompactList}\small\item\em Create an Eet\-\_\-\-Key needed for signing an eet file. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} void \hyperlink{group__Eet__Cipher__Group_gaa8b2e329d0ecdb55b564e1aa70ba557f}{eet\-\_\-identity\-\_\-close} (\hyperlink{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{Eet\-\_\-\-Key} $\ast$key)
\begin{DoxyCompactList}\small\item\em Close and release all resource used by an Eet\-\_\-\-Key. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} \hyperlink{group__Eet__Group_gab002b16c58e2a62fc7981581647a0092}{Eet\-\_\-\-Error} \hyperlink{group__Eet__Cipher__Group_ga687984e5f508017c01f6d22a203fce16}{eet\-\_\-identity\-\_\-set} (\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} $\ast$ef, \hyperlink{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{Eet\-\_\-\-Key} $\ast$key)
\begin{DoxyCompactList}\small\item\em Set a key to sign a file. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} void \hyperlink{group__Eet__Cipher__Group_ga846b1e0f0f4a1a9c7ab9a4fc55728534}{eet\-\_\-identity\-\_\-print} (\hyperlink{group__Eet__Cipher__Group_gaa958627af70e4ee4c54adba8805da30d}{Eet\-\_\-\-Key} $\ast$key, F\-I\-L\-E $\ast$out)
\begin{DoxyCompactList}\small\item\em Display both private and public key of an Eet\-\_\-\-Key. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} const void $\ast$ \hyperlink{group__Eet__Cipher__Group_ga6f92a1276ed7e87d5a7ba58b7943df7a}{eet\-\_\-identity\-\_\-x509} (\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} $\ast$ef, int $\ast$der\-\_\-length)
\begin{DoxyCompactList}\small\item\em Get the x509 der certificate associated with an Eet\-\_\-\-File. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} const void $\ast$ \hyperlink{group__Eet__Cipher__Group_gacabba4892e4492464fe29309508a8c99}{eet\-\_\-identity\-\_\-signature} (\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} $\ast$ef, int $\ast$signature\-\_\-length)
\begin{DoxyCompactList}\small\item\em Get the raw signature associated with an Eet\-\_\-\-File. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} const void $\ast$ \hyperlink{group__Eet__Cipher__Group_gacb54b5441fc049d52b4e3f212087c8a0}{eet\-\_\-identity\-\_\-sha1} (\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} $\ast$ef, int $\ast$sha1\-\_\-length)
\begin{DoxyCompactList}\small\item\em Get the S\-H\-A1 associated with a file. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3db3556eec8ef18cb8ddb43816974ac8}{E\-A\-P\-I} void \hyperlink{group__Eet__Cipher__Group_ga131e4a43a0ae98dc31a9a642ada33357}{eet\-\_\-identity\-\_\-certificate\-\_\-print} (const unsigned char $\ast$certificate, int der\-\_\-length, F\-I\-L\-E $\ast$out)
\begin{DoxyCompactList}\small\item\em Display the x509 der certificate to out. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Eet allows one to protect entries of an \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\-\_\-\-File} individually. This may be used to ensure data was not tampered or that third party does not read your data.

\begin{DoxySeeAlso}{See Also}
\hyperlink{group__Eet__File__Cipher__Group}{Eet File Ciphered Main Functions} 

\hyperlink{group__Eet__File__Image__Cipher__Group}{Image Store and Load using a Cipher} 
\end{DoxySeeAlso}


\subsection{Typedef Documentation}
\hypertarget{group__Eet__Cipher__Group_ga874d97b532dbdc0a14bf12aa9a5202d5}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback@{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback}}
\index{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback@{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback)(char $\ast$buffer, int size, int rwflag, void $\ast$data)}}\label{group__Eet__Cipher__Group_ga874d97b532dbdc0a14bf12aa9a5202d5}


Callback used to request if needed the password of a private key. 


\begin{DoxyParams}{Parameters}
{\em buffer} & the buffer where to store the password. \\
\hline
{\em size} & the maximum password size (size of buffer, including '\textbackslash{}0'). \\
\hline
{\em rwflag} & if the buffer is also readable or just writable. \\
\hline
{\em data} & currently unused, may contain some context in future. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 on success and password was set to {\ttfamily buffer}, 0 on failure.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}


\subsection{Function Documentation}
\hypertarget{group__Eet__Cipher__Group_gae8be5ad35c585cdf5034309bc97f1af8}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-open@{eet\-\_\-identity\-\_\-open}}
\index{eet\-\_\-identity\-\_\-open@{eet\-\_\-identity\-\_\-open}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-open}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} {\bf Eet\-\_\-\-Key}$\ast$ eet\-\_\-identity\-\_\-open (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{certificate\-\_\-file, }
\item[{const char $\ast$}]{private\-\_\-key\-\_\-file, }
\item[{{\bf Eet\-\_\-\-Key\-\_\-\-Password\-\_\-\-Callback}}]{cb}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_gae8be5ad35c585cdf5034309bc97f1af8}


Create an Eet\-\_\-\-Key needed for signing an eet file. 

The certificate should provide the public that match the private key. No verification is done to ensure that.


\begin{DoxyParams}{Parameters}
{\em certificate\-\_\-file} & The file where to find the certificate. \\
\hline
{\em private\-\_\-key\-\_\-file} & The file that contains the private key. \\
\hline
{\em cb} & Function to callback if password is required to unlock private key. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A key handle to use, or {\ttfamily N\-U\-L\-L} on failure.
\end{DoxyReturn}
\begin{DoxySeeAlso}{See Also}
\hyperlink{group__Eet__Cipher__Group_gaa8b2e329d0ecdb55b564e1aa70ba557f}{eet\-\_\-identity\-\_\-close()}
\end{DoxySeeAlso}
\begin{DoxyWarning}{Warning}
You need to compile signature support in E\-E\-T. 
\end{DoxyWarning}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}


References eina\-\_\-file\-\_\-close(), eina\-\_\-file\-\_\-map\-\_\-all(), eina\-\_\-file\-\_\-map\-\_\-free(), eina\-\_\-file\-\_\-open(), E\-I\-N\-A\-\_\-\-F\-I\-L\-E\-\_\-\-S\-E\-Q\-U\-E\-N\-T\-I\-A\-L, eina\-\_\-file\-\_\-size\-\_\-get(), eina\-\_\-mmap\-\_\-safety\-\_\-enabled\-\_\-set(), and E\-I\-N\-A\-\_\-\-T\-R\-U\-E.

\hypertarget{group__Eet__Cipher__Group_gaa8b2e329d0ecdb55b564e1aa70ba557f}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-close@{eet\-\_\-identity\-\_\-close}}
\index{eet\-\_\-identity\-\_\-close@{eet\-\_\-identity\-\_\-close}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-close}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} void eet\-\_\-identity\-\_\-close (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-Key} $\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_gaa8b2e329d0ecdb55b564e1aa70ba557f}


Close and release all resource used by an Eet\-\_\-\-Key. 

An reference counter prevent it from being freed until all file using it are also closed.


\begin{DoxyParams}{Parameters}
{\em key} & the key handle to close and free resources.\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}
\hypertarget{group__Eet__Cipher__Group_ga687984e5f508017c01f6d22a203fce16}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-set@{eet\-\_\-identity\-\_\-set}}
\index{eet\-\_\-identity\-\_\-set@{eet\-\_\-identity\-\_\-set}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-set}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} {\bf Eet\-\_\-\-Error} eet\-\_\-identity\-\_\-set (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-File} $\ast$}]{ef, }
\item[{{\bf Eet\-\_\-\-Key} $\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_ga687984e5f508017c01f6d22a203fce16}


Set a key to sign a file. 


\begin{DoxyParams}{Parameters}
{\em ef} & the file to set the identity. \\
\hline
{\em key} & the key handle to set as identity. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eet__Group_ggaa9142d865094701672375485d4a6284da624f64fe9803c1a4229a60214d675fa4}{E\-E\-T\-\_\-\-E\-R\-R\-O\-R\-\_\-\-B\-A\-D\-\_\-\-O\-B\-J\-E\-C\-T} if {\ttfamily ef} is invalid or \hyperlink{group__Eet__Group_ggaa9142d865094701672375485d4a6284da2e3af24c66d0decf7c97fe4e5a7f75d4}{E\-E\-T\-\_\-\-E\-R\-R\-O\-R\-\_\-\-N\-O\-N\-E} on success.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}


References E\-E\-T\-\_\-\-E\-R\-R\-O\-R\-\_\-\-B\-A\-D\-\_\-\-O\-B\-J\-E\-C\-T, and E\-E\-T\-\_\-\-E\-R\-R\-O\-R\-\_\-\-N\-O\-N\-E.

\hypertarget{group__Eet__Cipher__Group_ga846b1e0f0f4a1a9c7ab9a4fc55728534}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-print@{eet\-\_\-identity\-\_\-print}}
\index{eet\-\_\-identity\-\_\-print@{eet\-\_\-identity\-\_\-print}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-print}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} void eet\-\_\-identity\-\_\-print (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-Key} $\ast$}]{key, }
\item[{F\-I\-L\-E $\ast$}]{out}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_ga846b1e0f0f4a1a9c7ab9a4fc55728534}


Display both private and public key of an Eet\-\_\-\-Key. 


\begin{DoxyParams}{Parameters}
{\em key} & the handle to print. \\
\hline
{\em out} & where to print.\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
You need to compile signature support in E\-E\-T. 
\end{DoxyWarning}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}
\hypertarget{group__Eet__Cipher__Group_ga6f92a1276ed7e87d5a7ba58b7943df7a}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-x509@{eet\-\_\-identity\-\_\-x509}}
\index{eet\-\_\-identity\-\_\-x509@{eet\-\_\-identity\-\_\-x509}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-x509}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} const void$\ast$ eet\-\_\-identity\-\_\-x509 (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-File} $\ast$}]{ef, }
\item[{int $\ast$}]{der\-\_\-length}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_ga6f92a1276ed7e87d5a7ba58b7943df7a}


Get the x509 der certificate associated with an Eet\-\_\-\-File. 

Will return N\-U\-L\-L if the file is not signed.


\begin{DoxyParams}{Parameters}
{\em ef} & The file handle to query. \\
\hline
{\em der\-\_\-length} & The length of returned data, may be {\ttfamily N\-U\-L\-L}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the x509 certificate or {\ttfamily N\-U\-L\-L} on error.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}
\hypertarget{group__Eet__Cipher__Group_gacabba4892e4492464fe29309508a8c99}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-signature@{eet\-\_\-identity\-\_\-signature}}
\index{eet\-\_\-identity\-\_\-signature@{eet\-\_\-identity\-\_\-signature}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-signature}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} const void$\ast$ eet\-\_\-identity\-\_\-signature (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-File} $\ast$}]{ef, }
\item[{int $\ast$}]{signature\-\_\-length}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_gacabba4892e4492464fe29309508a8c99}


Get the raw signature associated with an Eet\-\_\-\-File. 

Will return N\-U\-L\-L if the file is not signed.


\begin{DoxyParams}{Parameters}
{\em ef} & The file handle to query. \\
\hline
{\em signature\-\_\-length} & The length of returned data, may be {\ttfamily N\-U\-L\-L}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the raw signature or {\ttfamily N\-U\-L\-L} on error. 
\end{DoxyReturn}
\hypertarget{group__Eet__Cipher__Group_gacb54b5441fc049d52b4e3f212087c8a0}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-sha1@{eet\-\_\-identity\-\_\-sha1}}
\index{eet\-\_\-identity\-\_\-sha1@{eet\-\_\-identity\-\_\-sha1}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-sha1}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} const void$\ast$ eet\-\_\-identity\-\_\-sha1 (
\begin{DoxyParamCaption}
\item[{{\bf Eet\-\_\-\-File} $\ast$}]{ef, }
\item[{int $\ast$}]{sha1\-\_\-length}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_gacb54b5441fc049d52b4e3f212087c8a0}


Get the S\-H\-A1 associated with a file. 

Could be the one used to sign the data or if the data where not signed, it will be the S\-H\-A1 of the file.


\begin{DoxyParams}{Parameters}
{\em ef} & The file handle to query. \\
\hline
{\em sha1\-\_\-length} & The length of returned data, may be {\ttfamily N\-U\-L\-L}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the associated S\-H\-A1 or {\ttfamily N\-U\-L\-L} on error.
\end{DoxyReturn}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}
\hypertarget{group__Eet__Cipher__Group_ga131e4a43a0ae98dc31a9a642ada33357}{\index{Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}!eet\-\_\-identity\-\_\-certificate\-\_\-print@{eet\-\_\-identity\-\_\-certificate\-\_\-print}}
\index{eet\-\_\-identity\-\_\-certificate\-\_\-print@{eet\-\_\-identity\-\_\-certificate\-\_\-print}!Cipher, Identity and Protection Mechanisms@{Cipher, Identity and Protection Mechanisms}}
\subsubsection[{eet\-\_\-identity\-\_\-certificate\-\_\-print}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\-A\-P\-I} void eet\-\_\-identity\-\_\-certificate\-\_\-print (
\begin{DoxyParamCaption}
\item[{const unsigned char $\ast$}]{certificate, }
\item[{int}]{der\-\_\-length, }
\item[{F\-I\-L\-E $\ast$}]{out}
\end{DoxyParamCaption}
)}}\label{group__Eet__Cipher__Group_ga131e4a43a0ae98dc31a9a642ada33357}


Display the x509 der certificate to out. 


\begin{DoxyParams}{Parameters}
{\em certificate} & the x509 certificate to print \\
\hline
{\em der\-\_\-length} & The length the certificate. \\
\hline
{\em out} & where to print.\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
You need to compile signature support in E\-E\-T. 
\end{DoxyWarning}
\begin{DoxySince}{Since}
1.\-2.\-0 
\end{DoxySince}
