MySQL 8.0.29
Source Code Documentation
fido_registration.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 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 also distributed 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 included with MySQL.
13
14 Without limiting anything contained in the foregoing, this file,
15 which is part of C Driver for MySQL (Connector/C), is also subject to the
16 Universal FOSS Exception, version 1.0, a copy of which can be found at
17 http://oss.oracle.com/licenses/universal-foss-exception.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License, version 2.0, for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27
28#ifndef FIDO_REGISTRATION_H_
29#define FIDO_REGISTRATION_H_
30
31#include <fido.h>
32
33/**
34 A wrapper class which abstracts all access to FIDO device.
35*/
37 public:
40 /* prepare credential */
41 bool make_credentials(const char *challenge);
42 bool make_challenge_response(unsigned char *&challenge_response);
43
44 private:
45 void set_rp_id(std::string rp_id);
46 void set_type(int type = COSE_ES256);
47 void set_user(std::string user);
48 void set_scramble(unsigned char *, size_t);
49
50 /* get authenticator data details */
51 size_t get_authdata_len();
52 const unsigned char *get_authdata_ptr();
53 /* get signature details */
54 size_t get_sig_len();
55 const unsigned char *get_sig_ptr();
56 /* get x509 certificate details */
57 size_t get_x5c_len();
58 const unsigned char *get_x5c_ptr();
59 /* get rp id */
60 const char *get_rp_id();
61
62 /* Helper method to parse challenge receviced from server */
63 bool parse_challenge(const char *challenge);
64 /*
65 Helper method to open the device and request the device to
66 generate a signature, authenticator data and x509 certificate.
67 */
68 bool generate_signature();
69
70 private:
71 /* An abstraction to hold FIDO credentials. */
72 fido_cred_t *m_cred;
73};
74
75/**
76 This class is used to perform registration step on client side.
77*/
79 public:
80 bool make_credentials(const char *challenge);
81 bool make_challenge_response(unsigned char *&buf);
82
83 private:
85};
86
87#endif // FIDO_REGISTRATION_H_
A wrapper class which abstracts all access to FIDO device.
Definition: fido_registration.h:36
bool generate_signature()
This method checks if a token device is available on client host.
Definition: fido_registration.cc:130
const char * get_rp_id()
Method to get rp id.
Definition: fido_registration.cc:318
void set_scramble(unsigned char *, size_t)
Set method to set 32 bit random salt.
Definition: fido_registration.cc:232
void set_type(int type=COSE_ES256)
Method to set the algorithm type.
Definition: fido_registration.cc:252
void set_rp_id(std::string rp_id)
Method to set the relying party name or id.
Definition: fido_registration.cc:259
bool make_credentials(const char *challenge)
This method fills in all information required to initiate registration process.
Definition: fido_registration.cc:63
size_t get_sig_len()
Method to get length of signature.
Definition: fido_registration.cc:286
size_t get_x5c_len()
Method to get length of x509 certificate.
Definition: fido_registration.cc:302
const unsigned char * get_x5c_ptr()
Method to get x509 certificate.
Definition: fido_registration.cc:309
bool parse_challenge(const char *challenge)
Helper method to parse the challenge received from server during registration process.
Definition: fido_registration.cc:77
fido_cred_t * m_cred
Definition: fido_registration.h:72
void set_user(std::string user)
Set method to set user name.
Definition: fido_registration.cc:241
fido_make_cred()
Construcutor to allocate memory for performing attestation (registration)
Definition: fido_registration.cc:42
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:178
const unsigned char * get_authdata_ptr()
Method to get authenticator data.
Definition: fido_registration.cc:277
~fido_make_cred()
Standard destructor.
Definition: fido_registration.cc:51
const unsigned char * get_sig_ptr()
Method to get signature data.
Definition: fido_registration.cc:293
size_t get_authdata_len()
Method to get length of authenticator data.
Definition: fido_registration.cc:268
This class is used to perform registration step on client side.
Definition: fido_registration.h:78
bool make_challenge_response(unsigned char *&buf)
Helper method to get challenge response.
Definition: fido_registration.cc:330
fido_make_cred m_fido_make_cred
Definition: fido_registration.h:84
bool make_credentials(const char *challenge)
Helper method to initiate registration process.
Definition: fido_registration.cc:323
char * user
Definition: mysqladmin.cc:59
Definition: buf0block_hint.cc:29
required string type
Definition: replication_group_member_actions.proto:33