/usr/include/d/gtkd-3/gio/TlsDatabase.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gio.TlsDatabase;
private import gio.AsyncResultIF;
private import gio.Cancellable;
private import gio.SocketConnectableIF;
private import gio.TlsCertificate;
private import gio.TlsInteraction;
private import gio.c.functions;
public import gio.c.types;
private import glib.ByteArray;
private import glib.ErrorG;
private import glib.GException;
private import glib.ListG;
private import glib.Str;
private import gobject.ObjectG;
public import gtkc.giotypes;
/**
* #GTlsDatabase is used to lookup certificates and other information
* from a certificate or key store. It is an abstract base class which
* TLS library specific subtypes override.
*
* Most common client applications will not directly interact with
* #GTlsDatabase. It is used internally by #GTlsConnection.
*
* Since: 2.30
*/
public class TlsDatabase : ObjectG
{
/** the main Gtk struct */
protected GTlsDatabase* gTlsDatabase;
/** Get the main Gtk struct */
public GTlsDatabase* getTlsDatabaseStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gTlsDatabase;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gTlsDatabase;
}
protected override void setStruct(GObject* obj)
{
gTlsDatabase = cast(GTlsDatabase*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GTlsDatabase* gTlsDatabase, bool ownedRef = false)
{
this.gTlsDatabase = gTlsDatabase;
super(cast(GObject*)gTlsDatabase, ownedRef);
}
/** */
public static GType getType()
{
return g_tls_database_get_type();
}
/**
* Create a handle string for the certificate. The database will only be able
* to create a handle for certificates that originate from the database. In
* cases where the database cannot create a handle for a certificate, %NULL
* will be returned.
*
* This handle should be stable across various instances of the application,
* and between applications. If a certificate is modified in the database,
* then it is not guaranteed that this handle will continue to point to it.
*
* Params:
* certificate = certificate for which to create a handle.
*
* Returns: a newly allocated string containing the
* handle.
*
* Since: 2.30
*/
public string createCertificateHandle(TlsCertificate certificate)
{
auto retStr = g_tls_database_create_certificate_handle(gTlsDatabase, (certificate is null) ? null : certificate.getTlsCertificateStruct());
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Lookup a certificate by its handle.
*
* The handle should have been created by calling
* g_tls_database_create_certificate_handle() on a #GTlsDatabase object of
* the same TLS backend. The handle is designed to remain valid across
* instantiations of the database.
*
* If the handle is no longer valid, or does not point to a certificate in
* this database, then %NULL will be returned.
*
* This function can block, use g_tls_database_lookup_certificate_for_handle_async() to perform
* the lookup operation asynchronously.
*
* Params:
* handle = a certificate handle
* interaction = used to interact with the user if necessary
* flags = Flags which affect the lookup.
* cancellable = a #GCancellable, or %NULL
*
* Returns: a newly allocated
* #GTlsCertificate, or %NULL. Use g_object_unref() to release the certificate.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public TlsCertificate lookupCertificateForHandle(string handle, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable)
{
GError* err = null;
auto p = g_tls_database_lookup_certificate_for_handle(gTlsDatabase, Str.toStringz(handle), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TlsCertificate)(cast(GTlsCertificate*) p, true);
}
/**
* Asynchronously lookup a certificate by its handle in the database. See
* g_tls_database_lookup_certificate_for_handle() for more information.
*
* Params:
* handle = a certificate handle
* interaction = used to interact with the user if necessary
* flags = Flags which affect the lookup.
* cancellable = a #GCancellable, or %NULL
* callback = callback to call when the operation completes
* userData = the data to pass to the callback function
*
* Since: 2.30
*/
public void lookupCertificateForHandleAsync(string handle, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
{
g_tls_database_lookup_certificate_for_handle_async(gTlsDatabase, Str.toStringz(handle), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
}
/**
* Finish an asynchronous lookup of a certificate by its handle. See
* g_tls_database_lookup_certificate_handle() for more information.
*
* If the handle is no longer valid, or does not point to a certificate in
* this database, then %NULL will be returned.
*
* Params:
* result = a #GAsyncResult.
*
* Returns: a newly allocated #GTlsCertificate object.
* Use g_object_unref() to release the certificate.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public TlsCertificate lookupCertificateForHandleFinish(AsyncResultIF result)
{
GError* err = null;
auto p = g_tls_database_lookup_certificate_for_handle_finish(gTlsDatabase, (result is null) ? null : result.getAsyncResultStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TlsCertificate)(cast(GTlsCertificate*) p, true);
}
/**
* Lookup the issuer of @certificate in the database.
*
* The %issuer property
* of @certificate is not modified, and the two certificates are not hooked
* into a chain.
*
* This function can block, use g_tls_database_lookup_certificate_issuer_async() to perform
* the lookup operation asynchronously.
*
* Params:
* certificate = a #GTlsCertificate
* interaction = used to interact with the user if necessary
* flags = flags which affect the lookup operation
* cancellable = a #GCancellable, or %NULL
*
* Returns: a newly allocated issuer #GTlsCertificate,
* or %NULL. Use g_object_unref() to release the certificate.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public TlsCertificate lookupCertificateIssuer(TlsCertificate certificate, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable)
{
GError* err = null;
auto p = g_tls_database_lookup_certificate_issuer(gTlsDatabase, (certificate is null) ? null : certificate.getTlsCertificateStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TlsCertificate)(cast(GTlsCertificate*) p, true);
}
/**
* Asynchronously lookup the issuer of @certificate in the database. See
* g_tls_database_lookup_certificate_issuer() for more information.
*
* Params:
* certificate = a #GTlsCertificate
* interaction = used to interact with the user if necessary
* flags = flags which affect the lookup operation
* cancellable = a #GCancellable, or %NULL
* callback = callback to call when the operation completes
* userData = the data to pass to the callback function
*
* Since: 2.30
*/
public void lookupCertificateIssuerAsync(TlsCertificate certificate, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
{
g_tls_database_lookup_certificate_issuer_async(gTlsDatabase, (certificate is null) ? null : certificate.getTlsCertificateStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
}
/**
* Finish an asynchronous lookup issuer operation. See
* g_tls_database_lookup_certificate_issuer() for more information.
*
* Params:
* result = a #GAsyncResult.
*
* Returns: a newly allocated issuer #GTlsCertificate,
* or %NULL. Use g_object_unref() to release the certificate.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public TlsCertificate lookupCertificateIssuerFinish(AsyncResultIF result)
{
GError* err = null;
auto p = g_tls_database_lookup_certificate_issuer_finish(gTlsDatabase, (result is null) ? null : result.getAsyncResultStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TlsCertificate)(cast(GTlsCertificate*) p, true);
}
/**
* Lookup certificates issued by this issuer in the database.
*
* This function can block, use g_tls_database_lookup_certificates_issued_by_async() to perform
* the lookup operation asynchronously.
*
* Params:
* issuerRawDn = a #GByteArray which holds the DER encoded issuer DN.
* interaction = used to interact with the user if necessary
* flags = Flags which affect the lookup operation.
* cancellable = a #GCancellable, or %NULL
*
* Returns: a newly allocated list of #GTlsCertificate
* objects. Use g_object_unref() on each certificate, and g_list_free() on the release the list.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public ListG lookupCertificatesIssuedBy(ByteArray issuerRawDn, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable)
{
GError* err = null;
auto p = g_tls_database_lookup_certificates_issued_by(gTlsDatabase, (issuerRawDn is null) ? null : issuerRawDn.getByteArrayStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* Asynchronously lookup certificates issued by this issuer in the database. See
* g_tls_database_lookup_certificates_issued_by() for more information.
*
* The database may choose to hold a reference to the issuer byte array for the duration
* of of this asynchronous operation. The byte array should not be modified during
* this time.
*
* Params:
* issuerRawDn = a #GByteArray which holds the DER encoded issuer DN.
* interaction = used to interact with the user if necessary
* flags = Flags which affect the lookup operation.
* cancellable = a #GCancellable, or %NULL
* callback = callback to call when the operation completes
* userData = the data to pass to the callback function
*
* Since: 2.30
*/
public void lookupCertificatesIssuedByAsync(ByteArray issuerRawDn, TlsInteraction interaction, GTlsDatabaseLookupFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
{
g_tls_database_lookup_certificates_issued_by_async(gTlsDatabase, (issuerRawDn is null) ? null : issuerRawDn.getByteArrayStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
}
/**
* Finish an asynchronous lookup of certificates. See
* g_tls_database_lookup_certificates_issued_by() for more information.
*
* Params:
* result = a #GAsyncResult.
*
* Returns: a newly allocated list of #GTlsCertificate
* objects. Use g_object_unref() on each certificate, and g_list_free() on the release the list.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public ListG lookupCertificatesIssuedByFinish(AsyncResultIF result)
{
GError* err = null;
auto p = g_tls_database_lookup_certificates_issued_by_finish(gTlsDatabase, (result is null) ? null : result.getAsyncResultStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* Determines the validity of a certificate chain after looking up and
* adding any missing certificates to the chain.
*
* @chain is a chain of #GTlsCertificate objects each pointing to the next
* certificate in the chain by its %issuer property. The chain may initially
* consist of one or more certificates. After the verification process is
* complete, @chain may be modified by adding missing certificates, or removing
* extra certificates. If a certificate anchor was found, then it is added to
* the @chain.
*
* @purpose describes the purpose (or usage) for which the certificate
* is being used. Typically @purpose will be set to #G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER
* which means that the certificate is being used to authenticate a server
* (and we are acting as the client).
*
* The @identity is used to check for pinned certificates (trust exceptions)
* in the database. These will override the normal verification process on a
* host by host basis.
*
* Currently there are no @flags, and %G_TLS_DATABASE_VERIFY_NONE should be
* used.
*
* If @chain is found to be valid, then the return value will be 0. If
* @chain is found to be invalid, then the return value will indicate
* the problems found. If the function is unable to determine whether
* @chain is valid or not (eg, because @cancellable is triggered
* before it completes) then the return value will be
* %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set
* accordingly. @error is not set when @chain is successfully analyzed
* but found to be invalid.
*
* This function can block, use g_tls_database_verify_chain_async() to perform
* the verification operation asynchronously.
*
* Params:
* chain = a #GTlsCertificate chain
* purpose = the purpose that this certificate chain will be used for.
* identity = the expected peer identity
* interaction = used to interact with the user if necessary
* flags = additional verify flags
* cancellable = a #GCancellable, or %NULL
*
* Returns: the appropriate #GTlsCertificateFlags which represents the
* result of verification.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public GTlsCertificateFlags verifyChain(TlsCertificate chain, string purpose, SocketConnectableIF identity, TlsInteraction interaction, GTlsDatabaseVerifyFlags flags, Cancellable cancellable)
{
GError* err = null;
auto p = g_tls_database_verify_chain(gTlsDatabase, (chain is null) ? null : chain.getTlsCertificateStruct(), Str.toStringz(purpose), (identity is null) ? null : identity.getSocketConnectableStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
/**
* Asynchronously determines the validity of a certificate chain after
* looking up and adding any missing certificates to the chain. See
* g_tls_database_verify_chain() for more information.
*
* Params:
* chain = a #GTlsCertificate chain
* purpose = the purpose that this certificate chain will be used for.
* identity = the expected peer identity
* interaction = used to interact with the user if necessary
* flags = additional verify flags
* cancellable = a #GCancellable, or %NULL
* callback = callback to call when the operation completes
* userData = the data to pass to the callback function
*
* Since: 2.30
*/
public void verifyChainAsync(TlsCertificate chain, string purpose, SocketConnectableIF identity, TlsInteraction interaction, GTlsDatabaseVerifyFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
{
g_tls_database_verify_chain_async(gTlsDatabase, (chain is null) ? null : chain.getTlsCertificateStruct(), Str.toStringz(purpose), (identity is null) ? null : identity.getSocketConnectableStruct(), (interaction is null) ? null : interaction.getTlsInteractionStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
}
/**
* Finish an asynchronous verify chain operation. See
* g_tls_database_verify_chain() for more information.
*
* If @chain is found to be valid, then the return value will be 0. If
* @chain is found to be invalid, then the return value will indicate
* the problems found. If the function is unable to determine whether
* @chain is valid or not (eg, because @cancellable is triggered
* before it completes) then the return value will be
* %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set
* accordingly. @error is not set when @chain is successfully analyzed
* but found to be invalid.
*
* Params:
* result = a #GAsyncResult.
*
* Returns: the appropriate #GTlsCertificateFlags which represents the
* result of verification.
*
* Since: 2.30
*
* Throws: GException on failure.
*/
public GTlsCertificateFlags verifyChainFinish(AsyncResultIF result)
{
GError* err = null;
auto p = g_tls_database_verify_chain_finish(gTlsDatabase, (result is null) ? null : result.getAsyncResultStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
}
|