\hypertarget{class_qore_1_1_s_s_l_private_key}{}\doxysection{Qore\+::SSLPrivate\+Key Class Reference}
\label{class_qore_1_1_s_s_l_private_key}\index{Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}


This class implements a container for private key data.  




{\ttfamily \#include $<$QC\+\_\+\+SSLPrivate\+Key.\+dox.\+h$>$}



Inheritance diagram for Qore\+::SSLPrivate\+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}
\doxysubsection*{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}{SSLPrivate\+Key}} object from the PEM-\/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}{SSLPrivate\+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\+DER}} ()
\begin{DoxyCompactList}\small\item\em Returns a binary object in DER format representing the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key_a48582611b851d268dafd0feb9b00d159}{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\+PEM}} ()
\begin{DoxyCompactList}\small\item\em Returns a string in PEM 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}
\doxysubsection*{Additional Inherited Members}


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

The \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+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) 

\doxysubsection{Member Function Documentation}
\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::SSLPrivateKey@{Qore::SSLPrivateKey}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Qore\+::\+SSLPrivate\+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}{SSLPrivate\+Key}} object from the data argument passed. 


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

\begin{DoxyCode}{0}
\DoxyCodeLine{SSLPrivateKey key(der);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em SSLPRIVATEKEY-\/\+CONSTRUCTOR-\/\+ERROR} & error in private key data \\
\hline
\end{DoxyExceptions}
\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::SSLPrivateKey@{Qore::SSLPrivateKey}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Qore\+::\+SSLPrivate\+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}{SSLPrivate\+Key}} object from the PEM-\/encoded text representation of the private key passed. 


\begin{DoxyParams}{Parameters}
{\em pem} & The PEM-\/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}{0}
\DoxyCodeLine{SSLPrivateKey key(pem);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em SSLPRIVATEKEY-\/\+CONSTRUCTOR-\/\+ERROR} & 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 PEM-\/encoded private key itself 
\end{DoxySince}
\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::SSLPrivateKey@{Qore::SSLPrivateKey}!copy@{copy}}
\index{copy@{copy}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+SSLPrivate\+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::SSLPrivateKey@{Qore::SSLPrivateKey}!getBitLength@{getBitLength}}
\index{getBitLength@{getBitLength}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getBitLength()}{getBitLength()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+SSLPrivate\+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}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{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::SSLPrivateKey@{Qore::SSLPrivateKey}!getDER@{getDER}}
\index{getDER@{getDER}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getDER()}{getDER()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+SSLPrivate\+Key\+::get\+DER (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a binary object in DER format representing the private key. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyCode}

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

\begin{DoxyExceptions}{Exceptions}
{\em SSLPRIVATEKEY-\/\+ERROR} & could not create DER 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_a48582611b851d268dafd0feb9b00d159}\label{class_qore_1_1_s_s_l_private_key_a48582611b851d268dafd0feb9b00d159}} 
\index{Qore::SSLPrivateKey@{Qore::SSLPrivateKey}!getInfo@{getInfo}}
\index{getInfo@{getInfo}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getInfo()}{getInfo()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+SSLPrivate\+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}{SSLPrivate\+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}{SSLPrivate\+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}{SSLPrivate\+Key\+::get\+Bit\+Length()}})
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{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::SSLPrivateKey@{Qore::SSLPrivateKey}!getPEM@{getPEM}}
\index{getPEM@{getPEM}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getPEM()}{getPEM()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+SSLPrivate\+Key\+::get\+PEM (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a string in PEM format representing the private key. 

\begin{DoxyReturn}{Returns}
a string in PEM format representing the private key
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyCode}

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

\begin{DoxyExceptions}{Exceptions}
{\em SSLPRIVATEKEY-\/\+ERROR} & could not create PEM 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::SSLPrivateKey@{Qore::SSLPrivateKey}!getType@{getType}}
\index{getType@{getType}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getType()}{getType()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+SSLPrivate\+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`\"{}\+RSA\char`\"{}}, {\ttfamily \char`\"{}\+RSA2\char`\"{}}, {\ttfamily \char`\"{}\+DSA\char`\"{}}, {\ttfamily \char`\"{}\+DSA1\char`\"{}}, {\ttfamily \char`\"{}\+DSA2\char`\"{}}, {\ttfamily \char`\"{}\+DAS3\char`\"{}}, {\ttfamily \char`\"{}\+DAS4\char`\"{}}, {\ttfamily \char`\"{}\+DH\char`\"{}}, {\ttfamily \char`\"{}unknown\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{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::SSLPrivateKey@{Qore::SSLPrivateKey}!getVersion@{getVersion}}
\index{getVersion@{getVersion}!Qore::SSLPrivateKey@{Qore::SSLPrivateKey}}
\doxysubsubsection{\texorpdfstring{getVersion()}{getVersion()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+SSLPrivate\+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}{CONSTANT}}
\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}
