LCOV - code coverage report
Current view: top level - tests/gpgsm - t-export.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 28 28 100.0 %
Date: 2016-09-12 13:07:23 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* t-export.c - Regression test.
       2             :    Copyright (C) 2000 Werner Koch (dd9jn)
       3             :    Copyright (C) 2001, 2003, 2004 g10 Code GmbH
       4             : 
       5             :    This file is part of GPGME.
       6             :  
       7             :    GPGME is free software; you can redistribute it and/or modify it
       8             :    under the terms of the GNU Lesser General Public License as
       9             :    published by the Free Software Foundation; either version 2.1 of
      10             :    the License, or (at your option) any later version.
      11             :    
      12             :    GPGME is distributed in the hope that it will be useful, but
      13             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             :    Lesser General Public License for more details.
      16             :    
      17             :    You should have received a copy of the GNU Lesser General Public
      18             :    License along with this program; if not, write to the Free Software
      19             :    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
      20             :    02111-1307, USA.  */
      21             : 
      22             : /* We need to include config.h so that we know whether we are building
      23             :    with large file system (LFS) support. */
      24             : #ifdef HAVE_CONFIG_H
      25             : #include <config.h>
      26             : #endif
      27             : 
      28             : #include <stdio.h>
      29             : #include <stdlib.h>
      30             : #include <string.h>
      31             : #include <assert.h>
      32             : 
      33             : #include <gpgme.h>
      34             : #include "t-support.h"
      35             : 
      36             : 
      37             : int 
      38           1 : main (int argc, char *argv[])
      39             : {
      40             :   gpgme_ctx_t ctx;
      41             :   gpgme_error_t err;
      42             :   gpgme_data_t out;
      43           1 :   const char *pattern1[] = { "DFN Top Level Certification Authority", NULL };
      44           1 :   const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
      45             :                              "DFN Server Certification Authority", 
      46             :                              NULL };
      47             : 
      48           1 :   init_gpgme (GPGME_PROTOCOL_CMS);
      49             : 
      50           1 :   err = gpgme_new (&ctx);
      51           1 :   fail_if_err (err);
      52           1 :   gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
      53             : 
      54           1 :   gpgme_set_armor (ctx, 1);
      55             : 
      56             :   /* Check exporting of one certificate. */
      57           1 :   err = gpgme_data_new (&out);
      58           1 :   fail_if_err (err);
      59           1 :   err = gpgme_op_export_ext (ctx, pattern1, 0, out);
      60           1 :   fail_if_err (err);
      61             : 
      62           1 :   fflush (NULL);
      63           1 :   fputs ("Begin Result:\n", stdout);
      64           1 :   print_data (out);
      65           1 :   fputs ("End Result.\n", stdout);
      66             : 
      67           1 :   gpgme_data_release (out);
      68             : 
      69             :   /* Check exporting of 2 certificates. */
      70           1 :   err = gpgme_data_new (&out);
      71           1 :   fail_if_err (err);
      72           1 :   err = gpgme_op_export_ext (ctx, pattern2, 0, out);
      73           1 :   fail_if_err (err);
      74             : 
      75           1 :   fflush (NULL);
      76           1 :   fputs ("Begin Result:\n", stdout);
      77           1 :   print_data (out);
      78           1 :   fputs ("End Result.\n", stdout);
      79             : 
      80           1 :   gpgme_data_release (out);
      81             : 
      82             : 
      83           1 :   gpgme_release (ctx);
      84             : 
      85           1 :   return 0;
      86             : }

Generated by: LCOV version 1.11