Boost C++ Libraries: Ticket #4294: boost::asio::context_base should not depend on OpenSSL Types https://svn.boost.org/trac10/ticket/4294 <p> For the moment boost::asio::context_base depends on OpenSSL types. </p> <p> But implementation details should go to context service impl. </p> <p> Indeed, if one want to implement a backend based on GnuTLS (or another), this implies that contect_base and then ssl::basic_context template can't be used to use another thing than OpenSSL. </p> <p> context_base should look something like this : </p> <p> class context_base { public: </p> <blockquote> <p> <em>/ Different methods supported by a context. enum methods { </em></p> <blockquote> <p> <em>/ Client method client, </em>/ Server method server, <em>/ Generic SSL version 2. ssl_2, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ Generic SSL version 3. ssl_3, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ Generic TLS version 1. tls_1, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ Generic TLS version 1.1. tls_1_1, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ Generic TLS version 1.2. tls_1_2 </em></p> </blockquote> <p> }; </p> </blockquote> <blockquote> <p> typedef int method_option; </p> </blockquote> <blockquote> <p> static const method_option bit_client = 1&lt;&lt;client; static const method_option bit_server = 1&lt;&lt;server; static const method_option bit_ssl_2 = 1&lt;&lt;ssl_2; static const method_option bit_ssl_3 = 1&lt;&lt;ssl_3; static const method_option bit_tls_1 = 1&lt;&lt;tls_1; static const method_option bit_tls_1_1 = 1&lt;&lt;tls_1_1; static const method_option bit_tls_1_2 = 1&lt;&lt;tls_1_2; </p> </blockquote> <blockquote> <p> <em>/ File format types. enum file_format { </em></p> <blockquote> <p> <em>/ ASN.1 file. asn1, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ PEM file. pem </em></p> </blockquote> <p> }; </p> </blockquote> <blockquote> <p> enum verify_mode { </p> <blockquote> <p> verify_none, verify_peer, verify_fail_if_no_peer_cert, verify_client_once </p> </blockquote> <p> }; </p> </blockquote> <blockquote> <p> typedef int verify_mode_option; </p> </blockquote> <blockquote> <p> const verify_mode_option bit_verify_none = 1&lt;&lt;verify_none; const verify_mode_option bit_verify_peer = 1&lt;&lt;verify_peer; const verify_mode_option bit_verify_fail_if_no_peer_cert = 1&lt;&lt;verify_fail_if_no_peer_cert; const verify_mode_option bit_verify_client_once = 1&lt;&lt;verify_client_once; </p> </blockquote> <blockquote> <p> <em>/ Purpose of PEM password. enum password_purpose { </em></p> <blockquote> <p> <em>/ The password is needed for reading/decryption. for_reading, </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>/ The password is needed for writing/encryption. for_writing </em></p> </blockquote> <p> }; </p> </blockquote> <p> }; </p> <p> then in basic_context : </p> <p> -the constructor should take a combination (with the "|" operator) of method_option (you can even define short combinations for classic openssl default methods if you want) and the implementation set or trigger errors accordingly (if the requested mode is not supplied, like tls_1.1 or 1.2 with the openssl backend. </p> <p> I'm currently trying to implement GnuTLS backend, but i don't want to fork all the public asio::ssl api. a common one should be a better solution for everybody. - </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4294 Trac 1.4.3 ecyrbe <ecyrbe@…> Fri, 04 Jun 2010 03:33:30 GMT <link>https://svn.boost.org/trac10/ticket/4294#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4294#comment:1</guid> <description> <p> Sorry for the bad formating,cariage return on linux seems to have confused Trac. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Fri, 04 Jun 2010 04:35:48 GMT</pubDate> <title>type, milestone changed https://svn.boost.org/trac10/ticket/4294#comment:2 https://svn.boost.org/trac10/ticket/4294#comment:2 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> Ticket admin@… Sat, 12 Jun 2010 02:26:34 GMT <link>https://svn.boost.org/trac10/ticket/4294#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4294#comment:3</guid> <description> <p> Wouldn't the ideal solution here be in house support for SSL? I'd much rather see a Boost.Crypto, though that could be quite an undertaking. </p> </description> <category>Ticket</category> </item> <item> <author>ecyrbe <ecyrbe@…></author> <pubDate>Wed, 16 Jun 2010 12:29:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4294#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4294#comment:4</guid> <description> <p> I think that a Boost.Crypto that manage all the TLS aspects is quite a big job of maintenance. But in the mean time, nothing prevents Boost.ASIO to be more backend agnostic. This could prepare an eventual Boost.Crypto backend inclusion in Boost.ASIO. The sad part of my proposition is that it breaks ABI and API compatibility with the current OpenSSL Backend. But anyway, the Boost.ASIO.SSL backend lack support for Cypher Algorithm preferences. I made a local patch in context that is agnostic of OpenSSL capabilities and list all standards cyphers suites algorithms registered at IANA </p> <p> It is listed in context_base : </p> <blockquote> <p> <em>/ TLS cypher suites that can be found at IANA enum cipher_suite { </em></p> <blockquote> <p> TLS_NULL_WITH_NULL_NULL, TLS_RSA_WITH_NULL_MD5, TLS_RSA_WITH_NULL_SHA, TLS_RSA_EXPORT_WITH_RC4_40_MD5, TLS_RSA_WITH_RC4_128_MD5, TLS_RSA_WITH_RC4_128_SHA, TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5, TLS_RSA_WITH_IDEA_CBC_SHA, TLS_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA, TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA, TLS_DH_DSS_WITH_DES_CBC_SHA, TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA, TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_DH_RSA_WITH_DES_CBC_SHA, TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA, TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA, TLS_DHE_DSS_WITH_DES_CBC_SHA, TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, TLS_DHE_RSA_WITH_DES_CBC_SHA, TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_DH_anon_EXPORT_WITH_RC4_40_MD5, TLS_DH_anon_WITH_RC4_128_MD5, TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA, TLS_DH_anon_WITH_DES_CBC_SHA, TLS_DH_anon_WITH_3DES_EDE_CBC_SHA, </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> TLS_KRB5_WITH_DES_CBC_SHA, TLS_KRB5_WITH_3DES_EDE_CBC_SHA, TLS_KRB5_WITH_RC4_128_SHA, TLS_KRB5_WITH_IDEA_CBC_SHA, TLS_KRB5_WITH_DES_CBC_MD5, TLS_KRB5_WITH_3DES_EDE_CBC_MD5, TLS_KRB5_WITH_RC4_128_MD5, TLS_KRB5_WITH_IDEA_CBC_MD5, TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA, TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA, TLS_KRB5_EXPORT_WITH_RC4_40_SHA, TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5, TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5, TLS_KRB5_EXPORT_WITH_RC4_40_MD5, TLS_PSK_WITH_NULL_SHA, TLS_DHE_PSK_WITH_NULL_SHA, TLS_RSA_PSK_WITH_NULL_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DH_DSS_WITH_AES_128_CBC_SHA, TLS_DH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DH_anon_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_DH_DSS_WITH_AES_256_CBC_SHA, TLS_DH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DH_anon_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_NULL_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_DH_DSS_WITH_AES_128_CBC_SHA256, TLS_DH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA, TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA, TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA, TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA, TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA, </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DH_DSS_WITH_AES_256_CBC_SHA256, TLS_DH_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DH_anon_WITH_AES_128_CBC_SHA256, TLS_DH_anon_WITH_AES_256_CBC_SHA256, </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA, TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA, TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA, TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA, TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA, TLS_PSK_WITH_RC4_128_SHA, TLS_PSK_WITH_3DES_EDE_CBC_SHA, TLS_PSK_WITH_AES_128_CBC_SHA, TLS_PSK_WITH_AES_256_CBC_SHA, TLS_DHE_PSK_WITH_RC4_128_SHA, TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA, TLS_DHE_PSK_WITH_AES_128_CBC_SHA, TLS_DHE_PSK_WITH_AES_256_CBC_SHA, TLS_RSA_PSK_WITH_RC4_128_SHA, TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA, TLS_RSA_PSK_WITH_AES_128_CBC_SHA, TLS_RSA_PSK_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_SEED_CBC_SHA, TLS_DH_DSS_WITH_SEED_CBC_SHA, TLS_DH_RSA_WITH_SEED_CBC_SHA, TLS_DHE_DSS_WITH_SEED_CBC_SHA, TLS_DHE_RSA_WITH_SEED_CBC_SHA, TLS_DH_anon_WITH_SEED_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DH_RSA_WITH_AES_128_GCM_SHA256, TLS_DH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DH_DSS_WITH_AES_128_GCM_SHA256, TLS_DH_DSS_WITH_AES_256_GCM_SHA384, TLS_DH_anon_WITH_AES_128_GCM_SHA256, TLS_DH_anon_WITH_AES_256_GCM_SHA384, </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> TLS_ECDH_ECDSA_WITH_NULL_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_NULL_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_NULL_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_NULL_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_anon_WITH_NULL_SHA, TLS_ECDH_anon_WITH_RC4_128_SHA, TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_anon_WITH_AES_128_CBC_SHA, TLS_ECDH_anon_WITH_AES_256_CBC_SHA, TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA, TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA, TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA, TLS_SRP_SHA_WITH_AES_128_CBC_SHA, TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA, TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA, TLS_SRP_SHA_WITH_AES_256_CBC_SHA, TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA, TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 </p> </blockquote> <p> }; </p> </blockquote> <blockquote> <p> <em>/ a list of cipher suites, </em></p> </blockquote> <blockquote> <p> typedef std::list&lt;cipher_suite&gt; cipher_suites; </p> </blockquote> <p> And added a new set_cipher_suites in context_service : </p> <blockquote> <p> <em>/ Set cipher suites on the context. boost::system::error_code set_cipher_suites(impl_type&amp; impl, </em></p> <blockquote> <p> const context_base::cipher_suites&amp; c, boost::system::error_code&amp; ec) </p> </blockquote> <p> { </p> <blockquote> <p> return service_impl_.set_cipher_suites(impl, c, ec); </p> </blockquote> <p> } </p> </blockquote> <p> This is backend agnostic beacause it doesn't use any real OpenSSL Types, the correspondance is managed in openssl_backend context_service.hpp </p> <p> I already have a patch for this in my boost openssl backend. I can provide a patch, as this one does not break API compatibility, only adding new capabilities. </p> </description> <category>Ticket</category> </item> <item> <author>eric@…</author> <pubDate>Fri, 11 Apr 2014 10:22:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4294#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4294#comment:5</guid> <description> <p> @ecyrbe I realize this is 4 years old, but I would love to get my hands on that patch. Need to swap out OpenSSL for GnuTLS in Asio. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>AmarOk</dc:creator> <pubDate>Tue, 06 Mar 2018 16:18:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4294#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4294#comment:6</guid> <description> <p> And yet 4 years later, no modification :D </p> </description> <category>Ticket</category> </item> </channel> </rss>