MySQL 9.1.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
classic_auth_sha256_password.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2022, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTING_CLASSIC_AUTH_SHA256_PASSWORD_INCLUDED
27#define ROUTING_CLASSIC_AUTH_SHA256_PASSWORD_INCLUDED
28
29#include <optional>
30#include <string>
31#include <string_view>
32#include <system_error>
33
34#include "classic_auth.h"
37
38// low-level routings for sha256_password
40 public:
41 static constexpr const size_t kNonceLength{20};
42 static constexpr const std::string_view kName{"sha256_password"};
43
44 static constexpr const std::string_view kEmptyPassword{"\x00", 1};
45 static constexpr const std::string_view kPublicKeyRequest{"\x01"};
46
47 static std::optional<std::string> scramble(std::string_view nonce,
48 std::string_view pwd);
49
51 Channel &dst_channel, ClassicProtocolState &dst_protocol);
52
54 Channel &dst_channel, ClassicProtocolState &dst_protocol,
55 const std::string &public_key);
56
58 Channel &dst_channel, ClassicProtocolState &dst_protocol,
59 const std::string &password);
60
62 Channel &dst_channel, ClassicProtocolState &dst_protocol,
63 const std::string &password);
64
65 static bool is_public_key_request(const std::string_view &data);
66 static bool is_public_key(const std::string_view &data);
67};
68
69#endif
Definition: classic_auth.h:48
Definition: classic_auth_sha256_password.h:39
static stdx::expected< size_t, std::error_code > send_plaintext_password(Channel &dst_channel, ClassicProtocolState &dst_protocol, const std::string &password)
Definition: classic_auth_sha256_password.cc:59
static bool is_public_key_request(const std::string_view &data)
Definition: classic_auth_sha256_password.cc:77
static stdx::expected< size_t, std::error_code > send_encrypted_password(Channel &dst_channel, ClassicProtocolState &dst_protocol, const std::string &password)
Definition: classic_auth_sha256_password.cc:69
static constexpr const std::string_view kName
Definition: classic_auth_sha256_password.h:42
static std::optional< std::string > scramble(std::string_view nonce, std::string_view pwd)
Definition: classic_auth_sha256_password.cc:32
static constexpr const std::string_view kEmptyPassword
Definition: classic_auth_sha256_password.h:44
static stdx::expected< size_t, std::error_code > send_public_key_request(Channel &dst_channel, ClassicProtocolState &dst_protocol)
Definition: classic_auth_sha256_password.cc:42
static constexpr const std::string_view kPublicKeyRequest
Definition: classic_auth_sha256_password.h:45
static stdx::expected< size_t, std::error_code > send_public_key(Channel &dst_channel, ClassicProtocolState &dst_protocol, const std::string &public_key)
Definition: classic_auth_sha256_password.cc:50
static constexpr const size_t kNonceLength
Definition: classic_auth_sha256_password.h:41
static bool is_public_key(const std::string_view &data)
Definition: classic_auth_sha256_password.cc:81
SSL aware socket buffers.
Definition: channel.h:65
protocol state of a classic protocol connection.
Definition: classic_protocol_state.h:40
static char * password
Definition: mysql_secure_installation.cc:58