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