MySQL 8.0.40
Source Code Documentation
fido_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_ASSERTION_H_
30#define FIDO_ASSERTION_H_
31
32#include <fido.h>
33
34/**
35 A wrapper class to access fido2 library APIs to interact with the device.
36 This class abstracts all access to FIDO device.
37*/
39 public:
42 bool parse_challenge(const unsigned char *challenge);
43 bool sign_challenge();
44 void get_signed_challenge(unsigned char **challenge_res,
45 size_t &challenge_res_len);
46
47 private:
48 /* set client data has */
49 void set_scramble(unsigned char *scramble, size_t len);
50 /* set credential ID */
51 void set_cred_id(unsigned char *cred, size_t len);
52 /* set relying party ID */
53 void set_rp_id(const char *rp_id);
54
55 /* get method to retrieve authenticator data */
56 const unsigned char *get_authdata_ptr();
57 /* get method to retrieve length of authenticator data */
58 size_t get_authdata_len();
59 /* get method to retrieve signature */
60 const unsigned char *get_signature_ptr();
61 /* get method to retrieve length of signature */
62 size_t get_signature_len();
63
64 private:
65 /* Abstract type to hold information during authentication */
66 fido_assert_t *m_assert;
67};
68
69/**
70 Class to initiate authentication(aka assertion in FIDO terminology) on
71 client side by generating a signed signature by FIDO device which needs
72 to be sent to server to be verified.
73*/
75 public:
76 bool prepare_assert(const unsigned char *challenge);
77 bool sign_challenge();
78 void get_signed_challenge(unsigned char **challenge_res,
79 size_t &challenge_res_len);
80
81 private:
83};
84
85#endif // FIDO_ASSERTION_H_
Class to initiate authentication(aka assertion in FIDO terminology) on client side by generating a si...
Definition: fido_assertion.h:74
bool sign_challenge()
Helper method to sign the challenge received from server side FIDO plugin during authentication,...
Definition: fido_assertion.cc:237
void get_signed_challenge(unsigned char **challenge_res, size_t &challenge_res_len)
Helper method to prepare challenge response to be passed to server.
Definition: fido_assertion.cc:244
bool prepare_assert(const unsigned char *challenge)
Helper method to prepare all context required to perform assertion.
Definition: fido_assertion.cc:227
fido_prepare_assert m_fido_prepare_assert
Definition: fido_assertion.h:82
A wrapper class to access fido2 library APIs to interact with the device.
Definition: fido_assertion.h:38
bool parse_challenge(const unsigned char *challenge)
Helper method to parse the challenge received from server during authentication process.
Definition: fido_assertion.cc:56
void set_scramble(unsigned char *scramble, size_t len)
Set method to set 32 bit random salt.
Definition: fido_assertion.cc:165
void set_rp_id(const char *rp_id)
Method to set the relying party name or id.
Definition: fido_assertion.cc:184
bool sign_challenge()
Method to obtains an assertion from a FIDO device.
Definition: fido_assertion.cc:97
void get_signed_challenge(unsigned char **challenge_res, size_t &challenge_res_len)
This method will extract authenticator data, signature from fido_assert_t struct.
Definition: fido_assertion.cc:144
void set_cred_id(unsigned char *cred, size_t len)
Set method to set credential ID.
Definition: fido_assertion.cc:175
const unsigned char * get_signature_ptr()
Method to get signature.
Definition: fido_assertion.cc:211
fido_assert_t * m_assert
Definition: fido_assertion.h:66
size_t get_authdata_len()
Method to get length of authenticator data.
Definition: fido_assertion.cc:202
fido_prepare_assert()
Construcutor to allocate memory for performing assertion (authentication)
Definition: fido_assertion.cc:39
~fido_prepare_assert()
Standard destructor.
Definition: fido_assertion.cc:44
size_t get_signature_len()
Method to get length of signature.
Definition: fido_assertion.cc:220
const unsigned char * get_authdata_ptr()
Method to get authenticator data.
Definition: fido_assertion.cc:193
void scramble(char *to, const char *message, const char *password)
Produce an obscure octet sequence from password and random string, received from the server.
Definition: password.cc:271