MySQL 9.0.0
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
36 /**
37 Capability bit to support resident keys(aka discoverable credentials)
38 */
40 /**
41 Capability bit is to support sending the full attestation blob
42 */
44};
45
47/**
48 This class is used to perform registration step on client side.
49*/
51 public:
53 virtual ~registration();
54 bool make_credentials(const char *challenge);
55 /* set rp id */
56 void set_rp_id(std::string rp_id);
57 /* set user name */
58 void set_user(std::string user);
59
60 /* get authenticator data details */
61 size_t get_authdata_len();
62 const unsigned char *get_authdata_ptr();
63 /* get signature details */
64 size_t get_sig_len();
65 const unsigned char *get_sig_ptr();
66 /* get x509 certificate details */
67 size_t get_x5c_len();
68 const unsigned char *get_x5c_ptr();
69 /* get rp id */
70 const char *get_rp_id();
71 /* check if authenticator has resident keys support */
72 bool is_fido2();
73 /* the full attestation statement */
74 const unsigned char *get_attestation_statement_ptr();
76
77 /* get the credentials format */
78 const char *get_fmt();
79
80 /* abstract methods to be implemented by specific client plugins */
81 virtual bool parse_challenge(const char *challenge) = 0;
82 virtual bool make_challenge_response(unsigned char *&buf) = 0;
83 virtual void set_client_data(const unsigned char *, const char *) = 0;
84 /*
85 Helper method to open the device and request the device to
86 generate a signature, authenticator data and x509 certificate.
87 */
88 virtual bool generate_signature() = 0;
89
90 protected:
91 fido_dev_info_t *discover_fido2_devices(size_t num_devices);
92 /* An abstraction to hold FIDO credentials. */
93 fido_cred_t *m_cred;
94 bool m_is_fido2{false};
95};
96} // namespace client_registration
97#endif // FIDO_CLIENT_REGISTRATION_H_
This class is used to perform registration step on client side.
Definition: registration.h:50
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:176
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:149
virtual void set_client_data(const unsigned char *, const char *)=0
const char * get_fmt()
Definition: registration.cc:136
size_t get_authdata_len()
Method to get length of authenticator data.
Definition: registration.cc:93
const unsigned char * get_attestation_statement_ptr()
Gets the full attestation statement blob.
Definition: registration.cc:125
virtual ~registration()
Standard destructor.
Definition: registration.cc:47
virtual bool parse_challenge(const char *challenge)=0
bool m_is_fido2
Definition: registration.h:94
fido_cred_t * m_cred
Definition: registration.h:93
size_t get_x5c_len()
Method to get length of x509 certificate.
Definition: registration.cc:142
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
size_t get_attestation_statement_length()
Gets the length of the full attestation statement blob.
Definition: registration.cc:132
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:167
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:158
char * user
Definition: mysqladmin.cc:66
Definition: buf0block_hint.cc:30
Definition: registration.h:46
capacity_bits
Definition: registration.h:35
@ SEND_FULL_ATTESTATION_BLOB
Capability bit is to support sending the full attestation blob.
Definition: registration.h:43
@ RESIDENT_KEYS
Capability bit to support resident keys(aka discoverable credentials)
Definition: registration.h:39