1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gio.TlsClientConnectionT; 26 27 public import gio.IOStream; 28 public import gio.SocketConnectable; 29 public import gio.SocketConnectableIF; 30 public import glib.ConstructionException; 31 public import glib.ErrorG; 32 public import glib.GException; 33 public import glib.ListG; 34 public import gobject.ObjectG; 35 public import gtkc.gio; 36 public import gtkc.giotypes; 37 38 39 /** 40 * #GTlsClientConnection is the client-side subclass of 41 * #GTlsConnection, representing a client-side TLS connection. 42 * 43 * Since: 2.28 44 */ 45 public template TlsClientConnectionT(TStruct) 46 { 47 /** Get the main Gtk struct */ 48 public GTlsClientConnection* getTlsClientConnectionStruct() 49 { 50 return cast(GTlsClientConnection*)getStruct(); 51 } 52 53 /** 54 */ 55 56 /** 57 * Gets the list of distinguished names of the Certificate Authorities 58 * that the server will accept certificates from. This will be set 59 * during the TLS handshake if the server requests a certificate. 60 * Otherwise, it will be %NULL. 61 * 62 * Each item in the list is a #GByteArray which contains the complete 63 * subject DN of the certificate authority. 64 * 65 * Return: the list of 66 * CA DNs. You should unref each element with g_byte_array_unref() and then 67 * the free the list with g_list_free(). 68 * 69 * Since: 2.28 70 */ 71 public ListG getAcceptedCas() 72 { 73 auto p = g_tls_client_connection_get_accepted_cas(getTlsClientConnectionStruct()); 74 75 if(p is null) 76 { 77 return null; 78 } 79 80 return new ListG(cast(GList*) p); 81 } 82 83 /** 84 * Gets @conn's expected server identity 85 * 86 * Return: a #GSocketConnectable describing the 87 * expected server identity, or %NULL if the expected identity is not 88 * known. 89 * 90 * Since: 2.28 91 */ 92 public SocketConnectableIF getServerIdentity() 93 { 94 auto p = g_tls_client_connection_get_server_identity(getTlsClientConnectionStruct()); 95 96 if(p is null) 97 { 98 return null; 99 } 100 101 return ObjectG.getDObject!(SocketConnectable, SocketConnectableIF)(cast(GSocketConnectable*) p); 102 } 103 104 /** 105 * Gets whether @conn will use SSL 3.0 rather than the 106 * highest-supported version of TLS; see 107 * g_tls_client_connection_set_use_ssl3(). 108 * 109 * Return: whether @conn will use SSL 3.0 110 * 111 * Since: 2.28 112 */ 113 public bool getUseSsl3() 114 { 115 return g_tls_client_connection_get_use_ssl3(getTlsClientConnectionStruct()) != 0; 116 } 117 118 /** 119 * Gets @conn's validation flags 120 * 121 * Return: the validation flags 122 * 123 * Since: 2.28 124 */ 125 public GTlsCertificateFlags getValidationFlags() 126 { 127 return g_tls_client_connection_get_validation_flags(getTlsClientConnectionStruct()); 128 } 129 130 /** 131 * Sets @conn's expected server identity, which is used both to tell 132 * servers on virtual hosts which certificate to present, and also 133 * to let @conn know what name to look for in the certificate when 134 * performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. 135 * 136 * Params: 137 * identity = a #GSocketConnectable describing the expected server identity 138 * 139 * Since: 2.28 140 */ 141 public void setServerIdentity(SocketConnectableIF identity) 142 { 143 g_tls_client_connection_set_server_identity(getTlsClientConnectionStruct(), (identity is null) ? null : identity.getSocketConnectableStruct()); 144 } 145 146 /** 147 * If @use_ssl3 is %TRUE, this forces @conn to use SSL 3.0 rather than 148 * trying to properly negotiate the right version of TLS or SSL to use. 149 * This can be used when talking to servers that do not implement the 150 * fallbacks correctly and which will therefore fail to handshake with 151 * a "modern" TLS handshake attempt. 152 * 153 * Params: 154 * useSsl3 = whether to use SSL 3.0 155 * 156 * Since: 2.28 157 */ 158 public void setUseSsl3(bool useSsl3) 159 { 160 g_tls_client_connection_set_use_ssl3(getTlsClientConnectionStruct(), useSsl3); 161 } 162 163 /** 164 * Sets @conn's validation flags, to override the default set of 165 * checks performed when validating a server certificate. By default, 166 * %G_TLS_CERTIFICATE_VALIDATE_ALL is used. 167 * 168 * Params: 169 * flags = the #GTlsCertificateFlags to use 170 * 171 * Since: 2.28 172 */ 173 public void setValidationFlags(GTlsCertificateFlags flags) 174 { 175 g_tls_client_connection_set_validation_flags(getTlsClientConnectionStruct(), flags); 176 } 177 }