\hypertarget{GpgGenKeyInfo_8h_source}{}\doxysection{Gpg\+Gen\+Key\+Info.\+h} \label{GpgGenKeyInfo_8h_source}\index{src/core/GpgGenKeyInfo.h@{src/core/GpgGenKeyInfo.h}} \begin{DoxyCode}{0} \DoxyCodeLine{1 } \DoxyCodeLine{29 \textcolor{preprocessor}{\#ifndef GPGFRONTEND\_GPGGENKEYINFO\_H}} \DoxyCodeLine{30 \textcolor{preprocessor}{\#define GPGFRONTEND\_GPGGENKEYINFO\_H}} \DoxyCodeLine{31 } \DoxyCodeLine{32 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{33 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{34 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{35 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{36 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{37 } \DoxyCodeLine{38 \textcolor{preprocessor}{\#include "{}GpgFrontend.h"{}}} \DoxyCodeLine{39 } \DoxyCodeLine{40 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespaceGpgFrontend}{GpgFrontend}} \{} \DoxyCodeLine{41 } \DoxyCodeLine{42 \textcolor{keyword}{class }GPGFRONTEND\_CORE\_EXPORT \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo}{GenKeyInfo}} \{} \DoxyCodeLine{43 \textcolor{keywordtype}{bool} standalone\_ = \textcolor{keyword}{false}; } \DoxyCodeLine{44 \textcolor{keywordtype}{bool} subkey\_ = \textcolor{keyword}{false}; } \DoxyCodeLine{45 std::string name\_; } \DoxyCodeLine{46 std::string email\_; } \DoxyCodeLine{47 std::string comment\_; } \DoxyCodeLine{48 } \DoxyCodeLine{49 std::string algo\_; } \DoxyCodeLine{50 \textcolor{keywordtype}{int} key\_size\_ = 2048;} \DoxyCodeLine{51 boost::posix\_time::ptime expired\_ =} \DoxyCodeLine{52 boost::posix\_time::second\_clock::local\_time() +} \DoxyCodeLine{53 boost::gregorian::years(2); } \DoxyCodeLine{54 \textcolor{keywordtype}{bool} non\_expired\_ = \textcolor{keyword}{false}; } \DoxyCodeLine{55 } \DoxyCodeLine{56 \textcolor{keywordtype}{bool} no\_passphrase\_ = \textcolor{keyword}{false}; } \DoxyCodeLine{57 \textcolor{keywordtype}{bool} allow\_no\_pass\_phrase\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{58 } \DoxyCodeLine{59 \textcolor{keywordtype}{int} suggest\_max\_key\_size\_ = 4096; } \DoxyCodeLine{60 \textcolor{keywordtype}{int} suggest\_size\_addition\_step\_ = 1024; } \DoxyCodeLine{61 \textcolor{keywordtype}{int} suggest\_min\_key\_size\_ = 1024; } \DoxyCodeLine{62 } \DoxyCodeLine{63 std::string passphrase\_; } \DoxyCodeLine{64 } \DoxyCodeLine{65 \textcolor{keyword}{public}:} \DoxyCodeLine{71 \textcolor{keyword}{static} \textcolor{keyword}{const} std::vector \&GetSupportedKeyAlgo();} \DoxyCodeLine{72 } \DoxyCodeLine{78 \textcolor{keyword}{static} \textcolor{keyword}{const} std::vector \&GetSupportedSubkeyAlgo();} \DoxyCodeLine{79 } \DoxyCodeLine{85 \textcolor{keyword}{static} \textcolor{keyword}{const} std::vector \&GetSupportedKeyAlgoStandalone();} \DoxyCodeLine{86 } \DoxyCodeLine{92 \textcolor{keyword}{static} \textcolor{keyword}{const} std::vector \&GetSupportedSubkeyAlgoStandalone();} \DoxyCodeLine{93 } \DoxyCodeLine{100 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a40a42ad975499566de124296c19e6c55}{IsSubKey}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} subkey\_; \}} \DoxyCodeLine{101 } \DoxyCodeLine{107 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_acd9f7742b739e1db60bd50489690dec1}{SetIsSubKey}}(\textcolor{keywordtype}{bool} m\_sub\_key) \{ GenKeyInfo::subkey\_ = m\_sub\_key; \}} \DoxyCodeLine{108 } \DoxyCodeLine{114 [[nodiscard]] std::string \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a4ee4a0659e76376d9bfc527c334392e1}{GetUserid}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{115 \textcolor{keyword}{auto} uid\_format = boost::format(\textcolor{stringliteral}{"{}\%1\%(\%2\%)<\%3\%>"{}}) \% this-\/>name\_ \%} \DoxyCodeLine{116 this-\/>comment\_ \% this-\/>email\_;} \DoxyCodeLine{117 \textcolor{keywordflow}{return} uid\_format.str();} \DoxyCodeLine{118 \}} \DoxyCodeLine{119 } \DoxyCodeLine{125 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a65ebc487e0e64c325f65474c812615f7}{SetName}}(\textcolor{keyword}{const} std::string \&m\_name) \{ this-\/>name\_ = m\_name; \}} \DoxyCodeLine{126 } \DoxyCodeLine{132 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a656c81d56f77350184f9a94db1a3ce05}{SetEmail}}(\textcolor{keyword}{const} std::string \&m\_email) \{ this-\/>email\_ = m\_email; \}} \DoxyCodeLine{133 } \DoxyCodeLine{139 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a947886456f5699241b1c1b9332e4b29e}{SetComment}}(\textcolor{keyword}{const} std::string \&m\_comment) \{ this-\/>comment\_ = m\_comment; \}} \DoxyCodeLine{140 } \DoxyCodeLine{146 [[nodiscard]] std::string \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_abb3e1366dca0288bdc42123e55d77335}{GetName}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} name\_; \}} \DoxyCodeLine{147 } \DoxyCodeLine{153 [[nodiscard]] std::string \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a76721be08c18907762ba6f6ccc4afc8a}{GetEmail}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} email\_; \}} \DoxyCodeLine{154 } \DoxyCodeLine{160 [[nodiscard]] std::string \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ab9f9775fd6363fba372bd0bcc2532892}{GetComment}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} comment\_; \}} \DoxyCodeLine{161 } \DoxyCodeLine{167 [[nodiscard]] \textcolor{keyword}{const} std::string \&\mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a93bad2a1ef8269f46f044bf3405c7838}{GetAlgo}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} algo\_; \}} \DoxyCodeLine{168 } \DoxyCodeLine{174 \textcolor{keywordtype}{void} SetAlgo(\textcolor{keyword}{const} std::string \&m\_algo);} \DoxyCodeLine{175 } \DoxyCodeLine{181 [[nodiscard]] std::string GetKeySizeStr() \textcolor{keyword}{const};} \DoxyCodeLine{182 } \DoxyCodeLine{188 [[nodiscard]] \textcolor{keywordtype}{int} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a4927a9091fa2b2f68f6b60ce78ab2fe9}{GetKeyLength}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} key\_size\_; \}} \DoxyCodeLine{189 } \DoxyCodeLine{195 \textcolor{keywordtype}{void} SetKeyLength(\textcolor{keywordtype}{int} m\_key\_size);} \DoxyCodeLine{196 } \DoxyCodeLine{202 [[nodiscard]] \textcolor{keyword}{const} boost::posix\_time::ptime \&\mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a5ef495960bc09d1ab2a983f322a3d636}{GetExpireTime}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{203 \textcolor{keywordflow}{return} expired\_;} \DoxyCodeLine{204 \}} \DoxyCodeLine{205 } \DoxyCodeLine{211 \textcolor{keywordtype}{void} SetExpireTime(\textcolor{keyword}{const} boost::posix\_time::ptime \&m\_expired);} \DoxyCodeLine{212 } \DoxyCodeLine{219 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_aeef7697c91b5b5998088979e09332380}{IsNonExpired}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} non\_expired\_; \}} \DoxyCodeLine{220 } \DoxyCodeLine{226 \textcolor{keywordtype}{void} SetNonExpired(\textcolor{keywordtype}{bool} m\_non\_expired);} \DoxyCodeLine{227 } \DoxyCodeLine{234 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a848181796a99bec8d32dc5eac240ee01}{IsNoPassPhrase}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} this-\/>no\_passphrase\_; \}} \DoxyCodeLine{235 } \DoxyCodeLine{241 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a864407216cbdbef9e7b35e6be694d3ef}{SetNonPassPhrase}}(\textcolor{keywordtype}{bool} m\_non\_pass\_phrase) \{} \DoxyCodeLine{242 GenKeyInfo::no\_passphrase\_ = m\_non\_pass\_phrase;} \DoxyCodeLine{243 \}} \DoxyCodeLine{244 } \DoxyCodeLine{251 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ad972292c408cb83c08e739327795a5f0}{IsAllowSigning}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} allow\_signing\_; \}} \DoxyCodeLine{252 } \DoxyCodeLine{259 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_af6a79124a4571ff7f37c1c5e6c1a9415}{IsAllowNoPassPhrase}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{260 \textcolor{keywordflow}{return} allow\_no\_pass\_phrase\_;} \DoxyCodeLine{261 \}} \DoxyCodeLine{262 } \DoxyCodeLine{268 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a1a01518b24d40d95e187ef73f4dcd52a}{SetAllowSigning}}(\textcolor{keywordtype}{bool} m\_allow\_signing) \{} \DoxyCodeLine{269 \textcolor{keywordflow}{if} (allow\_change\_signing\_) GenKeyInfo::allow\_signing\_ = m\_allow\_signing;} \DoxyCodeLine{270 \}} \DoxyCodeLine{271 } \DoxyCodeLine{278 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a28ed8a65243e5bc69403305752c2cdc9}{IsAllowEncryption}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} allow\_encryption\_; \}} \DoxyCodeLine{279 } \DoxyCodeLine{285 \textcolor{keywordtype}{void} SetAllowEncryption(\textcolor{keywordtype}{bool} m\_allow\_encryption);} \DoxyCodeLine{286 } \DoxyCodeLine{293 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ad47ceeb1ccfa8862843034e51b4d8be7}{IsAllowCertification}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{294 \textcolor{keywordflow}{return} allow\_certification\_;} \DoxyCodeLine{295 \}} \DoxyCodeLine{296 } \DoxyCodeLine{302 \textcolor{keywordtype}{void} SetAllowCertification(\textcolor{keywordtype}{bool} m\_allow\_certification);} \DoxyCodeLine{303 } \DoxyCodeLine{310 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_aabdf981c65a0efde1e8905441b9b9c87}{IsAllowAuthentication}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{311 \textcolor{keywordflow}{return} allow\_authentication\_;} \DoxyCodeLine{312 \}} \DoxyCodeLine{313 } \DoxyCodeLine{319 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_aac51d251682ed1bc1090416ebfeba4de}{SetAllowAuthentication}}(\textcolor{keywordtype}{bool} m\_allow\_authentication) \{} \DoxyCodeLine{320 \textcolor{keywordflow}{if} (allow\_change\_authentication\_)} \DoxyCodeLine{321 GenKeyInfo::allow\_authentication\_ = m\_allow\_authentication;} \DoxyCodeLine{322 \}} \DoxyCodeLine{323 } \DoxyCodeLine{329 [[nodiscard]] \textcolor{keyword}{const} std::string \&\mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a82dcaf06e99d877e7b934108293e2f8a}{GetPassPhrase}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} passphrase\_; \}} \DoxyCodeLine{330 } \DoxyCodeLine{336 \textcolor{keywordtype}{void} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_afe1760d4ead397f6096925290a38e1a4}{SetPassPhrase}}(\textcolor{keyword}{const} std::string \&m\_pass\_phrase) \{} \DoxyCodeLine{337 GenKeyInfo::passphrase\_ = m\_pass\_phrase;} \DoxyCodeLine{338 \}} \DoxyCodeLine{339 } \DoxyCodeLine{346 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a06f95a8d26da79bcbe7d51e266879a94}{IsAllowChangeSigning}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{347 \textcolor{keywordflow}{return} allow\_change\_signing\_;} \DoxyCodeLine{348 \}} \DoxyCodeLine{349 } \DoxyCodeLine{356 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ad04a906300bea028c6fb6b1b2da1d149}{IsAllowChangeEncryption}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{357 \textcolor{keywordflow}{return} allow\_change\_encryption\_;} \DoxyCodeLine{358 \}} \DoxyCodeLine{359 } \DoxyCodeLine{366 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_adbcddd0fa0a273f9b77fe1297633dabc}{IsAllowChangeCertification}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{367 \textcolor{keywordflow}{return} allow\_change\_certification\_;} \DoxyCodeLine{368 \}} \DoxyCodeLine{369 } \DoxyCodeLine{376 [[nodiscard]] \textcolor{keywordtype}{bool} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_aaf8ab7c6564a2836837a537111d6f5b4}{IsAllowChangeAuthentication}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{377 \textcolor{keywordflow}{return} allow\_change\_authentication\_;} \DoxyCodeLine{378 \}} \DoxyCodeLine{379 } \DoxyCodeLine{385 [[nodiscard]] \textcolor{keywordtype}{int} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ae461a553176ad1ab0c1121ea6de6c8c2}{GetSuggestMaxKeySize}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{386 \textcolor{keywordflow}{return} suggest\_max\_key\_size\_;} \DoxyCodeLine{387 \}} \DoxyCodeLine{388 } \DoxyCodeLine{394 [[nodiscard]] \textcolor{keywordtype}{int} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_a0b1612421148b86919b7130ed148ca51}{GetSuggestMinKeySize}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{395 \textcolor{keywordflow}{return} suggest\_min\_key\_size\_;} \DoxyCodeLine{396 \}} \DoxyCodeLine{397 } \DoxyCodeLine{403 [[nodiscard]] \textcolor{keywordtype}{int} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo_ac211a7a615805ae97ff284b46abfeab7}{GetSizeChangeStep}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{404 \textcolor{keywordflow}{return} suggest\_size\_addition\_step\_;} \DoxyCodeLine{405 \}} \DoxyCodeLine{406 } \DoxyCodeLine{407 \textcolor{keyword}{private}:} \DoxyCodeLine{408 \textcolor{keywordtype}{bool} allow\_encryption\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{409 \textcolor{keywordtype}{bool} allow\_change\_encryption\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{410 \textcolor{keywordtype}{bool} allow\_certification\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{411 \textcolor{keywordtype}{bool} allow\_change\_certification\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{412 \textcolor{keywordtype}{bool} allow\_authentication\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{413 \textcolor{keywordtype}{bool} allow\_change\_authentication\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{414 \textcolor{keywordtype}{bool} allow\_signing\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{415 \textcolor{keywordtype}{bool} allow\_change\_signing\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{416 } \DoxyCodeLine{421 \textcolor{keywordtype}{void} reset\_options();} \DoxyCodeLine{422 } \DoxyCodeLine{423 \textcolor{keyword}{public}:} \DoxyCodeLine{430 \textcolor{keyword}{explicit} \mbox{\hyperlink{classGpgFrontend_1_1GenKeyInfo}{GenKeyInfo}}(\textcolor{keywordtype}{bool} m\_is\_sub\_key = \textcolor{keyword}{false}, \textcolor{keywordtype}{bool} m\_standalone = \textcolor{keyword}{false});} \DoxyCodeLine{431 \};} \DoxyCodeLine{432 } \DoxyCodeLine{433 \} \textcolor{comment}{// namespace GpgFrontend}} \DoxyCodeLine{434 } \DoxyCodeLine{435 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// GPGFRONTEND\_GPGGENKEYINFO\_H}} \end{DoxyCode}