MySQL 8.4.2
Source Code Documentation
registration.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_REGISTRATION_H_
30#define FIDO_CLIENT_REGISTRATION_H_
31
32#include <fido.h>
33#include <string>
34
35/**
36 Capability bit to support resident keys(aka discoverable credentials)
37*/
38#define RESIDENT_KEYS 1
39
41/**
42 This class is used to perform registration step on client side.
43*/
45 public:
47 virtual ~registration();
48 bool make_credentials(const char *challenge);
49 /* set rp id */
50 void set_rp_id(std::string rp_id);
51 /* set user name */
52 void set_user(std::string user);
53
54 /* get authenticator data details */
55 size_t get_authdata_len();
56 const unsigned char *get_authdata_ptr();
57 /* get signature details */
58 size_t get_sig_len();
59 const unsigned char *get_sig_ptr();
60 /* get x509 certificate details */
61 size_t get_x5c_len();
62 const unsigned char *get_x5c_ptr();
63 /* get rp id */
64 const char *get_rp_id();
65 /* check if authenticator has resident keys support */
66 bool is_fido2();
67
68 /* abstract methods to be implemented by specific client plugins */
69 virtual bool parse_challenge(const char *challenge) = 0;
70 virtual bool make_challenge_response(unsigned char *&buf) = 0;
71 virtual void set_client_data(const unsigned char *, const char *) = 0;
72 /*
73 Helper method to open the device and request the device to
74 generate a signature, authenticator data and x509 certificate.
75 */
76 virtual bool generate_signature() = 0;
77
78 protected:
79 fido_dev_info_t *discover_fido2_devices(size_t num_devices);
80 /* An abstraction to hold FIDO credentials. */
81 fido_cred_t *m_cred;
82 bool m_is_fido2{false};
83};
84} // namespace client_registration
85#endif // FIDO_CLIENT_REGISTRATION_H_
This class is used to perform registration step on client side.
Definition: registration.h:44
size_t get_sig_len()
Method to get length of signature.
Definition: registration.cc:111
const unsigned char * get_sig_ptr()
Method to get signature data.
Definition: registration.cc:118
fido_dev_info_t * discover_fido2_devices(size_t num_devices)
Discover available devices.
Definition: registration.cc:163
const unsigned char * get_authdata_ptr()
Method to get authenticator data.
Definition: registration.cc:102
const unsigned char * get_x5c_ptr()
Method to get x509 certificate.
Definition: registration.cc:134
virtual void set_client_data(const unsigned char *, const char *)=0
size_t get_authdata_len()
Method to get length of authenticator data.
Definition: registration.cc:93
virtual ~registration()
Standard destructor.
Definition: registration.cc:47
virtual bool parse_challenge(const char *challenge)=0
bool m_is_fido2
Definition: registration.h:82
fido_cred_t * m_cred
Definition: registration.h:81
size_t get_x5c_len()
Method to get length of x509 certificate.
Definition: registration.cc:127
virtual bool make_challenge_response(unsigned char *&buf)=0
registration()
Construcutor to allocate memory for performing attestation (registration)
Definition: registration.cc:38
bool make_credentials(const char *challenge)
This method fills in all information required to initiate registration process.
Definition: registration.cc:59
void set_user(std::string user)
Set method to set user name.
Definition: registration.cc:69
bool is_fido2()
Method to check if token device supports CTAP2.1 resident keys feature.
Definition: registration.cc:152
void set_rp_id(std::string rp_id)
Method to set the relying party name or id.
Definition: registration.cc:84
const char * get_rp_id()
Method to get rp id.
Definition: registration.cc:143
char * user
Definition: mysqladmin.cc:66
Definition: buf0block_hint.cc:30
Definition: registration.h:40