MySQL 8.4.0
Source Code Documentation
assertion.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 Without limiting anything contained in the foregoing, this file,
16 which is part of C Driver for MySQL (Connector/C), is also subject to the
17 Universal FOSS Exception, version 1.0, a copy of which can be found at
18 http://oss.oracle.com/licenses/universal-foss-exception.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License, version 2.0, for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
28
29#ifndef FIDO_CLIENT_ASSERTION_H_
30#define FIDO_CLIENT_ASSERTION_H_
31
32#include <fido.h>
33
35/**
36 Class to initiate authentication(aka assertion in FIDO terminology) on
37 client side by generating a signed signature by FIDO device which needs
38 to be sent to server to be verified.
39*/
40class assertion {
41 public:
42 assertion();
43 virtual ~assertion();
44 /* set credential ID */
45 void set_cred_id(const unsigned char *cred, size_t len);
46 /* set relying party ID */
47 void set_rp_id(const char *rp_id);
48 /* Get relying party ID */
49 const char *get_rp_id();
50
51 /* get method to retrieve authenticator data */
52 const unsigned char *get_authdata_ptr(size_t index = 0);
53 /* get method to retrieve length of authenticator data */
54 size_t get_authdata_len(size_t index = 0);
55 /* get method to retrieve signature */
56 const unsigned char *get_signature_ptr(size_t index = 0);
57 /* get method to retrieve length of signature */
58 size_t get_signature_len(size_t index = 0);
59 /* Number of assertions */
60 size_t get_num_assertions();
61
62 /* abstract methods to be implemented by specific plugins. */
63 virtual bool get_signed_challenge(unsigned char **challenge_res,
64 size_t &challenge_res_len) = 0;
65 virtual void set_client_data(const unsigned char *, const char *) = 0;
66 /* method to sign the received server challenge during authentication */
67 virtual bool sign_challenge() = 0;
68 /* parse challenge received from server during authentication */
69 virtual bool parse_challenge(const unsigned char *challenge) = 0;
70
71 protected:
72 fido_dev_info_t *discover_fido2_devices(size_t num_devices);
73 /* Abstract type to hold information during authentication */
74 fido_assert_t *m_assert;
75};
76} // namespace client_authentication
77#endif // FIDO_CLIENT_ASSERTION_H_
Class to initiate authentication(aka assertion in FIDO terminology) on client side by generating a si...
Definition: assertion.h:40
const unsigned char * get_authdata_ptr(size_t index=0)
Method to get authenticator data.
Definition: assertion.cc:73
const char * get_rp_id()
Method to get rp id.
Definition: assertion.cc:119
virtual void set_client_data(const unsigned char *, const char *)=0
fido_dev_info_t * discover_fido2_devices(size_t num_devices)
Discover available devices.
Definition: assertion.cc:130
size_t get_num_assertions()
Method to get number of assertions.
Definition: assertion.cc:112
size_t get_authdata_len(size_t index=0)
Method to get length of authenticator data.
Definition: assertion.cc:83
size_t get_signature_len(size_t index=0)
Method to get length of signature.
Definition: assertion.cc:103
void set_rp_id(const char *rp_id)
Method to set the relying party name or id.
Definition: assertion.cc:63
assertion()
Construcutor to allocate memory for performing assertion (authentication)
Definition: assertion.cc:41
fido_assert_t * m_assert
Definition: assertion.h:74
void set_cred_id(const unsigned char *cred, size_t len)
Set method to set credential ID.
Definition: assertion.cc:54
virtual bool parse_challenge(const unsigned char *challenge)=0
virtual bool get_signed_challenge(unsigned char **challenge_res, size_t &challenge_res_len)=0
const unsigned char * get_signature_ptr(size_t index=0)
Method to get signature.
Definition: assertion.cc:93
virtual ~assertion()
Standard destructor.
Definition: assertion.cc:46
Definition: assertion.h:34