secmod_rsa.h (4383B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2020-2022 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU 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 General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file util/secmod_rsa.h 18 * @brief IPC messages for the RSA crypto helper. 19 * @author Christian Grothoff 20 */ 21 #ifndef TALER_EXCHANGE_SECMOD_RSA_H 22 #define TALER_EXCHANGE_SECMOD_RSA_H 23 24 #define TALER_HELPER_RSA_MT_PURGE 1 25 #define TALER_HELPER_RSA_MT_AVAIL 2 26 27 #define TALER_HELPER_RSA_MT_REQ_BATCH_SIGN 3 28 #define TALER_HELPER_RSA_MT_REQ_INIT 4 29 #define TALER_HELPER_RSA_MT_REQ_SIGN 5 30 #define TALER_HELPER_RSA_MT_REQ_REVOKE 6 31 32 #define TALER_HELPER_RSA_MT_RES_SIGNATURE 7 33 #define TALER_HELPER_RSA_MT_RES_SIGN_FAILURE 8 34 #define TALER_HELPER_RSA_MT_RES_BATCH_FAILURE 9 35 36 #define TALER_HELPER_RSA_SYNCED 10 37 38 39 GNUNET_NETWORK_STRUCT_BEGIN 40 41 42 /** 43 * Message sent if a key is available. 44 */ 45 struct TALER_CRYPTO_RsaKeyAvailableNotification 46 { 47 /** 48 * Type is #TALER_HELPER_RSA_MT_AVAIL 49 */ 50 struct GNUNET_MessageHeader header; 51 52 /** 53 * Number of bytes of the public key. 54 */ 55 uint16_t pub_size; 56 57 /** 58 * Number of bytes of the section name. 59 */ 60 uint16_t section_name_len; 61 62 /** 63 * When does the key become available? 64 */ 65 struct GNUNET_TIME_TimestampNBO anchor_time; 66 67 /** 68 * How long is the key available after @e anchor_time? 69 */ 70 struct GNUNET_TIME_RelativeNBO duration_withdraw; 71 72 /** 73 * Public key used to generate the @e sicm_sig. 74 */ 75 struct TALER_SecurityModulePublicKeyP secm_pub; 76 77 /** 78 * Signature affirming the announcement, of 79 * purpose #TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY. 80 */ 81 struct TALER_SecurityModuleSignatureP secm_sig; 82 83 /* followed by @e pub_size bytes of the RSA public key */ 84 85 /* followed by @e section_name bytes of the configuration section name 86 of the denomination of this key */ 87 88 }; 89 90 91 /** 92 * Message sent if a key was purged. 93 */ 94 struct TALER_CRYPTO_RsaKeyPurgeNotification 95 { 96 /** 97 * Type is #TALER_HELPER_RSA_MT_PURGE. 98 */ 99 struct GNUNET_MessageHeader header; 100 101 /** 102 * For now, always zero. 103 */ 104 uint32_t reserved; 105 106 /** 107 * Hash of the public key of the purged RSA key. 108 */ 109 struct TALER_RsaPubHashP h_rsa; 110 111 }; 112 113 114 /** 115 * Message sent if a signature is requested. 116 */ 117 struct TALER_CRYPTO_SignRequest 118 { 119 /** 120 * Type is #TALER_HELPER_RSA_MT_REQ_SIGN. 121 */ 122 struct GNUNET_MessageHeader header; 123 124 /** 125 * For now, always zero. 126 */ 127 uint32_t reserved; 128 129 /** 130 * Hash of the public key of the RSA key to use for the signature. 131 */ 132 struct TALER_RsaPubHashP h_rsa; 133 134 /* followed by message to sign */ 135 }; 136 137 138 /** 139 * Message sent if a batch of signatures is requested. 140 */ 141 struct TALER_CRYPTO_BatchSignRequest 142 { 143 /** 144 * Type is #TALER_HELPER_RSA_MT_REQ_BATCH_SIGN. 145 */ 146 struct GNUNET_MessageHeader header; 147 148 /** 149 * Number of signatures to create, in NBO. 150 */ 151 uint32_t batch_size; 152 153 /* 154 * Followed by @e batch_size sign requests. 155 */ 156 157 }; 158 159 160 /** 161 * Message sent if a key was revoked. 162 */ 163 struct TALER_CRYPTO_RevokeRequest 164 { 165 /** 166 * Type is #TALER_HELPER_RSA_MT_REQ_REVOKE. 167 */ 168 struct GNUNET_MessageHeader header; 169 170 /** 171 * For now, always zero. 172 */ 173 uint32_t reserved; 174 175 /** 176 * Hash of the public key of the revoked RSA key. 177 */ 178 struct TALER_RsaPubHashP h_rsa; 179 180 }; 181 182 183 /** 184 * Message sent if a signature was successfully computed. 185 */ 186 struct TALER_CRYPTO_SignResponse 187 { 188 /** 189 * Type is #TALER_HELPER_RSA_MT_RES_SIGNATURE. 190 */ 191 struct GNUNET_MessageHeader header; 192 193 /** 194 * For now, always zero. 195 */ 196 uint32_t reserved; 197 198 /* followed by RSA signature */ 199 }; 200 201 202 /** 203 * Message sent if signing failed. 204 */ 205 struct TALER_CRYPTO_SignFailure 206 { 207 /** 208 * Type is #TALER_HELPER_RSA_MT_RES_SIGN_FAILURE. 209 */ 210 struct GNUNET_MessageHeader header; 211 212 /** 213 * If available, Taler error code. In NBO. 214 */ 215 uint32_t ec; 216 217 }; 218 219 220 GNUNET_NETWORK_STRUCT_END 221 222 223 #endif