\hypertarget{class_qore_1_1_s_s_l_private_key}{}\section{Qore\+:\+:S\+S\+L\+Private\+Key Class Reference}
\label{class_qore_1_1_s_s_l_private_key}\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}


This class implements a container for private key data.  




Inheritance diagram for Qore\+:\+:S\+S\+L\+Private\+Key\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=196pt]{class_qore_1_1_s_s_l_private_key__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_affdb0026e65213516c7d088074d1aec2}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pem, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass)
\begin{DoxyCompactList}\small\item\em Creates the \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{S\+S\+L\+Private\+Key}} object from the P\+E\+M-\/encoded text representation of the private key passed. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a7310bce372479a38a90dbc521710256e}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} der)
\begin{DoxyCompactList}\small\item\em Creates the \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{S\+S\+L\+Private\+Key}} object from the data argument passed. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_abc635ed38e5d73865bbc356267b6d26e}{copy}} ()
\begin{DoxyCompactList}\small\item\em Returns a copy of the private key object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_aa21b2182522c30d4ce8fdd31479f946e}{get\+Bit\+Length}} ()
\begin{DoxyCompactList}\small\item\em Returns the bit length of the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_af6efb915453871f442bed6554a30b156}{get\+D\+ER}} ()
\begin{DoxyCompactList}\small\item\em Returns a binary object in D\+ER format representing the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a80eea3bfa8f7b8b34bce84b1667d9106}{get\+Info}} ()
\begin{DoxyCompactList}\small\item\em Returns a hash of all information for the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a9e95fdac083338d89e1806a4409e6e22}{get\+P\+EM}} ()
\begin{DoxyCompactList}\small\item\em Returns a string in P\+EM format representing the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_ab6a45cf567fddcc9c36e7d0fe2b956fb}{get\+Type}} ()
\begin{DoxyCompactList}\small\item\em Returns a string giving the algorithm used for the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a61566e34227646a2d1a6a992f5aeb994}{get\+Version}} ()
\begin{DoxyCompactList}\small\item\em Returns a constant value of 1; do not use; only included for backwards-\/compatibility. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
This class implements a container for private key data. 

The \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{S\+S\+L\+Private\+Key}} class supports \mbox{\hyperlink{class_qore_1_1_serializable}{data serialization}}; note that the serialized data is a representation of the data that does not require a password, so for source data that requires a password to use, the serialized representation of the private key should be protected carefully (transmitted only in an encrypted stream) 

\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_affdb0026e65213516c7d088074d1aec2}\label{class_qore_1_1_s_s_l_private_key_affdb0026e65213516c7d088074d1aec2}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Qore\+::\+S\+S\+L\+Private\+Key\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pem,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass }\end{DoxyParamCaption})}



Creates the \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{S\+S\+L\+Private\+Key}} object from the P\+E\+M-\/encoded text representation of the private key passed. 


\begin{DoxyParams}{Parameters}
{\em pem} & The P\+E\+M-\/encoded text representation of the private key \\
\hline
{\em pass} & The optional password or passphrase for the private key\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
SSLPrivateKey key(pem);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+S\+L\+P\+R\+I\+V\+A\+T\+E\+K\+E\+Y-\/\+C\+O\+N\+S\+T\+R\+U\+C\+T\+O\+R-\/\+E\+R\+R\+OR} & error in private key data\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
0.\+8.\+4\+: the deprecated functionality where the if the string passed was less than 200 bytes long, it was assumed to be a file name has been removed; the string is assumed to be the P\+E\+M-\/encoded private key itself 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_a7310bce372479a38a90dbc521710256e}\label{class_qore_1_1_s_s_l_private_key_a7310bce372479a38a90dbc521710256e}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Qore\+::\+S\+S\+L\+Private\+Key\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{der }\end{DoxyParamCaption})}



Creates the \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{S\+S\+L\+Private\+Key}} object from the data argument passed. 


