@@ -71,7 +71,7 @@ struct SessionData {
7171 */
7272struct AuthenticationData {
7373 std::vector<uint8_t > cert;
74- std::string params;
74+ std::map<std:: string, std::string> params;
7575};
7676
7777/* *
@@ -100,6 +100,11 @@ struct Signer {
100100 * @return result_t error code or ok
101101 */
102102 virtual result_t signDigest (std::vector<uint8_t >& dst, const std::vector<uint8_t >& digest) = 0;
103+ /* *
104+ * @brief Full session token
105+ *
106+ */
107+ const SessionData& session;
103108 /* *
104109 * @brief Signing algorithm name (RS256/ES256)
105110 *
@@ -115,7 +120,7 @@ struct Signer {
115120 *
116121 */
117122 std::vector<uint8_t > cert;
118- std::string params;
123+ std::map<std:: string, std::string> params;
119124 /* *
120125 * @brief The text of last error
121126 *
@@ -126,10 +131,11 @@ struct Signer {
126131 /* *
127132 * @brief Construct a new Signer object
128133 *
134+ * @param _session Full session data (token and certificate)
129135 * @param _rcpt_id Recipient full id in etsi format (ets/PNOEE-XYZXYZXYZXY)
130136 * @param _algo_name Signing algorithm name (RS256/ES256)
131137 */
132- Signer (const std::string& _rcpt_id, const std::string _algo_name, NetworkBackend *_network) : rcpt_id(_rcpt_id), algo_name(_algo_name), network(_network) {}
138+ Signer (const SessionData& _session, const std::string& _rcpt_id, const std::string& _algo_name, NetworkBackend *_network) : session(_session), rcpt_id(_rcpt_id), algo_name(_algo_name), network(_network) {}
133139};
134140
135141/* *
@@ -142,11 +148,6 @@ struct SIDSigner : public Signer {
142148 *
143149 */
144150 const std::string url;
145- /* *
146- * @brief Full session token
147- *
148- */
149- const SessionData& session;
150151
151152 /* *
152153 * @brief Construct a new SIDSigner object
@@ -156,7 +157,7 @@ struct SIDSigner : public Signer {
156157 * @param _rcpt_id Recipient full id in etsi format (ets/PNOEE-XYZXYZXYZXY)
157158 */
158159 SIDSigner (const std::string& _url, const SessionData& _session, const std::string& _rcpt_id, NetworkBackend *network)
159- : Signer(_rcpt_id, " RSASSA-PSS+ACSP_V2" , network), url(_url), session(_session ) {}
160+ : Signer(_session, _rcpt_id, " RSASSA-PSS+ACSP_V2" , network), url(_url) {}
160161
161162 result_t signDigest (std::vector<uint8_t >& dst, const std::vector<uint8_t >& digest) final ;
162163};
@@ -171,16 +172,6 @@ struct MIDSigner : public Signer {
171172 *
172173 */
173174 const std::string url;
174- /* *
175- * @brief Relying party UUID
176- *
177- */
178- const std::string rp_uuid;
179- /* *
180- * @brief Relying party name
181- *
182- */
183- const std::string rp_name;
184175 /* *
185176 * @brief Recipient phone number (with country code)
186177 *
@@ -190,12 +181,10 @@ struct MIDSigner : public Signer {
190181 * @brief Construct a new MIDSigner object
191182 *
192183 * @param _url Mobile ID gateway url
193- * @param _rp_uuid Relying party UUID
194- * @param _rp_name Relying party name
195184 * @param _rcpt_id Recipient full id in etsi format (ets/PNOEE-XYZXYZXYZXY)
196185 */
197- MIDSigner (const std::string& _url, const std::string& _rp_uuid , const std::string& _rp_name, const std::string& _phone , const std::string& _rcpt_id, NetworkBackend *network)
198- : Signer(_rcpt_id, " ES256" , network), url(_url), rp_uuid(_rp_uuid), rp_name(_rp_name ), phone(_phone) {}
186+ MIDSigner (const std::string& _url, const std::string& _phone , const SessionData& _session , const std::string& _rcpt_id, NetworkBackend *network)
187+ : Signer(_session, _rcpt_id, " ES256" , network), url(_url), phone(_phone) {}
199188
200189 result_t signDigest (std::vector<uint8_t >& dst, const std::vector<uint8_t >& digest) final ;
201190};
@@ -241,7 +230,7 @@ std::string buildAcspV2Payload(const std::string& scheme_name, const std::string
241230 *
242231 * Checks that the session signing certificate belongs to rcpt_id (via
243232 * CryptoBackend::validateCertificate), that the session token is not expired,
244- * and extracts the schemeName/rpName claims needed for ticket validation.
233+ * and extracts the schemeName/rpName claims needed for ticket validation for SmartId .
245234 *
246235 * @param crypto crypto backend
247236 * @param rcpt_id recipient id from the lock (etsi/PNOEE-...)
@@ -252,7 +241,7 @@ std::string buildAcspV2Payload(const std::string& scheme_name, const std::string
252241 * @param error output: error description on failure
253242 * @return error code or OK
254243 */
255- result_t validateSessionData (CryptoBackend *crypto, const std::string& rcpt_id,
244+ result_t validateSessionData (CryptoBackend *crypto, const std::string& rcpt_id, bool is_mid,
256245 const std::string& session_token, const std::string& session_cert_b64,
257246 std::string& scheme_name, std::string& rp_name, std::string& error);
258247
0 commit comments