LCOV - code coverage report
Current view: top level - exchange - taler-exchange-httpd_management_signkey_EP_revoke.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 0 19 0.0 %
Date: 2022-08-25 06:15:09 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2020 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify it under the
       6             :   terms of the GNU Affero General Public License as published by the Free Software
       7             :   Foundation; either version 3, or (at your option) any later version.
       8             : 
       9             :   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
      10             :   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      11             :   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
      12             : 
      13             :   You should have received a copy of the GNU Affero General Public License along with
      14             :   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15             : */
      16             : /**
      17             :  * @file taler-exchange-httpd_management_signkey_EP_revoke.c
      18             :  * @brief Handle exchange online signing key revocation requests.
      19             :  * @author Christian Grothoff
      20             :  */
      21             : #include "platform.h"
      22             : #include <gnunet/gnunet_util_lib.h>
      23             : #include <gnunet/gnunet_json_lib.h>
      24             : #include <jansson.h>
      25             : #include <microhttpd.h>
      26             : #include <pthread.h>
      27             : #include "taler_json_lib.h"
      28             : #include "taler_mhd_lib.h"
      29             : #include "taler-exchange-httpd_management.h"
      30             : #include "taler-exchange-httpd_responses.h"
      31             : #include "taler-exchange-httpd_keys.h"
      32             : 
      33             : 
      34             : MHD_RESULT
      35           0 : TEH_handler_management_signkeys_EP_revoke (
      36             :   struct MHD_Connection *connection,
      37             :   const struct TALER_ExchangePublicKeyP *exchange_pub,
      38             :   const json_t *root)
      39             : {
      40             :   struct TALER_MasterSignatureP master_sig;
      41             :   struct GNUNET_JSON_Specification spec[] = {
      42           0 :     GNUNET_JSON_spec_fixed_auto ("master_sig",
      43             :                                  &master_sig),
      44           0 :     GNUNET_JSON_spec_end ()
      45             :   };
      46             :   enum GNUNET_DB_QueryStatus qs;
      47             : 
      48             :   {
      49             :     enum GNUNET_GenericReturnValue res;
      50             : 
      51           0 :     res = TALER_MHD_parse_json_data (connection,
      52             :                                      root,
      53             :                                      spec);
      54           0 :     if (GNUNET_SYSERR == res)
      55           0 :       return MHD_NO; /* hard failure */
      56           0 :     if (GNUNET_NO == res)
      57           0 :       return MHD_YES; /* failure */
      58             :   }
      59           0 :   TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++;
      60           0 :   if (GNUNET_OK !=
      61           0 :       TALER_exchange_offline_signkey_revoke_verify (exchange_pub,
      62             :                                                     &TEH_master_public_key,
      63             :                                                     &master_sig))
      64             :   {
      65           0 :     GNUNET_break_op (0);
      66           0 :     return TALER_MHD_reply_with_error (
      67             :       connection,
      68             :       MHD_HTTP_FORBIDDEN,
      69             :       TALER_EC_EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID,
      70             :       NULL);
      71             :   }
      72           0 :   qs = TEH_plugin->insert_signkey_revocation (TEH_plugin->cls,
      73             :                                               exchange_pub,
      74             :                                               &master_sig);
      75           0 :   if (qs < 0)
      76             :   {
      77           0 :     GNUNET_break (0);
      78           0 :     return TALER_MHD_reply_with_error (connection,
      79             :                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
      80             :                                        TALER_EC_GENERIC_DB_STORE_FAILED,
      81             :                                        "signkey revocation");
      82             :   }
      83           0 :   TEH_keys_update_states ();
      84           0 :   return TALER_MHD_reply_static (
      85             :     connection,
      86             :     MHD_HTTP_NO_CONTENT,
      87             :     NULL,
      88             :     NULL,
      89             :     0);
      90             : }
      91             : 
      92             : 
      93             : /* end of taler-exchange-httpd_management_signkey_HDP_revoke.c */

Generated by: LCOV version 1.14