\begin{DoxyParams}{Parameters}
{\em der} & The D\+E\+R-\/encoded binary representation of the private key\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
SSLPrivateKey key(der);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+S\+L\+P\+R\+I\+V\+A\+T\+E\+K\+E\+Y-\/\+C\+O\+N\+S\+T\+R\+U\+C\+T\+O\+R-\/\+E\+R\+R\+OR} & error in private key data \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_abc635ed38e5d73865bbc356267b6d26e}\label{class_qore_1_1_s_s_l_private_key_abc635ed38e5d73865bbc356267b6d26e}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!copy@{copy}}
\index{copy@{copy}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+S\+S\+L\+Private\+Key\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a copy of the private key object. 

\begin{DoxySince}{Since}
Qore 0.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_aa21b2182522c30d4ce8fdd31479f946e}\label{class_qore_1_1_s_s_l_private_key_aa21b2182522c30d4ce8fdd31479f946e}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+Bit\+Length@{get\+Bit\+Length}}
\index{get\+Bit\+Length@{get\+Bit\+Length}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+Bit\+Length()}{getBitLength()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+S\+L\+Private\+Key\+::get\+Bit\+Length (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the bit length of the private key. 

\begin{DoxyReturn}{Returns}
the bit length of the private key
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
int len = key.getBitLength();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_af6efb915453871f442bed6554a30b156}\label{class_qore_1_1_s_s_l_private_key_af6efb915453871f442bed6554a30b156}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+D\+ER@{get\+D\+ER}}
\index{get\+D\+ER@{get\+D\+ER}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+D\+E\+R()}{getDER()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+S\+S\+L\+Private\+Key\+::get\+D\+ER (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a binary object in D\+ER format representing the private key. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
binary der = key.getDER();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a binary object in D\+ER format representing the private key
\end{DoxyReturn}
\begin{DoxyNote}{Note}
No password is required to use the D\+ER data produced even if the object was originally created with a password
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em S\+S\+L\+P\+R\+I\+V\+A\+T\+E\+K\+E\+Y-\/\+E\+R\+R\+OR} & could not create D\+ER data from private key data\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_a80eea3bfa8f7b8b34bce84b1667d9106}\label{class_qore_1_1_s_s_l_private_key_a80eea3bfa8f7b8b34bce84b1667d9106}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+Info@{get\+Info}}
\index{get\+Info@{get\+Info}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+Info()}{getInfo()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+S\+S\+L\+Private\+Key\+::get\+Info (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a hash of all information for the private key. 

\begin{DoxyReturn}{Returns}
a hash of all information for the private key with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}type\char`\"{}}\+: The type of private key (see \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_ab6a45cf567fddcc9c36e7d0fe2b956fb}{S\+S\+L\+Private\+Key\+::get\+Type()}})
\item {\ttfamily \char`\"{}version\char`\"{}}\+: The version of the private key (see \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a61566e34227646a2d1a6a992f5aeb994}{S\+S\+L\+Private\+Key\+::get\+Version()}})
\item {\ttfamily \char`\"{}bit\+Length\char`\"{}}\+: The bit length of the private key (see \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_aa21b2182522c30d4ce8fdd31479f946e}{S\+S\+L\+Private\+Key\+::get\+Bit\+Length()}})
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
hash<auto> h = key.getInfo();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_a9e95fdac083338d89e1806a4409e6e22}\label{class_qore_1_1_s_s_l_private_key_a9e95fdac083338d89e1806a4409e6e22}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+P\+EM@{get\+P\+EM}}
\index{get\+P\+EM@{get\+P\+EM}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+P\+E\+M()}{getPEM()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+S\+L\+Private\+Key\+::get\+P\+EM (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a string in P\+EM format representing the private key. 

\begin{DoxyReturn}{Returns}
a string in P\+EM format representing the private key
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
string pem = key.getPEM();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
No password is required to use the P\+EM data produced even if the object was originally created with a password
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em S\+S\+L\+P\+R\+I\+V\+A\+T\+E\+K\+E\+Y-\/\+E\+R\+R\+OR} & could not create P\+EM string from private key data \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_ab6a45cf567fddcc9c36e7d0fe2b956fb}\label{class_qore_1_1_s_s_l_private_key_ab6a45cf567fddcc9c36e7d0fe2b956fb}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+Type@{get\+Type}}
\index{get\+Type@{get\+Type}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+Type()}{getType()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+S\+L\+Private\+Key\+::get\+Type (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a string giving the algorithm used for the private key. 

\begin{DoxyReturn}{Returns}
a string giving the algorithm used for the private key (ex\+: {\ttfamily \char`\"{}\+R\+S\+A\char`\"{}}, {\ttfamily \char`\"{}\+R\+S\+A2\char`\"{}}, {\ttfamily \char`\"{}\+D\+S\+A\char`\"{}}, {\ttfamily \char`\"{}\+D\+S\+A1\char`\"{}}, {\ttfamily \char`\"{}\+D\+S\+A2\char`\"{}}, {\ttfamily \char`\"{}\+D\+A\+S3\char`\"{}}, {\ttfamily \char`\"{}\+D\+A\+S4\char`\"{}}, {\ttfamily \char`\"{}\+D\+H\char`\"{}}, {\ttfamily \char`\"{}unknown\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
string str = pkey.getType();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_s_l_private_key_a61566e34227646a2d1a6a992f5aeb994}\label{class_qore_1_1_s_s_l_private_key_a61566e34227646a2d1a6a992f5aeb994}} 
\index{Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}!get\+Version@{get\+Version}}
\index{get\+Version@{get\+Version}!Qore\+::\+S\+S\+L\+Private\+Key@{Qore\+::\+S\+S\+L\+Private\+Key}}
\subsubsection{\texorpdfstring{get\+Version()}{getVersion()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+S\+L\+Private\+Key\+::get\+Version (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a constant value of 1; do not use; only included for backwards-\/compatibility. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
The openssl library never put any usable value into the internal fields that were used to provide this information; newer versions of openssl do not expose this information at all, therefore this method now returns a constant value of 1 for backwards-\/compatibility.

\begin{DoxyReturn}{Returns}
a constant value of 1; do not use; only included for backwards-\/compatibility 
\end{DoxyReturn}
