MySQL 8.0.31
Source Code Documentation
tls_cipher.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2022, 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 also distributed 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 included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQL_HARNESS_TLS_CIPHER_H_INCLUDED
26#define MYSQL_HARNESS_TLS_CIPHER_H_INCLUDED
27
28#include <system_error>
29
30#include <openssl/evp.h>
31
33
34class TlsCipher {
35 public:
36 using nid_type = int;
37
38 TlsCipher(const EVP_CIPHER *cipher) : cipher_{cipher} {}
39
41 const uint8_t *src, size_t src_size, uint8_t *dst, const uint8_t *key,
42 size_t key_size, const uint8_t *iv, bool padding = true) const;
43
45 const uint8_t *src, size_t src_size, uint8_t *dst, const uint8_t *key,
46 size_t key_size, const uint8_t *iv, bool padding = true) const;
47
48 size_t size(size_t source_length) const;
49
50 private:
51 const EVP_CIPHER *cipher_;
52};
53
54#endif
Definition: tls_cipher.h:34
TlsCipher(const EVP_CIPHER *cipher)
Definition: tls_cipher.h:38
stdx::expected< size_t, std::error_code > decrypt(const uint8_t *src, size_t src_size, uint8_t *dst, const uint8_t *key, size_t key_size, const uint8_t *iv, bool padding=true) const
Definition: tls_cipher.cc:114
const EVP_CIPHER * cipher_
Definition: tls_cipher.h:51
size_t size(size_t source_length) const
Definition: tls_cipher.cc:149
int nid_type
Definition: tls_cipher.h:36
stdx::expected< size_t, std::error_code > encrypt(const uint8_t *src, size_t src_size, uint8_t *dst, const uint8_t *key, size_t key_size, const uint8_t *iv, bool padding=true) const
Definition: tls_cipher.cc:78
required string key
Definition: replication_asynchronous_connection_failover.proto:59