| 1 | /* dirmngr.h - Poldi dirmngr access layer |
| 2 | * Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
| 3 | * |
| 4 | * This file is part of Poldi. |
| 5 | * |
| 6 | * Poldi is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * Poldi is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef DIRMNGR_H |
| 21 | #define DIRMNGR_H |
| 22 | |
| 23 | #include <gpg-error.h> |
| 24 | #include <stdio.h> |
| 25 | #include <ksba.h> |
| 26 | |
| 27 | #include <util/simplelog.h> |
| 28 | |
| 29 | /* Handle for accessing the dirmngr. */ |
| 30 | typedef struct dirmngr_ctx_s *dirmngr_ctx_t; |
| 31 | |
| 32 | /* Connect to a running dirmngr through the local socket named by |
| 33 | SOCK, using LOG_HANDLE as logging handle and flags FLAGS. The new |
| 34 | context is stored in *CTX. Returns proper error code. */ |
| 35 | gpg_error_t dirmngr_connect (dirmngr_ctx_t *ctx, |
| 36 | const char *sock, |
| 37 | unsigned int flags, |
| 38 | log_handle_t log_handle); |
| 39 | |
| 40 | /* Close the dirmngr connection associated with CTX and release all |
| 41 | related resources. */ |
| 42 | void dirmngr_disconnect (dirmngr_ctx_t ctx); |
| 43 | |
| 44 | /* Retrieve the certificate stored under the url URL through the |
| 45 | dirmngr context CTX and store it in *CERTIFICATE. Returns proper |
| 46 | error code. */ |
| 47 | gpg_error_t dirmngr_lookup_url (dirmngr_ctx_t ctx, |
| 48 | const char *url, ksba_cert_t *cert); |
| 49 | |
| 50 | /* Validate the certificate CERT through the dirmngr context |
| 51 | CTX. Returns zero in case the certificate is considered valid, an |
| 52 | appropriate error code otherwise. */ |
| 53 | gpg_error_t dirmngr_validate (dirmngr_ctx_t ctx, ksba_cert_t cert); |
| 54 | |
| 55 | #endif |