MySQL 8.0.37
Source Code Documentation
fido_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_REGISTRATION_H_
30#define FIDO_REGISTRATION_H_
31
32#include <fido.h>
33
34/**
35 A wrapper class which abstracts all access to FIDO device.
36*/
38 public:
41 /* prepare credential */
42 bool make_credentials(const char *challenge);
43 bool make_challenge_response(unsigned char *&challenge_response);
44
45 private:
46 void set_rp_id(std::string rp_id);
47 void set_type(int type = COSE_ES256);
48 void set_user(std::string user);
49 void set_scramble(unsigned char *, size_t);
50
51 /* get authenticator data details */
52 size_t get_authdata_len();
53 const unsigned char *get_authdata_ptr();
54 /* get signature details */
55 size_t get_sig_len();
56 const unsigned char *get_sig_ptr();
57 /* get x509 certificate details */
58 size_t get_x5c_len();
59 const unsigned char *get_x5c_ptr();
60 /* get rp id */
61 const char *get_rp_id();
62
63 /* Helper method to parse challenge receviced from server */
64 bool parse_challenge(const char *challenge);
65 /*
66 Helper method to open the device and request the device to
67 generate a signature, authenticator data and x509 certificate.
68 */
69 bool generate_signature();
70
71 private:
72 /* An abstraction to hold FIDO credentials. */
73 fido_cred_t *m_cred;
74};
75
76/**
77 This class is used to perform registration step on client side.
78*/
80 public:
81 bool make_credentials(const char *challenge);
82 bool make_challenge_response(unsigned char *&buf);
83
84 private:
86};
87
88#endif // FIDO_REGISTRATION_H_
A wrapper class which abstracts all access to FIDO device.
Definition: fido_registration.h:37
bool generate_signature()
This method checks if a token device is available on client host.
Definition: fido_registration.cc:131
const char * get_rp_id()
Method to get rp id.
Definition: fido_registration.cc:320
void set_scramble(unsigned char *, size_t)
Set method to set 32 bit random salt.
Definition: fido_registration.cc:234
void set_type(int type=COSE_ES256)
Method to set the algorithm type.
Definition: fido_registration.cc:254
void set_rp_id(std::string rp_id)
Method to set the relying party name or id.
Definition: fido_registration.cc:261
bool make_credentials(const char *challenge)
This method fills in all information required to initiate registration process.
Definition: fido_registration.cc:64
size_t get_sig_len()
Method to get length of signature.
Definition: fido_registration.cc:288
size_t get_x5c_len()
Method to get length of x509 certificate.
Definition: fido_registration.cc:304
const unsigned char * get_x5c_ptr()
Method to get x509 certificate.
Definition: fido_registration.cc:311
bool parse_challenge(const char *challenge)
Helper method to parse the challenge received from server during registration process.
Definition: fido_registration.cc:78
fido_cred_t * m_cred
Definition: fido_registration.h:73
void set_user(std::string user)
Set method to set user name.
Definition: fido_registration.cc:243
fido_make_cred()
Construcutor to allocate memory for performing attestation (registration)
Definition: fido_registration.cc:43
bool make_challenge_response(unsigned char *&challenge_response)
This method will extract authenticator data, signature, certificate and rp id from fido_cred_t struct...
Definition: fido_registration.cc:180
const unsigned char * get_authdata_ptr()
Method to get authenticator data.
Definition: fido_registration.cc:279
~fido_make_cred()
Standard destructor.
Definition: fido_registration.cc:52
const unsigned char * get_sig_ptr()
Method to get signature data.
Definition: fido_registration.cc:295
size_t get_authdata_len()
Method to get length of authenticator data.
Definition: fido_registration.cc:270
This class is used to perform registration step on client side.
Definition: fido_registration.h:79
bool make_challenge_response(unsigned char *&buf)
Helper method to get challenge response.
Definition: fido_registration.cc:332
fido_make_cred m_fido_make_cred
Definition: fido_registration.h:85
bool make_credentials(const char *challenge)
Helper method to initiate registration process.
Definition: fido_registration.cc:325
char * user
Definition: mysqladmin.cc:60
Definition: buf0block_hint.cc:30
required string type
Definition: replication_group_member_actions.proto:34