diff --git a/README.md b/README.md deleted file mode 100644 index f6fa7e0c..00000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# VehicleComputingSimulator \ No newline at end of file diff --git a/hsm-server/.gitignore b/hsm-server/.gitignore new file mode 100644 index 00000000..0892e0c1 --- /dev/null +++ b/hsm-server/.gitignore @@ -0,0 +1,61 @@ +# build system files & directories +/build/ +/CMakeFiles/ +/CMakeCache.txt +/cmake_install.cmake +/Makefile + +# gtest files +/gtest/ + +#clangd +.cache +.clang-format +# VS Code files +.vscode/ +.devcontainer/ + +# binary files +*.o +*.a +*.so +*.exe +*.dll + +# log files +*.log + +# Vim swap files +*.swp + +# Emacs backup files +*~ + +# other files of C++ projects +*.obj +*.pdb +*.pch +*.ilk +*.lib +*.exp +*.idb +*.ipch +*.rsp +*.tlog +*.log +*.vspscc +*.vssscc +*.suo +*.user +*.userosscache +*.sln.docstates + +# log files +*.log + +# operating system files +Thumbs.db +Desktop.ini + +# linux operating system files +*~ diff --git a/hsm-server/CMakeLists.txt b/hsm-server/CMakeLists.txt new file mode 100644 index 00000000..9629160c --- /dev/null +++ b/hsm-server/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.10) +# Set the project name +project(grpc_server) +# Find GMP library +find_path(GMP_INCLUDE_DIR NAMES gmp.h) +find_library(GMP_LIBRARY NAMES gmp) +find_library(GMPXX_LIBRARY NAMES gmpxx) +if(NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARY OR NOT GMPXX_LIBRARY) + message(FATAL_ERROR "Could not find GMP or GMPXX libraries") +endif() +include_directories(${GMP_INCLUDE_DIR}) +# Specify C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Find Protobuf and gRPC packages +find_package(Protobuf REQUIRED) +find_package(gRPC REQUIRED) +# Gather all source files in src directory +file(GLOB SOURCES "src/*.cpp" ) +# Specify the path to the proto files +set(PROTO_FILES + ${CMAKE_SOURCE_DIR}/proto/encryption.proto +) +# Paths to the protoc and grpc_cpp_plugin binaries +set(PROTOC_PATH "/usr/local/bin/protoc") +set(GRPC_CPP_PLUGIN_PATH "/usr/local/bin/grpc_cpp_plugin") +# Specify output directory for generated files +set(PROTO_GEN_DIR "${CMAKE_BINARY_DIR}/generated") +file(MAKE_DIRECTORY ${PROTO_GEN_DIR}) +# Generate C++ source files from proto files +foreach(proto_file ${PROTO_FILES}) + get_filename_component(proto_name ${proto_file} NAME_WE) + + # Protobuf C++ source files + add_custom_command( + OUTPUT ${PROTO_GEN_DIR}/${proto_name}.pb.cc ${PROTO_GEN_DIR}/${proto_name}.pb.h + COMMAND ${PROTOC_PATH} --cpp_out=${PROTO_GEN_DIR} --proto_path=${CMAKE_SOURCE_DIR}/proto ${proto_file} + DEPENDS ${proto_file} + COMMENT "Generating protobuf code for ${proto_file}" + ) + + # gRPC C++ source files + add_custom_command( + OUTPUT ${PROTO_GEN_DIR}/${proto_name}.grpc.pb.cc ${PROTO_GEN_DIR}/${proto_name}.grpc.pb.h + COMMAND ${PROTOC_PATH} --grpc_out=${PROTO_GEN_DIR} --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN_PATH} --proto_path=${CMAKE_SOURCE_DIR}/proto ${proto_file} + DEPENDS ${proto_file} + COMMENT "Generating gRPC code for ${proto_file}" + ) + + list(APPEND PROTO_SRCS ${PROTO_GEN_DIR}/${proto_name}.pb.cc ${PROTO_GEN_DIR}/${proto_name}.grpc.pb.cc) + list(APPEND PROTO_HDRS ${PROTO_GEN_DIR}/${proto_name}.pb.h ${PROTO_GEN_DIR}/${proto_name}.grpc.pb.h) +endforeach() +# Include the generated files directory +include_directories(${PROTO_GEN_DIR}) +# Include directories for protobuf and gRPC +include_directories(${Protobuf_INCLUDE_DIRS} ${GRPC_INCLUDE_DIRS}) +# Add the logger library +file(GLOB LOGGER_SOURCES "logger/*.cpp") +add_library(logger STATIC ${LOGGER_SOURCES}) +# Add the executable +add_executable(grpc_server src/my_logger.cpp ${SOURCES} ${PROTO_SRCS}) +# Link against protobuf, gRPC, GMP, and logger libraries +target_link_libraries(grpc_server ${Protobuf_LIBRARIES} ${GMP_LIBRARY} ${GMPXX_LIBRARY} gRPC::grpc++ logger) +# Ensure that protobuf and gRPC code generation is properly configured +add_custom_target(proto_gen ALL + DEPENDS ${PROTO_SRCS} ${PROTO_HDRS} + COMMENT "Generating protobuf and gRPC code" +) +# Add dependencies to ensure proper build order +add_dependencies(grpc_server proto_gen) +# Set build type to Debug +set(CMAKE_BUILD_TYPE Debug) +# Add debug flags +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") diff --git a/hsm-server/Dockerfile b/hsm-server/Dockerfile new file mode 100644 index 00000000..afb68efb --- /dev/null +++ b/hsm-server/Dockerfile @@ -0,0 +1,52 @@ +FROM ubuntu:20.04 +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + cmake \ + libgtest-dev \ + g++ \ + make \ + libgmp-dev \ + curl \ + libprotobuf-dev \ + protobuf-compiler \ + git \ + libtool \ + autoconf \ + ca-certificates \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +# Clone gRPC and install it +RUN git config --global http.sslVerify false && \ + git clone -b v1.41.1 --recursive https://github.com/grpc/grpc /grpc && \ + cd /grpc && \ + mkdir -p cmake/build && cd cmake/build && \ + cmake ../.. && \ + make && make install +# התקן protobuf +RUN git clone https://github.com/protocolbuffers/protobuf.git && \ + cd protobuf && \ + git checkout v3.18.1 && \ + git submodule update --init --recursive && \ + ./autogen.sh && \ + ./configure && \ + make && \ + make install && \ + ldconfig +# הגדר את תיקיית העבודה בתוך הקונטיינר +WORKDIR /app +# העתק את תוכן התיקייה הנוכחית לתוך הקונטיינר בכתובת /app +COPY . . +# צור תיקיית build +RUN rm -rf build && mkdir build +# שנה לתיקיית build +WORKDIR /app/build +# התקן את Google Test +RUN cd /usr/src/gtest && cmake CMakeLists.txt && make && \ + find /usr/src/gtest -name "*.a" -exec cp {} /usr/lib \; +# בנה את הפרויקט באמצעות CMake ו-Make +RUN cmake .. -DUSE_SYCL=OFF -DUSE_DEBUG=OFF +RUN make +WORKDIR /app +EXPOSE 50051 +# פקודה להריץ את השרת (אופציונלי) +CMD ["./build/grpc_server"] \ No newline at end of file diff --git a/hsm-server/docker-compose.yml b/hsm-server/docker-compose.yml new file mode 100644 index 00000000..70640d10 --- /dev/null +++ b/hsm-server/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.8' + +services: + grpc_server: + build: + context: . + dockerfile: Dockerfile + ports: + - "50051:50051" + volumes: + - .:/app + networks: + - grpc_network + +networks: + grpc_network: + external: true # Use the external network created diff --git a/hsm-server/include/IHash.h b/hsm-server/include/IHash.h new file mode 100644 index 00000000..3fed2b57 --- /dev/null +++ b/hsm-server/include/IHash.h @@ -0,0 +1,15 @@ +#ifndef IHASH_H +#define IHASH_H +#include "general.h" +#include +#include + +class IHash { + public: + enum SHAAlgorithm { SHA256, SHA3_512 }; + virtual CK_RV update(const std::vector &data) = 0; + virtual CK_RV finalize(std::vector &output) = 0; + virtual ~IHash() = default; +}; + +#endif // IHASH_H \ No newline at end of file diff --git a/hsm-server/include/SHA3-512.h b/hsm-server/include/SHA3-512.h new file mode 100644 index 00000000..306fb167 --- /dev/null +++ b/hsm-server/include/SHA3-512.h @@ -0,0 +1,32 @@ +#ifndef SHA3_512_H +#define SHA3_512_H + +#include "IHash.h" +#include "general.h" +#include // For fixed-width integer types +#include // For std::ostringstream +#include +#include + +class SHA3_512 : public IHash { + public: + SHA3_512(); // Constructor to initialize the state + CK_RV update(const std::vector &data) + override; // Update the hash with more data + CK_RV finalize(std::vector &output) + override; // Finalize and get the hash value + + private: + uint64_t S[5][5]; // State matrix + uint8_t buffer[576]; // Buffer to hold input data + std::size_t buffer_length; // Current length of data in the buffer + + void round(uint64_t A[5][5], uint64_t RC); + void f_function(uint64_t A[5][5]); + void padding(uint8_t input[], std::size_t &in_len, int &absorb_times); + void assign_S_xor_p(uint64_t S[5][5], uint64_t *p); + void endianSwap(uint64_t &x); + std::vector hashPartToHexVector(uint64_t S[5][5]); +}; + +#endif // SHA3_512_H \ No newline at end of file diff --git a/hsm-server/include/aes.h b/hsm-server/include/aes.h new file mode 100644 index 00000000..3b338f45 --- /dev/null +++ b/hsm-server/include/aes.h @@ -0,0 +1,128 @@ +#ifndef _AES_H_ +#define _AES_H_ +#include +#include "general.h" +#include +#include +#include +#include +#define AES_STATE_ROWS 4 +#define NUM_BLOCKS 4 +#define BLOCK_BYTES_LEN (AES_STATE_ROWS * (NUM_BLOCKS) * sizeof(unsigned char)) + +struct AESData { + unsigned int numWord; + unsigned int numRound; + unsigned int keySize; +}; + +static std::map aesKeyLengthData = { + {AESKeyLength::AES_128, {4, 10, 16}}, + {AESKeyLength::AES_192, {6, 12, 24}}, + {AESKeyLength::AES_256, {8, 14, 32}}}; + +unsigned int getPaddedLength(unsigned int originalLength); +void padMessage(unsigned char *originalMessage, unsigned int originalLength, + unsigned char *paddedMessage); +unsigned int getUnpadMessageLength(unsigned char *message, + unsigned int paddedLength); +void addRoundKey(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS], + unsigned char *roundKey); +void checkLength(unsigned int length); +void encryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength); +void decryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength); +void subBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void invSubBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void invShiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void invMixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void mixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void shiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]); +void keyExpansion(const unsigned char *key, unsigned char roundKeys[], + AESKeyLength keyLength); +unsigned char xtime(unsigned char x); +void rotWord(unsigned char word[AES_STATE_ROWS]); +void subWord(unsigned char word[AES_STATE_ROWS]); +void rconWord(unsigned char rcon[AES_STATE_ROWS], unsigned int n); +unsigned char multiply(unsigned char x, unsigned char y); +void xorBlocks(const unsigned char *a, const unsigned char *b, unsigned char *c, + unsigned int len); +void generateRandomIV(unsigned char *iv); +size_t calculatEncryptedLenAES(size_t inLen, bool isFirst, + AESChainingMode chainingMode); +size_t calculatDecryptedLenAES(size_t inLen, bool isFirst, + AESChainingMode chainingMode); +void generateKey(unsigned char *, AESKeyLength keyLength); + +/*Inverse S-Box*/ +const unsigned char invSBox[16][16] = { + {0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, + 0x81, 0xf3, 0xd7, 0xfb}, + {0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, + 0xc4, 0xde, 0xe9, 0xcb}, + {0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, + 0x42, 0xfa, 0xc3, 0x4e}, + {0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, + 0x6d, 0x8b, 0xd1, 0x25}, + {0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, + 0x5d, 0x65, 0xb6, 0x92}, + {0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, + 0xa7, 0x8d, 0x9d, 0x84}, + {0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, + 0xb8, 0xb3, 0x45, 0x06}, + {0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, + 0x01, 0x13, 0x8a, 0x6b}, + {0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, + 0xf0, 0xb4, 0xe6, 0x73}, + {0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, + 0x1c, 0x75, 0xdf, 0x6e}, + {0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, + 0xaa, 0x18, 0xbe, 0x1b}, + {0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, + 0x78, 0xcd, 0x5a, 0xf4}, + {0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, + 0x27, 0x80, 0xec, 0x5f}, + {0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, + 0x93, 0xc9, 0x9c, 0xef}, + {0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, + 0x83, 0x53, 0x99, 0x61}, + {0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, + 0x55, 0x21, 0x0c, 0x7d}}; + +/*S-Box*/ +const unsigned char sBox[16][16] = { + {0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, + 0xfe, 0xd7, 0xab, 0x76}, + {0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, + 0x9c, 0xa4, 0x72, 0xc0}, + {0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, + 0x71, 0xd8, 0x31, 0x15}, + {0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, + 0xeb, 0x27, 0xb2, 0x75}, + {0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, + 0x29, 0xe3, 0x2f, 0x84}, + {0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, + 0x4a, 0x4c, 0x58, 0xcf}, + {0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, + 0x50, 0x3c, 0x9f, 0xa8}, + {0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, + 0x10, 0xff, 0xf3, 0xd2}, + {0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, + 0x64, 0x5d, 0x19, 0x73}, + {0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, + 0xde, 0x5e, 0x0b, 0xdb}, + {0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, + 0x91, 0x95, 0xe4, 0x79}, + {0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, + 0x65, 0x7a, 0xae, 0x08}, + {0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, + 0x4b, 0xbd, 0x8b, 0x8a}, + {0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, + 0x86, 0xc1, 0x1d, 0x9e}, + {0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, + 0xce, 0x55, 0x28, 0xdf}, + {0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, + 0xb0, 0x54, 0xbb, 0x16}}; + +#endif \ No newline at end of file diff --git a/hsm-server/include/aes_stream.h b/hsm-server/include/aes_stream.h new file mode 100644 index 00000000..d859d1ed --- /dev/null +++ b/hsm-server/include/aes_stream.h @@ -0,0 +1,229 @@ +#ifndef __AES_STREAM__ +#define __AES_STREAM__ +#include "aes.h" +#include + +class StreamAES { + public: + unsigned char *iv = nullptr; + unsigned char *lastBlock = nullptr; + AESKeyLength keyLength; + unsigned char *key = nullptr; + unsigned char *lastData = nullptr; + + StreamAES() + : iv(new unsigned char[16]), + lastBlock(new unsigned char[16]), + lastData(new unsigned char[16]){}; + virtual ~StreamAES() + { + if (iv != nullptr) { + delete[] iv; + iv = nullptr; + } + if (lastBlock != nullptr) { + delete[] lastBlock; + lastBlock = nullptr; + } + if (key != nullptr) { + delete[] key; + key = nullptr; + } + if (lastData != nullptr) { + delete[] lastData; + lastData = nullptr; + } + } + + /** + @brief Encrypts the initial block of data using AES in CBC mode. + This function generates a random initialization vector (IV) and then + encrypts the given block of data. The encrypted data and the IV are + concatenated and stored in the output buffer. + @param block Input data block to encrypt. + @param inLen Length of the input data block. + @param[out] out Pointer to the output buffer where encrypted data will be stored. + @param[out] outLen Length of the encrypted output data. + @param key Encryption key. + @param keyLength Length of the AES key (128, 192, or 256 bits). + */ + virtual void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) = 0; + + /** + @brief Continues encryption of data using AES in CBC mode. + This function continues the encryption process for the given block of data + using the last encrypted block as the IV. + @param block Input data block to encrypt. + @param inLen Length of the input data block. + @param[out] out Pointer to the output buffer where encrypted data will be stored. + @param[out] outLen Length of the encrypted output data. + */ + virtual void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen) = 0; + + /** + @brief Decrypts the initial block of data using AES in CBC mode. + This function extracts the initialization vector (IV) from the end of the + input data block and then decrypts the given block of data. The decrypted + data is stored in the output buffer. + @param block Encrypted input data block to decrypt. + @param inLen Length of the encrypted input data block. + @param[out] out Pointer to the output buffer where decrypted data will be stored. + @param outLen Length of the decrypted output data. + @param key Decryption key. + @param keyLength Length of the AES key (128, 192, or 256 bits). + */ + virtual void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) = 0; + + /** + @brief Continues decryption of data using AES in CBC mode. + This function continues the decryption process for the given block of data + using the last decrypted block as the IV. + @param block Encrypted input data block to decrypt. + @param inLen Length of the encrypted input data block. + @param[out] out Pointer to the output buffer where decrypted data will be stored. + @param outLen Length of the decrypted output data. + */ + virtual void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) = 0; + + /** + Decrypts data using AES in CBC mode. + @param in Encrypted input data. + @param inLen Length of input data. + @param key Decryption key. + @param[out] out Decrypted output data. + @param[out] outLen Length of decrypted data. + @param iv Initialization vector. + @param keyLength AES key length (128, 192, 256 bits). + */ + virtual void decrypt(unsigned char in[], unsigned int inLen, + unsigned char *key, unsigned char *out, + unsigned int &outLen, const unsigned char *iv, + unsigned char *lastData, AESKeyLength keyLength) = 0; + + /** + Encrypts data using AES. + @param in Input data. + @param inLen Length of input data. + @param key Encryption key. + @param[out] out Encrypted output data. + @param[out] outLen Length of encrypted data. + @param iv Initialization vector. + @param keyLength AES key length (128, 192, 256 bits). + */ + virtual void encrypt(unsigned char in[], unsigned int inLen, + unsigned char *key, unsigned char *out, + unsigned int outLen, const unsigned char *iv, + unsigned char *lastData, AESKeyLength keyLength) = 0; +}; + +class AESEcb : public StreamAES { + void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength); + void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen); + void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength); + void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outlen); + void decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); + void encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); +}; + +class AESCbc : public StreamAES { + void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength); + void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen); + void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength); + void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen); + void decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); + void encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); +}; + +class AESCfb : public StreamAES { + void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength); + void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen); + void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength); + void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outlen); + void decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); + void encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); +}; + +class AESOfb : public StreamAES { + void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength); + void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen); + void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength); + void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outlen); + void decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); + void encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); +}; +class AESCtr : public StreamAES { + void encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength); + void encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outlen); + void decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outlen, + unsigned char *key, AESKeyLength keyLength); + void decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outlen); + void decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); + void encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength); +}; + +#endif // __AES_STREAM__ \ No newline at end of file diff --git a/hsm-server/include/aes_stream_factory.h b/hsm-server/include/aes_stream_factory.h new file mode 100644 index 00000000..740997ef --- /dev/null +++ b/hsm-server/include/aes_stream_factory.h @@ -0,0 +1,49 @@ +#include "aes.h" +#include "aes_stream.h" +#include +#include + +/** + * @brief Singleton class for managing StreamAESFactory instances. + */ +class FactoryManager { + public: + /** + * @brief Gets the singleton instance of FactoryManager. + * + * @return The singleton instance of FactoryManager. + */ + static FactoryManager &getInstance() + { + static FactoryManager instance; + return instance; + } + + /** + * @brief Creates a StreamAES object based on the specified AESChainingMode. + * + * @param type The AES chaining mode. + * @return A pointer to the newly created StreamAES object. + */ + StreamAES *create(const AESChainingMode &type) const + { + auto it = factories.find(type); + if (it != factories.end()) + return it->second; + + return nullptr; + } + + private: + std::map factories = { + {AESChainingMode::ECB, new AESEcb()}, + {AESChainingMode::CBC, new AESCbc()}, + {AESChainingMode::CFB, new AESCfb()}, + {AESChainingMode::OFB, new AESOfb()}, + {AESChainingMode::CTR, new AESCtr()}}; + + /** + * @brief Private constructor for singleton pattern. + */ + FactoryManager() {} +}; \ No newline at end of file diff --git a/hsm-server/include/big_int10.h b/hsm-server/include/big_int10.h new file mode 100644 index 00000000..edf75527 --- /dev/null +++ b/hsm-server/include/big_int10.h @@ -0,0 +1,81 @@ +#ifndef __BIG_INT_10__ +#define __BIG_INT_10__ +#include +#include +#include +#include +#include + +class BigInt10 { + friend std::ostream &operator<<(std::ostream &out, const BigInt10 &a); + friend BigInt10 modularExponentiation(BigInt10 base, BigInt10 exponent, + const BigInt10 &modulus); + friend BigInt10 gcd(BigInt10 a, BigInt10 b); + friend BigInt10 karatzubaMultiply(const BigInt10 &a, const BigInt10 &b); + friend BigInt10 longMultiplication(const BigInt10 &a, const BigInt10 &b); + friend BigInt10 longDivision(const BigInt10 &a, const BigInt10 &b, + BigInt10 &remainder); + friend BigInt10 power(BigInt10 base, BigInt10 exponent); + friend class BigInt64; + + public: + // ctors + BigInt10(const std::string &str); + BigInt10(const char *str); + BigInt10(long long val = 0); + BigInt10(uint64_t uval); + BigInt10(bool isNegative); + BigInt10(int val); + // operators + // comparison + bool operator==(const BigInt10 &b) const; + bool operator!=(const BigInt10 &b) const; + bool operator<(const BigInt10 &b) const; + bool operator>(const BigInt10 &b) const; + bool operator<=(const BigInt10 &b) const; + bool operator>=(const BigInt10 &b) const; + // arithematic operations + BigInt10 &operator++(); + BigInt10 operator++(int); + BigInt10 &operator--(); + BigInt10 operator--(int); + // addition + BigInt10 &operator+=(const BigInt10 &b); + BigInt10 operator+(const BigInt10 &b) const; + // subtruction + BigInt10 &operator-=(const BigInt10 &b); + BigInt10 operator-(const BigInt10 &b) const; + // multiplication + BigInt10 &operator*=(const BigInt10 &b); + BigInt10 operator*(const BigInt10 &b) const; + // division + BigInt10 &operator/=(const BigInt10 &b); + BigInt10 operator/(const BigInt10 &b) const; + // modulus + BigInt10 &operator%=(const BigInt10 &b); + BigInt10 operator%(const BigInt10 &b) const; + // power + BigInt10 &operator^=(const BigInt10 &b); + BigInt10 operator^(const BigInt10 &b) const; + std::string toString() const; + uint64_t toU64() const; + void removeLeadingZeros(); + bool isZero() const; + int limbsCount() const; + void insertZroes(int n); + + private: + // uint8_t is 1B, like unsigned char + std::vector limbs; + bool isNegative; + // logic + bool isSmallerThanUnsigned(const BigInt10 &b) const; + void prefixPlusPlusUnsigned(); + void prefixMinusMinusUnsigned(); + void addUnsigned(const BigInt10 &b); + void subtractUnsigned(const BigInt10 &b); + void initFromString(const char *str, int n); + void thisEqualsbBSubthis(const BigInt10 &b); +}; + +#endif // __BIG_INT_10__ \ No newline at end of file diff --git a/hsm-server/include/big_int64.h b/hsm-server/include/big_int64.h new file mode 100644 index 00000000..65747d90 --- /dev/null +++ b/hsm-server/include/big_int64.h @@ -0,0 +1,296 @@ +#ifndef __BIG_INT_64__ +#define __BIG_INT_64__ +#include +#include +#include +#include "big_int10.h" +#include "big_int_utils.h" + +constexpr int BYTES_IN_LIMB = 8; +constexpr int BITS_IN_BYTE = 8; +constexpr int BITS_IN_LIMB = 64; + +#ifdef USE_SYCL +#include +#include + +class BigInt64 { + friend std::ostream &operator<<(std::ostream &out, const BigInt64 &a); + friend BigInt64 power(BigInt64 base, BigInt64 exponent); + friend BigInt64 modularExponentiation(BigInt64 base, BigInt64 exponent, + const BigInt64 &modulus) + { + BigInt64 res(1); + base %= modulus; + while (!exponent.isZero()) { + if (!exponent.isEven()) + res = (res * base) % modulus; + base = (base * base) % modulus; + exponent >>= 1; + } + + return res; + } + + SYCL_EXTERNAL friend BigInt64 gcd(BigInt64 a, BigInt64 b); + friend BigInt64 extendedGcd(BigInt64 a, BigInt64 b, BigInt64 &x, + BigInt64 &y); + friend BigInt64 modularInverse(BigInt64 a, BigInt64 b); + + public: + enum CreateModes { RANDOM, BIG_ENDIANESS, LITTLE_ENDIANESS }; + // ctors + BigInt64(const std::string &str); + SYCL_EXTERNAL BigInt64(uint64_t min, const BigInt64 &max, + oneapi::dpl::uniform_real_distribution &distr, + oneapi::dpl::minstd_rand &engine) + { + isNegative = false; + for (int i = 0; i < max.limbsCount(); i++) { + float r1 = distr(engine); + float r2 = distr(engine); + limbs[i] = floatsToUint64(r1, r2); + } + + std::uint64_t maxMsb = max.getMsb(); + if (maxMsb == 1) + size = max.limbsCount() - 1; + else { + std::uint64_t msbMask = (1ULL << (::bitsCount(maxMsb) - 1)) - 1; + limbs[max.limbsCount() - 1] &= msbMask; + size = max.limbsCount(); + } + + removeLeadingZeros(); + if (limbs[0] < min && size == 1) { + limbs[0] = min; + size = 1; + } + } + + SYCL_EXTERNAL BigInt64(long long val = 0) : size(0) + { + isNegative = false; + if (val == 0) { + limbs[size++] = 0; + return; + } + + if (val < 0) { + isNegative = true; + val *= -1; + } + + limbs[size++] = val; + } + + BigInt64(uint64_t uval); + SYCL_EXTERNAL BigInt64(int val) : BigInt64(static_cast(val)) {} + SYCL_EXTERNAL BigInt64(bool isNegative); + BigInt64(const char *str); + BigInt64(const uint8_t *str, size_t strLen, CreateModes mode); + BigInt64(CreateModes mode, int bits); + BigInt64(CreateModes mode, uint64_t min, const BigInt64 &max); + // copy ctor + SYCL_EXTERNAL BigInt64(const BigInt64 &other) + { + isNegative = other.isNegative; + size = other.size; + copyLimbsFrom(other.limbs, 0, size, 0, size); + } + + // assignment operator + SYCL_EXTERNAL BigInt64 &operator=(const BigInt64 &other) + { + if (this == &other) + return *this; + + isNegative = other.isNegative; + size = other.size; + copyLimbsFrom(other.limbs, 0, size, 0, size); + return *this; + } + + // operators + // comparison + SYCL_EXTERNAL bool operator==(const BigInt64 &b) const; + SYCL_EXTERNAL bool operator!=(const BigInt64 &b) const; + SYCL_EXTERNAL bool operator<(const BigInt64 &b) const; + SYCL_EXTERNAL bool operator>(const BigInt64 &b) const; + SYCL_EXTERNAL bool operator<=(const BigInt64 &b) const; + SYCL_EXTERNAL bool operator>=(const BigInt64 &b) const; + // arithematic operations + SYCL_EXTERNAL BigInt64 &operator++(); + SYCL_EXTERNAL BigInt64 operator++(int); + SYCL_EXTERNAL BigInt64 &operator--(); + SYCL_EXTERNAL BigInt64 operator--(int); + // addition + SYCL_EXTERNAL BigInt64 &operator+=(const BigInt64 &b); + SYCL_EXTERNAL BigInt64 operator+(const BigInt64 &b) const; + // subtruction + SYCL_EXTERNAL BigInt64 &operator-=(const BigInt64 &b); + SYCL_EXTERNAL BigInt64 operator-(const BigInt64 &b) const; + // multiplication + SYCL_EXTERNAL BigInt64 &operator*=(const BigInt64 &b); + SYCL_EXTERNAL BigInt64 operator*(const BigInt64 &b) const; + // division + SYCL_EXTERNAL BigInt64 &operator/=(const BigInt64 &b); + SYCL_EXTERNAL BigInt64 operator/(const BigInt64 &b) const; + // modulus + SYCL_EXTERNAL BigInt64 &operator%=(const BigInt64 &b); + SYCL_EXTERNAL BigInt64 operator%(const BigInt64 &b) const; + // power + BigInt64 &operator^=(const BigInt64 &b); + BigInt64 operator^(const BigInt64 &b) const; + // right shift - division + SYCL_EXTERNAL BigInt64 &operator>>=(uint64_t n); + SYCL_EXTERNAL BigInt64 operator>>(uint64_t n) const; + // left shift - multiplication + BigInt64 &operator<<=(uint64_t n); + BigInt64 operator<<(uint64_t n) const; + // basic utils + SYCL_EXTERNAL bool isZero() const; + SYCL_EXTERNAL int limbsCount() const; + SYCL_EXTERNAL std::uint64_t getMsb() const; + SYCL_EXTERNAL std::uint64_t getLsb() const; + int bitsCount() const; + SYCL_EXTERNAL bool isEven() const; + void exportTo(uint8_t *out, size_t outLen, CreateModes mode) const; + size_t bytesCount() const; + void longMultiplication(const BigInt64 &b); + std::string toString() const; + + private: + // uint64_t is 8B, like unsigned long long + uint64_t limbs[150]; + size_t size; + bool isNegative; + // logic + bool isSmallerThanUnsigned(const BigInt64 &b) const; + void prefixPlusPlusUnsigned(); + void prefixMinusMinusUnsigned(); + void addUnsigned(const BigInt64 &b); + void subtractUnsigned(const BigInt64 &b); + void longDivision(const BigInt64 &b, BigInt64 &remainder, + BigInt64 "ient) const; + BigInt10 toDecimal() const; + void initFromString(const char *str, int n); + void rightShift(uint64_t n); + void leftShift(uint64_t n); + // helpers + void thisEqualsbBSubthis(const BigInt64 &b); + SYCL_EXTERNAL void removeLeadingZeros(); + void insert(int n, uint64_t limb); + void erase(int n); + void generateNLimbsRandom(int limbsCnt); + uint64_t randomLimb(uint64_t min, uint64_t max); + void zero(); + bool hasLeadingZero(); + SYCL_EXTERNAL void copyLimbsFrom(const uint64_t *other, size_t otherStart, + size_t count, size_t meStart, + size_t newSize); + void setLimbs(uint64_t val, size_t count, size_t meStart, size_t newSize); + void reverse(); +}; +#else +#include + +class BigInt64 { + friend std::ostream &operator<<(std::ostream &out, const BigInt64 &a); + friend BigInt64 modularExponentiation(BigInt64 base, BigInt64 exponent, + const BigInt64 &modulus); + friend BigInt64 gcd(BigInt64 a, BigInt64 b); + friend BigInt64 karatzubaMultiplication(const BigInt64 &a, + const BigInt64 &b); + friend BigInt64 extendedGcd(BigInt64 a, BigInt64 b, BigInt64 &x, + BigInt64 &y); + friend BigInt64 modularInverse(BigInt64 a, BigInt64 b); + friend BigInt64 longMultiplication(const BigInt64 &a, const BigInt64 &b); + friend BigInt64 longDivision(const BigInt64 &a, const BigInt64 &b, + BigInt64 &remainder); + friend BigInt64 power(BigInt64 base, BigInt64 exponent); + + public: + enum CreateModes { RANDOM, BIG_ENDIANESS, LITTLE_ENDIANESS }; + // ctors + BigInt64(const std::string &str); + BigInt64(long long val = 0); + BigInt64(uint64_t uval); + BigInt64(int val); + BigInt64(bool isNegative); + BigInt64(const char *str); + BigInt64(const uint8_t *str, size_t strLen, CreateModes mode); + BigInt64(std::vector v, bool isNegative); + BigInt64(CreateModes mode, int bits); + BigInt64(CreateModes mode, uint64_t min, const BigInt64 &max); + // operators + // comparison + bool operator==(const BigInt64 &b) const; + bool operator!=(const BigInt64 &b) const; + bool operator<(const BigInt64 &b) const; + bool operator>(const BigInt64 &b) const; + bool operator<=(const BigInt64 &b) const; + bool operator>=(const BigInt64 &b) const; + // arithematic operations + BigInt64 &operator++(); + BigInt64 operator++(int); + BigInt64 &operator--(); + BigInt64 operator--(int); + // addition + BigInt64 &operator+=(const BigInt64 &b); + BigInt64 operator+(const BigInt64 &b) const; + // subtruction + BigInt64 &operator-=(const BigInt64 &b); + BigInt64 operator-(const BigInt64 &b) const; + // multiplication + BigInt64 &operator*=(const BigInt64 &b); + BigInt64 operator*(const BigInt64 &b) const; + // division + BigInt64 &operator/=(const BigInt64 &b); + BigInt64 operator/(const BigInt64 &b) const; + // modulus + BigInt64 &operator%=(const BigInt64 &b); + BigInt64 operator%(const BigInt64 &b) const; + // power + BigInt64 &operator^=(const BigInt64 &b); + BigInt64 operator^(const BigInt64 &b) const; + // right shift - division + BigInt64 &operator>>=(uint64_t n); + BigInt64 operator>>(uint64_t n) const; + // left shift - multiplication + BigInt64 &operator<<=(uint64_t n); + BigInt64 operator<<(uint64_t n) const; + // basic utils + bool isZero() const; + int limbsCount() const; + int bitsCount() const; + bool isEven() const; + void exportTo(uint8_t *out, size_t outLen, CreateModes mode) const; + size_t bytesCount() const; + std::string toString() const; + + private: + // uint64_t is 8B, like unsigned long long + std::vector limbs; + bool isNegative; + // logic + bool isSmallerThanUnsigned(const BigInt64 &b) const; + void prefixPlusPlusUnsigned(); + void prefixMinusMinusUnsigned(); + void addUnsigned(const BigInt64 &b); + void subtractUnsigned(const BigInt64 &b); + BigInt10 toDecimal() const; + void initFromString(const char *str, int n); + void rightShift(uint64_t n); + void leftShift(uint64_t n); + // helpers + void thisEqualsbBSubthis(const BigInt64 &b); + void removeLeadingZeros(); + void insertZroes(int n); + void generateNLimbsRandom(int limbsCnt); + uint64_t randomLimb(uint64_t min, uint64_t max); + void zero(); +}; + +#endif +#endif // __BIG_INT_64__ \ No newline at end of file diff --git a/hsm-server/include/big_int_utils.h b/hsm-server/include/big_int_utils.h new file mode 100644 index 00000000..f438726e --- /dev/null +++ b/hsm-server/include/big_int_utils.h @@ -0,0 +1,118 @@ +#ifndef __BIG_INT_UTILS__ +#define __BIG_INT_UTILS__ +#include + +constexpr uint64_t MAX_VAL_64 = UINT64_MAX; +constexpr int MAX_VAL_10 = 9; + +inline uint64_t toBase64(uint64_t val) +{ + return MAX_VAL_64 - val + 1; +} + +inline void adder3_64(const uint64_t &a, const uint64_t &b, + const uint64_t &carryIn, uint64_t &sum, + uint64_t &carryOut) +{ + uint64_t ab = a + b; + // if A+B coused overflow, the result will be smaller than both + uint64_t out = (ab < b) ? 1 : 0; + sum = ab + carryIn; + carryOut = out + ((sum < ab) ? 1 : 0); +} + +#if defined(__SYCL_DEVICE_ONLY__) // Check for Intel C++ Compiler +inline void mul2Limbs64(const uint64_t a, const uint64_t b, uint64_t &high, + uint64_t &low) +{ + uint64_t a_low = static_cast(a); + uint64_t a_high = a >> 32; + uint64_t b_low = static_cast(b); + uint64_t b_high = b >> 32; + uint64_t low_low = a_low * b_low; + uint64_t low_high = a_low * b_high; + uint64_t high_low = a_high * b_low; + uint64_t high_high = a_high * b_high; + + uint64_t mid1 = low_high + (low_low >> 32); + uint64_t mid2 = high_low + (mid1 & 0xFFFFFFFF); + high = high_high + (mid1 >> 32) + (mid2 >> 32); + low = (mid2 << 32) | (low_low & 0xFFFFFFFF); +} + +#elif defined(__GNUC__) && defined(__cplusplus) // Check for g++ +inline void mul2Limbs64(const uint64_t a, const uint64_t b, uint64_t &high, + uint64_t &low) +{ + __uint128_t result = static_cast<__uint128_t>(a) * b; + low = static_cast(result); + high = static_cast(result >> 64); +} + +#elif defined(_WIN32) || defined(_WIN64) // Check if running on Windows +#include +inline void mul2Limbs64(const uint64_t a, const uint64_t b, uint64_t &high, + uint64_t &low) +{ + low = _umul128(a, b, &high); +} + +#else +#error "Compiler/platform not supported for mul2Limbs64" +#endif +inline uint64_t toBase10(uint8_t val) +{ + // note that 0->0 + return (MAX_VAL_10 - val + 1) % 10; +} + +inline void adder3_10(const uint8_t &a, const uint8_t &b, + const uint8_t &carryIn, uint8_t &sum, uint8_t &carryOut) +{ + uint8_t abcarry = a + b + carryIn; + sum = abcarry % 10; + carryOut = abcarry / 10; +} + +inline void mul2Limbs10(const uint8_t a, const uint8_t b, uint8_t &high, + uint8_t &low) +{ + uint8_t mult = a * b; + low = mult % 10; + high = mult / 10; +} + +inline bool isDigit10(const uint8_t a) +{ + return a >= 0 && a <= 9; +} + +inline bool isCharDigit10(const uint64_t a) +{ + return a >= '0' && a <= '9'; +} + +inline int bitsCount(uint64_t a) +{ +#if defined(_MSC_VER) // Check if compiling with Visual Studio + int count = 0; + while (a > 0) { + a >>= 1; + count++; + } + + return count; +#else // Assume Linux or GCC/Clang + int count = 64 - __builtin_clzll(a); + return count; +#endif +} + +inline uint64_t floatsToUint64(double float1, double float2) +{ + uint32_t part1 = static_cast(float1 * (1ULL << 32)); + uint32_t part2 = static_cast(float2 * (1ULL << 32)); + return (static_cast(part1) << 32) | static_cast(part2); +} + +#endif // __BIG_INT_UTILS__ \ No newline at end of file diff --git a/hsm-server/include/crypto_api.h b/hsm-server/include/crypto_api.h new file mode 100644 index 00000000..b0d75f7f --- /dev/null +++ b/hsm-server/include/crypto_api.h @@ -0,0 +1,126 @@ +#ifndef __CRYPTO_API_H__ +#define __CRYPTO_API_H__ + +#include +#include +#include +#include +#include + +#include "aes_stream_factory.h" +#include "ecc.h" +#include "general.h" +#include "sha256.h" + +int getCountFromEncryptions(int userID); +int getCountFromDecryptions(int userID); +int getCountFromHashing(int userID); +CK_RV bootSystem( + const std::map> &usersIdspermissions); +// generate key pair to each coponnet cinfigure the +//encrypt and decrypt behaviour for later + +CK_RV addProccess(int userId, std::vector &permissions); + +CK_RV configure(int userId, CryptoConfig config); + +// keys generation: +std::string generateAESKey(int userId, AESKeyLength aesKeyLength, + std::vector permissions, + int destUserId); + +std::pair generateRSAKeyPair( + int userId, std::vector permissions); + +std::pair generateECCKeyPair( + int userId, std::vector permissions); + +// sign-verify + +size_t getSignatureLength(); + +CK_RV signUpdate(int senderId, void *data, size_t dataLen, + SHAAlgorithm hashfunc, int counter); +CK_RV signFinalize(int senderId, void *signature, size_t signatureLen, + SHAAlgorithm hashfunc, std::string keyId); + +CK_RV verifyUpdate(int recieverId, void *in, size_t inLen, + SHAAlgorithm hashFunc, size_t counter); +CK_RV verifyFinalize(int recieverId, void *signature, size_t signatureLen, + SHAAlgorithm hashFunc, std::string keyId); + +// get public key id's + +std::string getPublicECCKeyByUserId(int userId); + +std::string getPublicRSAKeyByUserId(int userId); + +// ecc +size_t getECCencryptedLength(); + +size_t getECCdecryptedLength(); + +CK_RV ECCencrypt(int senderId, std::string keyId, void *in, size_t inLen, + void *out, size_t &outLen); + +CK_RV ECCdecrypt(int receiverId, std::string keyId, void *in, size_t inLen, + void *out, size_t &outLen); +// rsa +size_t getRSAencryptedLength(); + +size_t getRSAdecryptedLength(); + +CK_RV RSAencrypt(int userId, std::string keyId, void *in, size_t inLen, + void *out, size_t outLen); + +CK_RV RSAdecrypt(int userId, std::string keyId, void *in, size_t inLen, + void *out, size_t *outLen); +// aes +size_t getAESencryptedLength(size_t dataLen, bool isFirst, + AESChainingMode chainingMode); + +size_t getAESdecryptedLength(size_t dataLen, bool isFirst, + AESChainingMode chainingMode); + +CK_RV AESencrypt(int senderId, int receiverId, void *in, size_t inLen, + void *out, size_t outLen, AESKeyLength keyLength, + AESChainingMode chainingMode, size_t counter, + std::string keyId); + +CK_RV +AESdecrypt(int senderId, int receiverId, void *in, size_t inLen, void *out, + size_t &outLen, AESKeyLength keyLength, AESChainingMode chainingMode, + size_t counter, std::string keyId); + +// encrypt-decrypt +size_t getEncryptedLen(int senderId, size_t inLen, bool isFirst); + +size_t getDecryptedLen(int senderId, size_t inLen, bool isFirst); + +CK_RV encrypt(int senderId, int receiverId, void *in, size_t inLen, void *out, + size_t outLen, void *signature, size_t signatureLen, + size_t counter); + +CK_RV decrypt(int senderId, int receiverId, void *in, size_t inLen, + void *signature, size_t signatureLen, void *out, size_t &outLen, + size_t counter); + +template +void deleteFromMap(std::map &streamingMap, int userId, + const std::string &mapName) +{ + // Find the userId in the map + auto it = streamingMap.find(userId); + + // Check if userId is found before attempting to erase + if (it != streamingMap.end()) { + streamingMap.erase(it); // Erase the user by iterator + log(logger::LogLevel::INFO, + "Deleted user: " + std::to_string(userId) + " from map " + mapName); + } + else { + log(logger::LogLevel::INFO, + "User: " + std::to_string(userId) + " not found in map " + mapName); + } +} +#endif // __CRYPTO_API_H__ diff --git a/hsm-server/include/crypto_service.h b/hsm-server/include/crypto_service.h new file mode 100644 index 00000000..ecc53ecc --- /dev/null +++ b/hsm-server/include/crypto_service.h @@ -0,0 +1,114 @@ +#include +#include +#include +#include "../proto/encryption.pb.h" +#include "../proto/encryption.grpc.pb.h" +#include "general.h" + +class CryptoServiceServer final : public crypto::CryptoService::Service { + public: + grpc::Status bootSystem(grpc::ServerContext *context, + const crypto::BootSystemRequest *request, + crypto::Empty *response) override; + grpc::Status addProccess(grpc::ServerContext *context, + const crypto::AddProcessRequest *request, + crypto::Empty *response) override; + grpc::Status configure(grpc::ServerContext *context, + const crypto::ConfigureRequest *request, + crypto::Empty *response) override; + grpc::Status encrypt(grpc::ServerContext *context, + const crypto::EncryptRequest *request, + crypto::EncryptResponse *response) override; + grpc::Status decrypt(grpc::ServerContext *context, + const crypto::DecryptRequest *request, + crypto::DecryptResponse *response) override; + grpc::Status generateAESKey( + grpc::ServerContext *context, + const crypto::GenerateAESKeyRequest *request, + crypto::GenerateAESKeyResponse *response) override; + grpc::Status generateRSAKeyPair( + grpc::ServerContext *context, + const crypto::GenerateKeyPairRequest *request, + crypto::GenerateKeyPairResponse *response) override; + grpc::Status generateECCKeyPair( + grpc::ServerContext *context, + const crypto::GenerateKeyPairRequest *request, + crypto::GenerateKeyPairResponse *response) override; + grpc::Status getSignedDataLength( + grpc::ServerContext *context, + const crypto::GetHashLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status getPublicECCKeyByUserId( + grpc::ServerContext *context, const crypto::KeyRequest *request, + crypto::KeyResponse *response) override; + grpc::Status getPublicRSAKeyByUserId( + grpc::ServerContext *context, const crypto::KeyRequest *request, + crypto::KeyResponse *response) override; + // ecc + grpc::Status getECCencryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status getECCDecryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status ECCencrypt( + grpc::ServerContext *context, + const crypto::AsymetricEncryptRequest *request, + crypto::AsymetricEncryptResponse *response) override; + grpc::Status ECCdecrypt( + grpc::ServerContext *context, + const crypto::AsymetricDecryptRequest *request, + crypto::AsymetricDecryptResponse *response) override; + // rsa + grpc::Status getRSAencryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status getRSAdecryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status RSAencrypt( + grpc::ServerContext *context, + const crypto::AsymetricEncryptRequest *request, + crypto::AsymetricEncryptResponse *response) override; + grpc::Status RSAdecrypt( + grpc::ServerContext *context, + const crypto::AsymetricDecryptRequest *request, + crypto::AsymetricDecryptResponse *response) override; + // aes + grpc::Status getAESencryptedLength( + grpc::ServerContext *context, + const crypto::GetAESLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status getAESdecryptedLength( + grpc::ServerContext *context, + const crypto::GetAESLengthRequest *request, + crypto::GetLengthResponse *response) override; + grpc::Status AESencrypt(grpc::ServerContext *context, + const crypto::AESEncryptRequest *request, + crypto::AESEncryptResponse *response) override; + grpc::Status AESdecrypt(grpc::ServerContext *context, + const crypto::AESDecryptRequest *request, + crypto::AESDecryptResponse *response) override; + //sign - verify + grpc::Status getEncryptedLen(grpc::ServerContext *context, + const crypto::GetWholeLength *request, + crypto::GetLengthResponse *response) override; + grpc::Status getDecryptedLen(grpc::ServerContext *context, + const crypto::GetWholeLength *request, + crypto::GetLengthResponse *response) override; + grpc::Status signUpdate(grpc::ServerContext *context, + const crypto::SignRequest *request, + crypto::SignResponse *response) override; + grpc::Status signFinalize(grpc::ServerContext *context, + const crypto::SignRequest *request, + crypto::SignResponse *response) override; + grpc::Status verifyUpdate(grpc::ServerContext *context, + const crypto::VerifyRequest *request, + crypto::VerifyResponse *response) override; + grpc::Status verifyFinalize(grpc::ServerContext *context, + const crypto::VerifyRequest *request, + crypto::VerifyResponse *response) override; + + private: + static const size_t HSM_ID = 1; +}; \ No newline at end of file diff --git a/hsm-server/include/debug_utils.h b/hsm-server/include/debug_utils.h new file mode 100644 index 00000000..41043cb3 --- /dev/null +++ b/hsm-server/include/debug_utils.h @@ -0,0 +1,39 @@ +#ifndef __DEBUG_UTILS_H__ +#define __DEBUG_UTILS_H__ + +#include +#include +#include +#include "general.h" +#include "aes_stream.h" +#include "ecc.h" + +#define START_TIMER \ + auto start_timer = std::chrono::high_resolution_clock::now(); + +#define END_TIMER(message) \ + auto end_timer = std::chrono::high_resolution_clock::now(); \ + std::chrono::duration elapsed = end_timer - start_timer; \ + std::cout << message << " took " << elapsed.count() << " seconds\n"; + +void printBufferHexa(const uint8_t *buffer, size_t len, std::string message); + +void encryptStartPrintParams(unsigned char block[], unsigned int inLen, + unsigned char *&out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength); +void encryptContinuePrintParams(unsigned char block[], unsigned int inLen, + unsigned char *&out, unsigned int &outLen); +void printStreamAES(const StreamAES &obj, size_t blockSize, + std::string message); +void printEncryptedMessage(const EncryptedMessage &message); +//Declaration of the debugLog functionvoid +void debugLog(const std::string &message, + const std::string &functionName); // Macro for easier use +#define DEBUG_LOG(msg) debugLog(msg, __func__) +#define LOG_BUFFER_HEXA(buffer, len, message) \ + logBufferHexa(buffer, len, message, __func__, __LINE__) +void logBufferHexa(const void *voidBuffer, size_t len, + const std::string &message, const char *callingFunction, + int line); + +#endif // __DEBUG_UTILS_H__ diff --git a/hsm-server/include/ecc.h b/hsm-server/include/ecc.h new file mode 100644 index 00000000..3d648ed6 --- /dev/null +++ b/hsm-server/include/ecc.h @@ -0,0 +1,91 @@ +#ifndef ECC_H_ +#define ECC_H_ +#pragma once + +#include +#include +#include +#include + +// Structure for representing a point +struct Point { + mpz_class x; + mpz_class y; + Point() : x(0), y(0) {} + Point(mpz_class x, mpz_class y) : x(x), y(y) {} +}; + +// Structure for representing an encrypted message +struct EncryptedMessage { + mpz_class c1X; + bool c1Y; + mpz_class c2X; + bool c2Y; + EncryptedMessage(mpz_class c1X, bool c1Y, mpz_class c2X, bool c2Y) + : c1X(c1X), c1Y(c1Y), c2X(c2X), c2Y(c2Y) + { + } +}; + +mpz_class generatePrivateKey(); +Point generatePublicKey(mpz_class key); +mpz_class calculateY(mpz_class x); +Point convertMessageToPoint(const std::string &text); +std::string convertPointToMessage(const Point &point); +EncryptedMessage encryptECC(std::vector message, Point publicKey); +std::vector decryptECC(EncryptedMessage ciphertext, + mpz_class privateKey); +mpz_class generateK(); +std::vector stringToUint8(const std::string &str); +std::string uint8ToString(const std::vector &uint8Vec); +Point multiply(Point P, mpz_class times); +Point add(Point P, Point Q); +mpz_class mod(mpz_class x); +bool isOnCurve(Point P); +mpz_class inverse(mpz_class base); +std::pair signMessageECC( + const std::vector &message, const mpz_class &privateKey); +bool modularSqrt(mpz_t result, const mpz_t a, const mpz_t p); +#else // ECC_NO_SYCL + +// Structure for representing a point +struct Point { + mpz_class x; + mpz_class y; + Point() : x(0), y(0) {} + Point(mpz_class x, mpz_class y) : x(x), y(y) {} +}; + +// Structure for representing an encrypted message +struct EncryptedMessage { + mpz_class c1X; + bool c1Y; + mpz_class c2X; + bool c2Y; + EncryptedMessage(mpz_class c1X, bool c1Y, mpz_class c2X, bool c2Y) + : c1X(c1X), c1Y(c1Y), c2X(c2X), c2Y(c2Y) + { + } +}; + +mpz_class generatePrivateKey(); +Point generatePublicKey(mpz_class key); +mpz_class calculateY(mpz_class x); +std::vector stringToUint8(const std::string &str); +std::string uint8ToString(const std::vector &uint8Vec); +Point convertMessageToPoint(const std::string &text); +std::string convertPointToMessage(const Point &point); +EncryptedMessage encryptECC(std::vector message, Point publicKey); +std::vector decryptECC(EncryptedMessage ciphertext, + mpz_class privateKey); +mpz_class generateK(); +Point multiply(Point P, mpz_class times); +Point add(Point P, Point Q); +mpz_class mod(mpz_class x); +bool isOnCurve(Point P); +mpz_class inverse(mpz_class base); +std::pair signMessageECC( + const std::vector &message, const mpz_class &privateKey); +bool modularSqrt(mpz_t result, const mpz_t a, const mpz_t p); + +#endif // USE_SYCL \ No newline at end of file diff --git a/hsm-server/include/general.h b/hsm-server/include/general.h new file mode 100644 index 00000000..2292bf68 --- /dev/null +++ b/hsm-server/include/general.h @@ -0,0 +1,66 @@ +#ifndef __GENERAL_H__ +#define __GENERAL_H__ +#include "../logger/logger.h" + +typedef unsigned long CK_RV; + +/* Successful operation */ +constexpr CK_RV CKR_OK = 0x00000000; // 0 +/* General failure when a function could not complete its intended task */ +constexpr CK_RV CKR_FUNCTION_FAILED = 0x00000006; // 6 +/* Invalid arguments provided to the function (e.g., null pointers or invalid values) */ +constexpr CK_RV CKR_ARGUMENTS_BAD = 0x00000007; // 7 +/* Key size is out of the allowed range (e.g., key length is too short or too long) */ +constexpr CK_RV CKR_KEY_SIZE_RANGE = 0x00000162; // 354 +/* Buffer provided by the user is too small to hold the required data (e.g., during encryption or decryption) */ +constexpr CK_RV CKR_BUFFER_TOO_SMALL = 0x00000150; // 336 +/* The function attempted to generate a key, but key generation is not permitted or failed */ +constexpr CK_RV CKR_KEY_FUNCTION_NOT_PERMITTED = 0x00000068; // 104 +/* Decryption was attempted, but the decrypted data is invalid (e.g., data was corrupted) */ +constexpr CK_RV CKR_DECRYPTED_DATA_INVALID = 0x00000064; // 100 +/* Encrypted data has invalid padding (e.g., during decryption or when verifying padding) */ +constexpr CK_RV CKR_ENCRYPTED_DATA_INVALID = 0x00000063; // 99 +/* Data provided for encryption is too large for the RSA key */ +constexpr CK_RV CKR_DATA_TOO_LARGE = 0x00000080; // 128 +/* User is not authorized to access or use the requested key */ +constexpr CK_RV CKR_USER_NOT_AUTHORIZED = 0x00000100; // 256 +/* Signature or hash did not match */ +constexpr CK_RV CKR_SIGNATURE_INVALID = 0x000000C0; // 192 +/*user sent an empty buffer to be encrypted or decrypted*/ +constexpr CK_RV CKR_EMPTY_BUFFER = 0x00000200; // 512 +/* User is not logged in or user does not exist */ +constexpr CK_RV CKR_USER_NOT_LOGGED_IN = 0x00000101; // 257 + +enum KeyPermission { VERIFY, SIGN, ENCRYPT, DECRYPT, EXPORTABLE }; +enum AsymmetricFunction { RSA, ECC }; +enum SHAAlgorithm { SHA_256, SHA_3_512 }; +enum AESChainingMode { + ECB, /*Electronic Codebook*/ + CBC, /*Cipher Block Chaining*/ + CFB, /*Cipher Feedback*/ + OFB, /*Output Feedback*/ + CTR /*Counter*/ +}; +enum AESKeyLength { AES_128 = 16, AES_192 = 24, AES_256 = 32 }; + +struct CryptoConfig { + SHAAlgorithm hashFunction; // Hash function algorithm + AESKeyLength aesKeyLength; // AES key length + AESChainingMode aesChainingMode; // AES chaining mode + AsymmetricFunction asymmetricFunction; // Asymmetric encryption function + + CryptoConfig(SHAAlgorithm hashFunc, AESKeyLength aesLen, + AESChainingMode aesMode, AsymmetricFunction asymFunc) + : hashFunction(hashFunc), + aesKeyLength(aesLen), + aesChainingMode(aesMode), + asymmetricFunction(asymFunc) + { + } + CryptoConfig() {} +}; +void log(logger::LogLevel level, const std::string &message); + +bool isValidAESKeyLength(AESKeyLength aesKeyLength); +void signalHandler(int signum); +#endif // __GENERAL_H__ diff --git a/hsm-server/include/hash_factory.h b/hsm-server/include/hash_factory.h new file mode 100644 index 00000000..bd23037c --- /dev/null +++ b/hsm-server/include/hash_factory.h @@ -0,0 +1,23 @@ +#ifndef FACTORY_MANAGER_H +#define FACTORY_MANAGER_H + +#include "IHash.h" +#include "SHA3-512.h" +#include "general.h" +#include "sha256.h" +#include +#include +#include + +class HashFactory { + public: + static HashFactory &getInstance(); + CK_RV create(const SHAAlgorithm &type, + std::unique_ptr &hashPtr) const; + + private: + std::map()>> factories; + HashFactory(); // Private constructor for singleton pattern. +}; + +#endif // FACTORY_MANAGER_H \ No newline at end of file diff --git a/hsm-server/include/my_logger.h b/hsm-server/include/my_logger.h new file mode 100644 index 00000000..1e3b3abb --- /dev/null +++ b/hsm-server/include/my_logger.h @@ -0,0 +1,13 @@ +#ifndef MY_LOGGER_H +#define MY_LOGGER_H + +#include +#include +#include +#include "../logger/logger.h" + +void log(logger::LogLevel loglevel, const std::string &hsm_id, + const std::string &user_id, const std::string &message); +std::string dataToHex(const unsigned char *data, size_t size); + +#endif // LOGGER_H diff --git a/hsm-server/include/prime_tests.h b/hsm-server/include/prime_tests.h new file mode 100644 index 00000000..871a29f5 --- /dev/null +++ b/hsm-server/include/prime_tests.h @@ -0,0 +1,25 @@ +#ifndef __PRIME_TESTS_H__ +#define __PRIME_TESTS_H__ +#include "big_int64.h" +#include "../logger/logger.h" + +bool millerRabinPrimalityTest(const BigInt64 &number, size_t k); +bool fermatPrimalityTest(const BigInt64 &number, size_t k); +bool isDivisibleBySmallPrimes(const BigInt64 &n); +BigInt64 nextPrimeSequential(const BigInt64 &number, size_t k); +BigInt64 nextPrimeDivideToChunks(const BigInt64 &number, size_t k); + +#ifdef USE_SYCL +#include +bool isDivisibleBySmallPrimesUSM(sycl::queue &q, const BigInt64 &n); +bool isDivisibleBySmallPrimesBuffers(sycl::queue &q, const BigInt64 &n); +bool millerRabinPrimalityTestUSM(sycl::queue &q, const BigInt64 &number, + size_t k); +bool millerRabinPrimalityTestBuffers(sycl::queue &q, const BigInt64 &number, + size_t k); +#else + +bool millerRabinPrimalityTestThreads(const BigInt64 &number, size_t k); + +#endif +#endif // __PRIME_TESTS_H__ \ No newline at end of file diff --git a/hsm-server/include/rsa.h b/hsm-server/include/rsa.h new file mode 100644 index 00000000..338cbdbb --- /dev/null +++ b/hsm-server/include/rsa.h @@ -0,0 +1,20 @@ +#ifndef __RSA_H__ +#define __RSA_H__ + +#include "general.h" + +CK_RV rsaGenerateKeys(size_t keySize, uint8_t *pubKey, size_t pubLen, + uint8_t *privKey, size_t privLen); +CK_RV rsaEncrypt(const uint8_t *plaintext, size_t plaintextLen, + const uint8_t *key, size_t keyLen, uint8_t *ciphertext, + size_t ciphertextLen, size_t keySize); +CK_RV rsaDecrypt(const uint8_t *ciphertext, size_t ciphertextLen, + const uint8_t *key, size_t keyLen, uint8_t *plaintext, + size_t *plaintextLen, size_t keySize); +size_t rsaGetEncryptedLen(size_t keySize); +size_t rsaGetPlainMaxLen(size_t keySize); +size_t rsaGetDecryptedLen(size_t keySize); +size_t rsaGetPublicKeyLen(size_t keySize); +size_t rsaGetPrivateKeyLen(size_t keySize); + +#endif // __RSA_H__ \ No newline at end of file diff --git a/hsm-server/include/sha256.h b/hsm-server/include/sha256.h new file mode 100644 index 00000000..565aa6d3 --- /dev/null +++ b/hsm-server/include/sha256.h @@ -0,0 +1,39 @@ +#ifndef SHA256_H +#define SHA256_H + +#include "../logger/logger.h" +#include "IHash.h" +#include "general.h" +#include +#include +#include + +class SHA256 : public IHash { + private: + uint32_t result[8]; + uint8_t message[64]; + size_t messageSize; + size_t bitLength; + const uint32_t bytes[64] = { + // SHA-256 constants + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; + CK_RV transform(); + void padding(); + + public: + SHA256(); + CK_RV update(const std::vector &data) override; + CK_RV finalize(std::vector &output) override; +}; + +#endif // SHA256_H \ No newline at end of file diff --git a/hsm-server/include/temp_hsm.h b/hsm-server/include/temp_hsm.h new file mode 100644 index 00000000..5bf93db7 --- /dev/null +++ b/hsm-server/include/temp_hsm.h @@ -0,0 +1,233 @@ +#ifndef __TEMP_HSM_H__ +#define __TEMP_HSM_H__ + +#include "aes.h" +#include "debug_utils.h" +#include "ecc.h" +#include "general.h" +#include "rsa.h" +#include +#include +#include +#include +#include +#include +constexpr size_t RSA_KEY_SIZE = 1024; + +const std::string AES_KEY_ID = "AESKey"; +const std::string RSA_PUB_KEY_ID = "RSAPubKey"; +const std::string RSA_PRIV_KEY_ID = "RSAPrivKey"; +const std::string ECC_PUB_KEY_ID = "ECCPubKey"; +const std::string ECC_PRIV_KEY_ID = "ECCPrivKey"; + +class TempHsm { + public: + // Deleted to avoid copying and assignment + TempHsm(const TempHsm &) = delete; + TempHsm &operator=(const TempHsm &) = delete; + + // Access the singleton instance + static TempHsm &getInstance() + { + static TempHsm instance; + return instance; + } + // configure a user + void configure(int userId, CryptoConfig config) + { + usersConfig[userId] = CryptoConfig(config); + } + // AES key generation for a specific user + std::string generateAESKey(int ownerId, AESKeyLength aesKeyLength, + const std::vector &permissions, + int destUserId) + { + std::string keyId = AES_KEY_ID + std::to_string(ownerId); + keyIdUsersPermissions[keyId] = {{ownerId, permissions}, + {destUserId, {KeyPermission::DECRYPT}}}; + int keySize = aesKeyLengthData[aesKeyLength].keySize; + std::shared_ptr key = + std::shared_ptr(new unsigned char[keySize]); + generateKey(key.get(), aesKeyLength); + + aesKeys[keyId].first = key; + aesKeys[keyId].second = keySize; + + return keyId; + } + + // RSA key pair generation for a specific user + std::pair generateRSAKeyPair( + int userId, const std::vector &permissions) + { + std::string pubKeyId = RSA_PUB_KEY_ID + std::to_string(userId); + std::string privKeyId = RSA_PRIV_KEY_ID + std::to_string(userId); + // ASK:: does he give other premossions? and premissions to private and + // public? + // Store key pair with permissions + keyIdUsersPermissions[pubKeyId] = { + {userId, permissions}, + {-1, {KeyPermission::DECRYPT, KeyPermission::ENCRYPT}}}; + keyIdUsersPermissions[privKeyId] = {{userId, permissions}}; + size_t pubLen = rsaGetPublicKeyLen(RSA_KEY_SIZE); + size_t priLen = rsaGetPrivateKeyLen(RSA_KEY_SIZE); + uint8_t *pubBuff = new uint8_t[pubLen]; + uint8_t *priBuff = new uint8_t[priLen]; + + CK_RV rv1 = + rsaGenerateKeys(RSA_KEY_SIZE, pubBuff, pubLen, priBuff, priLen); + + // Assuming keys is a map + rsaKeys[pubKeyId].first = pubBuff; + rsaKeys[pubKeyId].second = pubLen; + rsaKeys[privKeyId].first = priBuff; + rsaKeys[privKeyId].second = priLen; + + return {pubKeyId, privKeyId}; + } + + // ECC key pair generation for a specific user + std::pair generateECCKeyPair( + int userId, const std::vector &permissions) + { + std::string pubKeyId = ECC_PUB_KEY_ID + std::to_string(userId); + std::string privKeyId = ECC_PRIV_KEY_ID + std::to_string(userId); + + // Store key pair with permissions + keyIdUsersPermissions[pubKeyId] = { + {userId, permissions}, + {-1, {KeyPermission::DECRYPT, KeyPermission::ENCRYPT}}}; + keyIdUsersPermissions[privKeyId] = {{userId, permissions}}; + mpz_class privateKey = generatePrivateKey(); + Point publicKey = generatePublicKey(privateKey); + + // Assuming keys is a map + eccPublicKeys[pubKeyId] = publicKey; + eccPrivateKeys[privKeyId] = privateKey; + + return {pubKeyId, privKeyId}; + } + + // Retrieve public key ID for a user + std::string getPublicKeyIdByUserId(int userId, AsymmetricFunction function) + { + std::string publicKeyId; + if (function == ECC) + publicKeyId = ECC_PUB_KEY_ID + std::to_string(userId); + else + publicKeyId = RSA_PUB_KEY_ID + std::to_string(userId); + return publicKeyId; + } + + // Get private key ID for a user + std::string getPrivateKeyIdByUserId(int userId, AsymmetricFunction function) + { + std::string privateKeyId; + if (function == ECC) + privateKeyId = ECC_PRIV_KEY_ID + std::to_string(userId); + else + privateKeyId = RSA_PRIV_KEY_ID + std::to_string(userId); + return privateKeyId; + } + + std::pair, int> getAESKey( + int userId, const std::string &keyId, KeyPermission usage) + { + checkPermission(keyId, userId, usage); + // If the usage is DECRYPT, delete it after returning a deep copy + if (usage == KeyPermission::DECRYPT) { + // Get the original key and its length + std::shared_ptr originalKey(aesKeys[keyId].first); + int keyLength = aesKeys[keyId].second; + + // Deep copy the key before deleting it + aesKeys.erase(keyId); // Remove the key entry from the map + + // Remove permissions associated with the key + keyIdUsersPermissions[keyId].clear(); + + // Return the copied key and its length as a pair + return {originalKey, keyLength}; + } + return aesKeys[keyId]; + } + + std::pair getRSAKey(int userId, const std::string &keyId, + KeyPermission usage) + { + checkPermission(keyId, userId, usage); + return rsaKeys[keyId]; + } + + mpz_class getECCPrivateKey(int userId, const std::string &keyId, + KeyPermission usage) + { + checkPermission(keyId, userId, usage); + return eccPrivateKeys[keyId]; + } + + Point getECCPublicKey(int userId, const std::string &keyId, + KeyPermission usage) + { + checkPermission(keyId, userId, usage); + return eccPublicKeys[keyId]; + } + CryptoConfig getUserConfig(int userId) + { + // Check if the user exists in the configuration map + if (usersConfig.find(userId) != usersConfig.end()) { + return usersConfig[userId]; // Return user config if found + } + else { + log(logger::LogLevel::ERROR, "User ID " + std::to_string(userId) + + " not found in configuration."); + throw std::runtime_error("User config not found for user ID: " + + std::to_string(userId)); + } + } + + AsymmetricFunction getAssymetricFunctionByUserId(int userId) + { + return usersConfig[userId].asymmetricFunction; + } + + // Function to check permissions and throw a basic error if denied + void checkPermission(const std::string &keyId, int userId, + KeyPermission usage) + { + // First, check if the permission is for all users (-1) + if (keyIdUsersPermissions[keyId].count(-1) > 0) { + const std::vector &globalPermissions = + keyIdUsersPermissions[keyId][-1]; + if (std::find(globalPermissions.begin(), globalPermissions.end(), + usage) != globalPermissions.end()) { + // Permission granted for all users + return; + } + } + + // If not granted for all users, check specific user permissions + const std::vector &permissions = + keyIdUsersPermissions[keyId][userId]; + if (std::find(permissions.begin(), permissions.end(), usage) == + permissions.end()) { + throw std::runtime_error("Permission denied for keyId: " + keyId + + " and userId: " + std::to_string(userId)); + } + } + + private: + TempHsm() {} + + // For each user, store configurations, keys, and permissions + std::unordered_map usersConfig; + std::unordered_map>> + keyIdUsersPermissions; + std::unordered_map, int>> + aesKeys; + std::unordered_map> rsaKeys; + std::unordered_map eccPublicKeys; + std::unordered_map eccPrivateKeys; +}; +#endif // __TEMP_HSM_H__ \ No newline at end of file diff --git a/logger/logger.cpp b/hsm-server/logger/logger.cpp similarity index 58% rename from logger/logger.cpp rename to hsm-server/logger/logger.cpp index 4d6665e0..d25b2a22 100644 --- a/logger/logger.cpp +++ b/hsm-server/logger/logger.cpp @@ -2,29 +2,39 @@ std::string logger::logFileName; std::mutex logger::logMutex; -std::chrono::system_clock::time_point logger::initTime=std::chrono::system_clock::now(); +std::chrono::system_clock::time_point logger::initTime = + std::chrono::system_clock::now(); std::string logger::componentName = "out"; logger::logger(std::string componentName) { - logger::componentName=componentName; + logger::componentName = componentName; +} +logger::~logger() +{ + cleanUp(); } void logger::initializeLogFile() { - if (isInitialized) return; + if (isInitialized) + return; auto time = std::chrono::system_clock::to_time_t(initTime); std::tm tm = *std::localtime(&time); std::ostringstream oss; - oss << "" << std::put_time(&tm, "%Y_%m_%d_%H_%M_%S") << "_" << componentName << ".log"; + oss << "" << std::put_time(&tm, "%Y_%m_%d_%H_%M_%S") << "_" << componentName + << ".log"; logFileName = oss.str(); - - std::ofstream sharedFile(sharedLogFileName, std::ios::out | std::ios::trunc); + + std::ofstream sharedFile(sharedLogFileName, + std::ios::out | std::ios::trunc); if (sharedFile) { sharedFile << logFileName; - } else { - std::cerr << logLevelToString(LogLevel::ERROR) << "Failed to open shared log file name file" << std::endl; + } + else { + std::cerr << logLevelToString(LogLevel::ERROR) + << "Failed to open shared log file name file" << std::endl; } isInitialized = true; @@ -55,10 +65,14 @@ void logger::cleanUp() std::string logger::logLevelToString(LogLevel level) { switch (level) { - case LogLevel::ERROR: return "[ERROR]"; - case LogLevel::INFO: return "[INFO]"; - case LogLevel::DEBUG: return "[DEBUG]"; - default: return "[UNKNOWN]"; + case LogLevel::ERROR: + return "[ERROR]"; + case LogLevel::INFO: + return "[INFO]"; + case LogLevel::DEBUG: + return "[DEBUG]"; + default: + return "[UNKNOWN]"; } } @@ -79,40 +93,44 @@ bool logger::shouldLog(LogLevel level) std::string logger::getElapsedTime() { auto now = std::chrono::system_clock::now(); - auto elapsed = std::chrono::duration_cast(now - initTime).count(); + auto elapsed = + std::chrono::duration_cast(now - initTime) + .count(); return std::to_string(elapsed) + "ns"; } -void logger::logMessage(LogLevel level, std::string src, std::string dst, const std::string &message) +void logger::logMessage(LogLevel level, std::string src, std::string dst, + const std::string &message) { - if (!shouldLog(level)) return; + if (!shouldLog(level)) + return; std::lock_guard guard(logMutex); std::ofstream logFile(getLogFileName(), std::ios_base::app); if (!logFile) { - std::cerr << logLevelToString(LogLevel::ERROR) << "Failed to open log file" << std::endl; + std::cerr << logLevelToString(LogLevel::ERROR) + << "Failed to open log file" << std::endl; return; } - logFile << "[" << getElapsedTime() << "] " - << logLevelToString(level) << " " + logFile << "[" << getElapsedTime() << "] " << logLevelToString(level) << " " << "SRC " << src << " " - << "DST " << dst << " " - << message << std::endl; + << "DST " << dst << " " << message << std::endl; } void logger::logMessage(LogLevel level, const std::string &message) { - if (!shouldLog(level)) return; + if (!shouldLog(level)) + return; std::lock_guard guard(logMutex); std::ofstream logFile(getLogFileName(), std::ios_base::app); if (!logFile) { - std::cerr << logLevelToString(LogLevel::ERROR) << "Failed to open log file" << std::endl; + std::cerr << logLevelToString(LogLevel::ERROR) + << "Failed to open log file" << std::endl; return; } - logFile << "[" << getElapsedTime() << "] " - << logLevelToString(level) << " " + logFile << "[" << getElapsedTime() << "] " << logLevelToString(level) << " " << message << std::endl; -} \ No newline at end of file +} diff --git a/logger/logger.h b/hsm-server/logger/logger.h similarity index 88% rename from logger/logger.h rename to hsm-server/logger/logger.h index ab79ee59..abd27e14 100644 --- a/logger/logger.h +++ b/hsm-server/logger/logger.h @@ -1,34 +1,37 @@ #ifndef LOGGER_H #define LOGGER_H -#include #include -#include -#include #include +#include #include #include +#include +#include #ifndef LOG_LEVEL #define LOG_LEVEL logger::LogLevel::INFO #endif class logger { -public: + public: enum class LogLevel { ERROR, INFO, DEBUG, }; - logger(){} + logger() {} logger(std::string componentName); + ~logger(); void logMessage(LogLevel level, const std::string &message); - void logMessage(LogLevel level, std::string src, std::string dst, const std::string &message); + void logMessage(LogLevel level, std::string src, std::string dst, + const std::string &message); void initializeLogFile(); std::string getLogFileName(); std::string sharedLogFileName = "shared_log_file_name.txt"; void cleanUp(); -private: + + private: static std::string logLevelToString(LogLevel level); static bool shouldLog(LogLevel level); static std::string getElapsedTime(); @@ -39,4 +42,4 @@ class logger { static std::chrono::system_clock::time_point initTime; }; -#endif // LOGGER_H \ No newline at end of file +#endif // LOGGER_H diff --git a/hsm-server/proto/encryption.grpc.pb.cc b/hsm-server/proto/encryption.grpc.pb.cc new file mode 100644 index 00000000..552b5e59 --- /dev/null +++ b/hsm-server/proto/encryption.grpc.pb.cc @@ -0,0 +1,1346 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: proto/encryption.proto + +#include "encryption.pb.h" +#include "encryption.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace crypto { + +static const char* CryptoService_method_names[] = { + "/crypto.CryptoService/bootSystem", + "/crypto.CryptoService/addProccess", + "/crypto.CryptoService/configure", + "/crypto.CryptoService/generateAESKey", + "/crypto.CryptoService/generateRSAKeyPair", + "/crypto.CryptoService/generateECCKeyPair", + "/crypto.CryptoService/getSignedDataLength", + "/crypto.CryptoService/getECCencryptedLength", + "/crypto.CryptoService/getECCDecryptedLength", + "/crypto.CryptoService/getRSAencryptedLength", + "/crypto.CryptoService/getRSAdecryptedLength", + "/crypto.CryptoService/getAESencryptedLength", + "/crypto.CryptoService/getAESdecryptedLength", + "/crypto.CryptoService/getEncryptedLen", + "/crypto.CryptoService/getDecryptedLen", + "/crypto.CryptoService/sign", + "/crypto.CryptoService/verify", + "/crypto.CryptoService/getPublicECCKeyByUserId", + "/crypto.CryptoService/getPublicRSAKeyByUserId", + "/crypto.CryptoService/ECCencrypt", + "/crypto.CryptoService/ECCdecrypt", + "/crypto.CryptoService/RSAencrypt", + "/crypto.CryptoService/RSAdecrypt", + "/crypto.CryptoService/AESencrypt", + "/crypto.CryptoService/AESdecrypt", + "/crypto.CryptoService/encrypt", + "/crypto.CryptoService/decrypt", + "/crypto.CryptoService/signUpdate", + "/crypto.CryptoService/signFinalize", + "/crypto.CryptoService/verifyUpdate", + "/crypto.CryptoService/verifyFinalize", +}; + +std::unique_ptr< CryptoService::Stub> CryptoService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { + (void)options; + std::unique_ptr< CryptoService::Stub> stub(new CryptoService::Stub(channel, options)); + return stub; +} + +CryptoService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) + : channel_(channel), rpcmethod_bootSystem_(CryptoService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_addProccess_(CryptoService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_configure_(CryptoService_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_generateAESKey_(CryptoService_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_generateRSAKeyPair_(CryptoService_method_names[4], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_generateECCKeyPair_(CryptoService_method_names[5], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getSignedDataLength_(CryptoService_method_names[6], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getECCencryptedLength_(CryptoService_method_names[7], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getECCDecryptedLength_(CryptoService_method_names[8], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getRSAencryptedLength_(CryptoService_method_names[9], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getRSAdecryptedLength_(CryptoService_method_names[10], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getAESencryptedLength_(CryptoService_method_names[11], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getAESdecryptedLength_(CryptoService_method_names[12], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getEncryptedLen_(CryptoService_method_names[13], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getDecryptedLen_(CryptoService_method_names[14], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_sign_(CryptoService_method_names[15], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_verify_(CryptoService_method_names[16], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getPublicECCKeyByUserId_(CryptoService_method_names[17], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_getPublicRSAKeyByUserId_(CryptoService_method_names[18], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_ECCencrypt_(CryptoService_method_names[19], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_ECCdecrypt_(CryptoService_method_names[20], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_RSAencrypt_(CryptoService_method_names[21], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_RSAdecrypt_(CryptoService_method_names[22], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_AESencrypt_(CryptoService_method_names[23], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_AESdecrypt_(CryptoService_method_names[24], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_encrypt_(CryptoService_method_names[25], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_decrypt_(CryptoService_method_names[26], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_signUpdate_(CryptoService_method_names[27], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_signFinalize_(CryptoService_method_names[28], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_verifyUpdate_(CryptoService_method_names[29], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_verifyFinalize_(CryptoService_method_names[30], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + {} + +::grpc::Status CryptoService::Stub::bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::crypto::Empty* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::BootSystemRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_bootSystem_, context, request, response); +} + +void CryptoService::Stub::async::bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::BootSystemRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_bootSystem_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_bootSystem_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::PrepareAsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::Empty, ::crypto::BootSystemRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_bootSystem_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::AsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncbootSystemRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::crypto::Empty* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AddProcessRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_addProccess_, context, request, response); +} + +void CryptoService::Stub::async::addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AddProcessRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_addProccess_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_addProccess_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::PrepareAsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::Empty, ::crypto::AddProcessRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_addProccess_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::AsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncaddProccessRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::crypto::Empty* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::ConfigureRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_configure_, context, request, response); +} + +void CryptoService::Stub::async::configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::ConfigureRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_configure_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_configure_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::PrepareAsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::Empty, ::crypto::ConfigureRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_configure_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::Empty>* CryptoService::Stub::AsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncconfigureRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::crypto::GenerateAESKeyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_generateAESKey_, context, request, response); +} + +void CryptoService::Stub::async::generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateAESKey_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateAESKey_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>* CryptoService::Stub::PrepareAsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GenerateAESKeyResponse, ::crypto::GenerateAESKeyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_generateAESKey_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>* CryptoService::Stub::AsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgenerateAESKeyRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_generateRSAKeyPair_, context, request, response); +} + +void CryptoService::Stub::async::generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateRSAKeyPair_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateRSAKeyPair_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* CryptoService::Stub::PrepareAsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GenerateKeyPairResponse, ::crypto::GenerateKeyPairRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_generateRSAKeyPair_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* CryptoService::Stub::AsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgenerateRSAKeyPairRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_generateECCKeyPair_, context, request, response); +} + +void CryptoService::Stub::async::generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateECCKeyPair_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_generateECCKeyPair_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* CryptoService::Stub::PrepareAsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GenerateKeyPairResponse, ::crypto::GenerateKeyPairRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_generateECCKeyPair_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* CryptoService::Stub::AsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgenerateECCKeyPairRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getSignedDataLength_, context, request, response); +} + +void CryptoService::Stub::async::getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getSignedDataLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getSignedDataLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetHashLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getSignedDataLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetSignedDataLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getECCencryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getECCencryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getECCencryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getECCencryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetECCencryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getECCDecryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getECCDecryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getECCDecryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getECCDecryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetECCDecryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getRSAencryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getRSAencryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getRSAencryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getRSAencryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetRSAencryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getRSAdecryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getRSAdecryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getRSAdecryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getRSAdecryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetRSAdecryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getAESencryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getAESencryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getAESencryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetAESLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getAESencryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetAESencryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getAESdecryptedLength_, context, request, response); +} + +void CryptoService::Stub::async::getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getAESdecryptedLength_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getAESdecryptedLength_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetAESLengthRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getAESdecryptedLength_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetAESdecryptedLengthRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getEncryptedLen_, context, request, response); +} + +void CryptoService::Stub::async::getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getEncryptedLen_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getEncryptedLen_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetWholeLength, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getEncryptedLen_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetEncryptedLenRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getDecryptedLen_, context, request, response); +} + +void CryptoService::Stub::async::getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getDecryptedLen_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getDecryptedLen_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::PrepareAsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::GetLengthResponse, ::crypto::GetWholeLength, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getDecryptedLen_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* CryptoService::Stub::AsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetDecryptedLenRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::sign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_sign_, context, request, response); +} + +void CryptoService::Stub::async::sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sign_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sign_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::PrepareAsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::SignResponse, ::crypto::SignRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_sign_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::AsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncsignRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_verify_, context, request, response); +} + +void CryptoService::Stub::async::verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verify_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verify_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::PrepareAsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::VerifyResponse, ::crypto::VerifyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_verify_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::AsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncverifyRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getPublicECCKeyByUserId_, context, request, response); +} + +void CryptoService::Stub::async::getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getPublicECCKeyByUserId_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getPublicECCKeyByUserId_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* CryptoService::Stub::PrepareAsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::KeyResponse, ::crypto::KeyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getPublicECCKeyByUserId_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* CryptoService::Stub::AsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetPublicECCKeyByUserIdRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_getPublicRSAKeyByUserId_, context, request, response); +} + +void CryptoService::Stub::async::getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getPublicRSAKeyByUserId_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_getPublicRSAKeyByUserId_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* CryptoService::Stub::PrepareAsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::KeyResponse, ::crypto::KeyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_getPublicRSAKeyByUserId_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* CryptoService::Stub::AsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncgetPublicRSAKeyByUserIdRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_ECCencrypt_, context, request, response); +} + +void CryptoService::Stub::async::ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_ECCencrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_ECCencrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* CryptoService::Stub::PrepareAsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AsymetricEncryptResponse, ::crypto::AsymetricEncryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_ECCencrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* CryptoService::Stub::AsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncECCencryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_ECCdecrypt_, context, request, response); +} + +void CryptoService::Stub::async::ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_ECCdecrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_ECCdecrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* CryptoService::Stub::PrepareAsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AsymetricDecryptResponse, ::crypto::AsymetricDecryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_ECCdecrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* CryptoService::Stub::AsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncECCdecryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_RSAencrypt_, context, request, response); +} + +void CryptoService::Stub::async::RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RSAencrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RSAencrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* CryptoService::Stub::PrepareAsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AsymetricEncryptResponse, ::crypto::AsymetricEncryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_RSAencrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* CryptoService::Stub::AsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncRSAencryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_RSAdecrypt_, context, request, response); +} + +void CryptoService::Stub::async::RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RSAdecrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_RSAdecrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* CryptoService::Stub::PrepareAsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AsymetricDecryptResponse, ::crypto::AsymetricDecryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_RSAdecrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* CryptoService::Stub::AsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncRSAdecryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::crypto::AESEncryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_AESencrypt_, context, request, response); +} + +void CryptoService::Stub::async::AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AESencrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AESencrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>* CryptoService::Stub::PrepareAsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AESEncryptResponse, ::crypto::AESEncryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_AESencrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>* CryptoService::Stub::AsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncAESencryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::crypto::AESDecryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_AESdecrypt_, context, request, response); +} + +void CryptoService::Stub::async::AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AESdecrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_AESdecrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>* CryptoService::Stub::PrepareAsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::AESDecryptResponse, ::crypto::AESDecryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_AESdecrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>* CryptoService::Stub::AsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncAESdecryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::crypto::EncryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::EncryptRequest, ::crypto::EncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_encrypt_, context, request, response); +} + +void CryptoService::Stub::async::encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::EncryptRequest, ::crypto::EncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_encrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_encrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>* CryptoService::Stub::PrepareAsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::EncryptResponse, ::crypto::EncryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_encrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>* CryptoService::Stub::AsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncencryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::crypto::DecryptResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::DecryptRequest, ::crypto::DecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_decrypt_, context, request, response); +} + +void CryptoService::Stub::async::decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::DecryptRequest, ::crypto::DecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_decrypt_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_decrypt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>* CryptoService::Stub::PrepareAsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::DecryptResponse, ::crypto::DecryptRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_decrypt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>* CryptoService::Stub::AsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncdecryptRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_signUpdate_, context, request, response); +} + +void CryptoService::Stub::async::signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_signUpdate_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_signUpdate_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::PrepareAsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::SignResponse, ::crypto::SignRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_signUpdate_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::AsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncsignUpdateRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_signFinalize_, context, request, response); +} + +void CryptoService::Stub::async::signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_signFinalize_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_signFinalize_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::PrepareAsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::SignResponse, ::crypto::SignRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_signFinalize_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* CryptoService::Stub::AsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncsignFinalizeRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_verifyUpdate_, context, request, response); +} + +void CryptoService::Stub::async::verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verifyUpdate_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verifyUpdate_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::PrepareAsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::VerifyResponse, ::crypto::VerifyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_verifyUpdate_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::AsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncverifyUpdateRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status CryptoService::Stub::verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_verifyFinalize_, context, request, response); +} + +void CryptoService::Stub::async::verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verifyFinalize_, context, request, response, std::move(f)); +} + +void CryptoService::Stub::async::verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_verifyFinalize_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::PrepareAsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::crypto::VerifyResponse, ::crypto::VerifyRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_verifyFinalize_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* CryptoService::Stub::AsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncverifyFinalizeRaw(context, request, cq); + result->StartCall(); + return result; +} + +CryptoService::Service::Service() { + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[0], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::BootSystemRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::BootSystemRequest* req, + ::crypto::Empty* resp) { + return service->bootSystem(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[1], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AddProcessRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AddProcessRequest* req, + ::crypto::Empty* resp) { + return service->addProccess(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[2], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::ConfigureRequest, ::crypto::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::ConfigureRequest* req, + ::crypto::Empty* resp) { + return service->configure(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[3], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GenerateAESKeyRequest* req, + ::crypto::GenerateAESKeyResponse* resp) { + return service->generateAESKey(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[4], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GenerateKeyPairRequest* req, + ::crypto::GenerateKeyPairResponse* resp) { + return service->generateRSAKeyPair(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[5], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GenerateKeyPairRequest* req, + ::crypto::GenerateKeyPairResponse* resp) { + return service->generateECCKeyPair(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[6], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetHashLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getSignedDataLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[7], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getECCencryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[8], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getECCDecryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[9], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getRSAencryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[10], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getRSAdecryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[11], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetAESLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getAESencryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[12], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetAESLengthRequest* req, + ::crypto::GetLengthResponse* resp) { + return service->getAESdecryptedLength(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[13], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetWholeLength* req, + ::crypto::GetLengthResponse* resp) { + return service->getEncryptedLen(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[14], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::GetWholeLength, ::crypto::GetLengthResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::GetWholeLength* req, + ::crypto::GetLengthResponse* resp) { + return service->getDecryptedLen(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[15], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::SignRequest* req, + ::crypto::SignResponse* resp) { + return service->sign(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[16], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::VerifyRequest* req, + ::crypto::VerifyResponse* resp) { + return service->verify(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[17], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::KeyRequest* req, + ::crypto::KeyResponse* resp) { + return service->getPublicECCKeyByUserId(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[18], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::KeyRequest, ::crypto::KeyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::KeyRequest* req, + ::crypto::KeyResponse* resp) { + return service->getPublicRSAKeyByUserId(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[19], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AsymetricEncryptRequest* req, + ::crypto::AsymetricEncryptResponse* resp) { + return service->ECCencrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[20], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AsymetricDecryptRequest* req, + ::crypto::AsymetricDecryptResponse* resp) { + return service->ECCdecrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[21], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AsymetricEncryptRequest* req, + ::crypto::AsymetricEncryptResponse* resp) { + return service->RSAencrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[22], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AsymetricDecryptRequest* req, + ::crypto::AsymetricDecryptResponse* resp) { + return service->RSAdecrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[23], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AESEncryptRequest* req, + ::crypto::AESEncryptResponse* resp) { + return service->AESencrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[24], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::AESDecryptRequest* req, + ::crypto::AESDecryptResponse* resp) { + return service->AESdecrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[25], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::EncryptRequest, ::crypto::EncryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::EncryptRequest* req, + ::crypto::EncryptResponse* resp) { + return service->encrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[26], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::DecryptRequest, ::crypto::DecryptResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::DecryptRequest* req, + ::crypto::DecryptResponse* resp) { + return service->decrypt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[27], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::SignRequest* req, + ::crypto::SignResponse* resp) { + return service->signUpdate(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[28], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::SignRequest, ::crypto::SignResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::SignRequest* req, + ::crypto::SignResponse* resp) { + return service->signFinalize(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[29], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::VerifyRequest* req, + ::crypto::VerifyResponse* resp) { + return service->verifyUpdate(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + CryptoService_method_names[30], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< CryptoService::Service, ::crypto::VerifyRequest, ::crypto::VerifyResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](CryptoService::Service* service, + ::grpc::ServerContext* ctx, + const ::crypto::VerifyRequest* req, + ::crypto::VerifyResponse* resp) { + return service->verifyFinalize(ctx, req, resp); + }, this))); +} + +CryptoService::Service::~Service() { +} + +::grpc::Status CryptoService::Service::bootSystem(::grpc::ServerContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::addProccess(::grpc::ServerContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::configure(::grpc::ServerContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::generateAESKey(::grpc::ServerContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::generateRSAKeyPair(::grpc::ServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::generateECCKeyPair(::grpc::ServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getSignedDataLength(::grpc::ServerContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getECCencryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getECCDecryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getRSAencryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getRSAdecryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getAESencryptedLength(::grpc::ServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getAESdecryptedLength(::grpc::ServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getEncryptedLen(::grpc::ServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getDecryptedLen(::grpc::ServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::sign(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::verify(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getPublicECCKeyByUserId(::grpc::ServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::getPublicRSAKeyByUserId(::grpc::ServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::ECCencrypt(::grpc::ServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::ECCdecrypt(::grpc::ServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::RSAencrypt(::grpc::ServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::RSAdecrypt(::grpc::ServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::AESencrypt(::grpc::ServerContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::AESdecrypt(::grpc::ServerContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::encrypt(::grpc::ServerContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::decrypt(::grpc::ServerContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::signUpdate(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::signFinalize(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::verifyUpdate(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status CryptoService::Service::verifyFinalize(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + + +} // namespace crypto + diff --git a/hsm-server/proto/encryption.grpc.pb.cc:Zone.Identifier b/hsm-server/proto/encryption.grpc.pb.cc:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/proto/encryption.grpc.pb.h b/hsm-server/proto/encryption.grpc.pb.h new file mode 100644 index 00000000..b9b42fa2 --- /dev/null +++ b/hsm-server/proto/encryption.grpc.pb.h @@ -0,0 +1,4950 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: proto/encryption.proto +#ifndef GRPC_proto_2fencryption_2eproto__INCLUDED +#define GRPC_proto_2fencryption_2eproto__INCLUDED + +#include "encryption.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace crypto { + +class CryptoService final { + public: + static constexpr char const* service_full_name() { + return "crypto.CryptoService"; + } + class StubInterface { + public: + virtual ~StubInterface() {} + virtual ::grpc::Status bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::crypto::Empty* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> AsyncbootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(AsyncbootSystemRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> PrepareAsyncbootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(PrepareAsyncbootSystemRaw(context, request, cq)); + } + virtual ::grpc::Status addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::crypto::Empty* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> AsyncaddProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(AsyncaddProccessRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> PrepareAsyncaddProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(PrepareAsyncaddProccessRaw(context, request, cq)); + } + virtual ::grpc::Status configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::crypto::Empty* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> Asyncconfigure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(AsyncconfigureRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>> PrepareAsyncconfigure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>>(PrepareAsyncconfigureRaw(context, request, cq)); + } + virtual ::grpc::Status generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::crypto::GenerateAESKeyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>> AsyncgenerateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>>(AsyncgenerateAESKeyRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>> PrepareAsyncgenerateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>>(PrepareAsyncgenerateAESKeyRaw(context, request, cq)); + } + virtual ::grpc::Status generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>> AsyncgenerateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>>(AsyncgenerateRSAKeyPairRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>> PrepareAsyncgenerateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>>(PrepareAsyncgenerateRSAKeyPairRaw(context, request, cq)); + } + virtual ::grpc::Status generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>> AsyncgenerateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>>(AsyncgenerateECCKeyPairRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>> PrepareAsyncgenerateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>>(PrepareAsyncgenerateECCKeyPairRaw(context, request, cq)); + } + virtual ::grpc::Status getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetSignedDataLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetSignedDataLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetECCencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetECCencryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetECCDecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetECCDecryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetRSAencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetRSAencryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetRSAdecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetRSAdecryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetAESencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetAESencryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetAESdecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetAESdecryptedLengthRaw(context, request, cq)); + } + virtual ::grpc::Status getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetEncryptedLenRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetEncryptedLenRaw(context, request, cq)); + } + virtual ::grpc::Status getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> AsyncgetDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(AsyncgetDecryptedLenRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>> PrepareAsyncgetDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>>(PrepareAsyncgetDecryptedLenRaw(context, request, cq)); + } + virtual ::grpc::Status sign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> Asyncsign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(AsyncsignRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> PrepareAsyncsign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(PrepareAsyncsignRaw(context, request, cq)); + } + virtual ::grpc::Status verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> Asyncverify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(AsyncverifyRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> PrepareAsyncverify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(PrepareAsyncverifyRaw(context, request, cq)); + } + virtual ::grpc::Status getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>> AsyncgetPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>>(AsyncgetPublicECCKeyByUserIdRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>> PrepareAsyncgetPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>>(PrepareAsyncgetPublicECCKeyByUserIdRaw(context, request, cq)); + } + virtual ::grpc::Status getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>> AsyncgetPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>>(AsyncgetPublicRSAKeyByUserIdRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>> PrepareAsyncgetPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>>(PrepareAsyncgetPublicRSAKeyByUserIdRaw(context, request, cq)); + } + virtual ::grpc::Status ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>> AsyncECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>>(AsyncECCencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>> PrepareAsyncECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>>(PrepareAsyncECCencryptRaw(context, request, cq)); + } + virtual ::grpc::Status ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>> AsyncECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>>(AsyncECCdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>> PrepareAsyncECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>>(PrepareAsyncECCdecryptRaw(context, request, cq)); + } + virtual ::grpc::Status RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>> AsyncRSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>>(AsyncRSAencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>> PrepareAsyncRSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>>(PrepareAsyncRSAencryptRaw(context, request, cq)); + } + virtual ::grpc::Status RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>> AsyncRSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>>(AsyncRSAdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>> PrepareAsyncRSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>>(PrepareAsyncRSAdecryptRaw(context, request, cq)); + } + virtual ::grpc::Status AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::crypto::AESEncryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>> AsyncAESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>>(AsyncAESencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>> PrepareAsyncAESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>>(PrepareAsyncAESencryptRaw(context, request, cq)); + } + virtual ::grpc::Status AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::crypto::AESDecryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>> AsyncAESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>>(AsyncAESdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>> PrepareAsyncAESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>>(PrepareAsyncAESdecryptRaw(context, request, cq)); + } + virtual ::grpc::Status encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::crypto::EncryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>> Asyncencrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>>(AsyncencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>> PrepareAsyncencrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>>(PrepareAsyncencryptRaw(context, request, cq)); + } + virtual ::grpc::Status decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::crypto::DecryptResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>> Asyncdecrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>>(AsyncdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>> PrepareAsyncdecrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>>(PrepareAsyncdecryptRaw(context, request, cq)); + } + virtual ::grpc::Status signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> AsyncsignUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(AsyncsignUpdateRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> PrepareAsyncsignUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(PrepareAsyncsignUpdateRaw(context, request, cq)); + } + virtual ::grpc::Status signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> AsyncsignFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(AsyncsignFinalizeRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>> PrepareAsyncsignFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>>(PrepareAsyncsignFinalizeRaw(context, request, cq)); + } + virtual ::grpc::Status verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> AsyncverifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(AsyncverifyUpdateRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> PrepareAsyncverifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(PrepareAsyncverifyUpdateRaw(context, request, cq)); + } + virtual ::grpc::Status verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> AsyncverifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(AsyncverifyFinalizeRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>> PrepareAsyncverifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>>(PrepareAsyncverifyFinalizeRaw(context, request, cq)); + } + class async_interface { + public: + virtual ~async_interface() {} + virtual void bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, std::function) = 0; + virtual void bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, std::function) = 0; + virtual void addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, std::function) = 0; + virtual void configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, std::function) = 0; + virtual void generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function) = 0; + virtual void generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function) = 0; + virtual void generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function) = 0; + virtual void getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) = 0; + virtual void sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) = 0; + virtual void verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function) = 0; + virtual void getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function) = 0; + virtual void getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function) = 0; + virtual void ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function) = 0; + virtual void ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function) = 0; + virtual void RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function) = 0; + virtual void RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, std::function) = 0; + virtual void AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, std::function) = 0; + virtual void AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, std::function) = 0; + virtual void encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, std::function) = 0; + virtual void decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) = 0; + virtual void signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) = 0; + virtual void signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) = 0; + virtual void verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) = 0; + virtual void verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + }; + typedef class async_interface experimental_async_interface; + virtual class async_interface* async() { return nullptr; } + class async_interface* experimental_async() { return async(); } + private: + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* AsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* PrepareAsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* AsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* PrepareAsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* AsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::Empty>* PrepareAsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>* AsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateAESKeyResponse>* PrepareAsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>* AsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>* PrepareAsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>* AsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GenerateKeyPairResponse>* PrepareAsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* AsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::GetLengthResponse>* PrepareAsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* AsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* PrepareAsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* AsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* PrepareAsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>* AsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>* PrepareAsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>* AsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::KeyResponse>* PrepareAsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>* AsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>* PrepareAsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>* AsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>* PrepareAsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>* AsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricEncryptResponse>* PrepareAsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>* AsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AsymetricDecryptResponse>* PrepareAsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>* AsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESEncryptResponse>* PrepareAsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>* AsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::AESDecryptResponse>* PrepareAsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>* AsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::EncryptResponse>* PrepareAsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>* AsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::DecryptResponse>* PrepareAsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* AsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* PrepareAsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* AsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::SignResponse>* PrepareAsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* AsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* PrepareAsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* AsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::crypto::VerifyResponse>* PrepareAsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) = 0; + }; + class Stub final : public StubInterface { + public: + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + ::grpc::Status bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::crypto::Empty* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> AsyncbootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(AsyncbootSystemRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> PrepareAsyncbootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(PrepareAsyncbootSystemRaw(context, request, cq)); + } + ::grpc::Status addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::crypto::Empty* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> AsyncaddProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(AsyncaddProccessRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> PrepareAsyncaddProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(PrepareAsyncaddProccessRaw(context, request, cq)); + } + ::grpc::Status configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::crypto::Empty* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> Asyncconfigure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(AsyncconfigureRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>> PrepareAsyncconfigure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::Empty>>(PrepareAsyncconfigureRaw(context, request, cq)); + } + ::grpc::Status generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::crypto::GenerateAESKeyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>> AsyncgenerateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>>(AsyncgenerateAESKeyRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>> PrepareAsyncgenerateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>>(PrepareAsyncgenerateAESKeyRaw(context, request, cq)); + } + ::grpc::Status generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>> AsyncgenerateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>>(AsyncgenerateRSAKeyPairRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>> PrepareAsyncgenerateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>>(PrepareAsyncgenerateRSAKeyPairRaw(context, request, cq)); + } + ::grpc::Status generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::crypto::GenerateKeyPairResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>> AsyncgenerateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>>(AsyncgenerateECCKeyPairRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>> PrepareAsyncgenerateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>>(PrepareAsyncgenerateECCKeyPairRaw(context, request, cq)); + } + ::grpc::Status getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetSignedDataLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetSignedDataLengthRaw(context, request, cq)); + } + ::grpc::Status getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetECCencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetECCencryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetECCDecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetECCDecryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetRSAencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetRSAencryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetRSAdecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetRSAdecryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetAESencryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetAESencryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetAESdecryptedLengthRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetAESdecryptedLengthRaw(context, request, cq)); + } + ::grpc::Status getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetEncryptedLenRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetEncryptedLenRaw(context, request, cq)); + } + ::grpc::Status getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::crypto::GetLengthResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> AsyncgetDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(AsyncgetDecryptedLenRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>> PrepareAsyncgetDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>>(PrepareAsyncgetDecryptedLenRaw(context, request, cq)); + } + ::grpc::Status sign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> Asyncsign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(AsyncsignRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> PrepareAsyncsign(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(PrepareAsyncsignRaw(context, request, cq)); + } + ::grpc::Status verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> Asyncverify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(AsyncverifyRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> PrepareAsyncverify(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(PrepareAsyncverifyRaw(context, request, cq)); + } + ::grpc::Status getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>> AsyncgetPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>>(AsyncgetPublicECCKeyByUserIdRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>> PrepareAsyncgetPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>>(PrepareAsyncgetPublicECCKeyByUserIdRaw(context, request, cq)); + } + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::crypto::KeyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>> AsyncgetPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>>(AsyncgetPublicRSAKeyByUserIdRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>> PrepareAsyncgetPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>>(PrepareAsyncgetPublicRSAKeyByUserIdRaw(context, request, cq)); + } + ::grpc::Status ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>> AsyncECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>>(AsyncECCencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>> PrepareAsyncECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>>(PrepareAsyncECCencryptRaw(context, request, cq)); + } + ::grpc::Status ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>> AsyncECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>>(AsyncECCdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>> PrepareAsyncECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>>(PrepareAsyncECCdecryptRaw(context, request, cq)); + } + ::grpc::Status RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::crypto::AsymetricEncryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>> AsyncRSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>>(AsyncRSAencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>> PrepareAsyncRSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>>(PrepareAsyncRSAencryptRaw(context, request, cq)); + } + ::grpc::Status RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::crypto::AsymetricDecryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>> AsyncRSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>>(AsyncRSAdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>> PrepareAsyncRSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>>(PrepareAsyncRSAdecryptRaw(context, request, cq)); + } + ::grpc::Status AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::crypto::AESEncryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>> AsyncAESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>>(AsyncAESencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>> PrepareAsyncAESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>>(PrepareAsyncAESencryptRaw(context, request, cq)); + } + ::grpc::Status AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::crypto::AESDecryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>> AsyncAESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>>(AsyncAESdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>> PrepareAsyncAESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>>(PrepareAsyncAESdecryptRaw(context, request, cq)); + } + ::grpc::Status encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::crypto::EncryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>> Asyncencrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>>(AsyncencryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>> PrepareAsyncencrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>>(PrepareAsyncencryptRaw(context, request, cq)); + } + ::grpc::Status decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::crypto::DecryptResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>> Asyncdecrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>>(AsyncdecryptRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>> PrepareAsyncdecrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>>(PrepareAsyncdecryptRaw(context, request, cq)); + } + ::grpc::Status signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> AsyncsignUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(AsyncsignUpdateRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> PrepareAsyncsignUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(PrepareAsyncsignUpdateRaw(context, request, cq)); + } + ::grpc::Status signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::crypto::SignResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> AsyncsignFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(AsyncsignFinalizeRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>> PrepareAsyncsignFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>>(PrepareAsyncsignFinalizeRaw(context, request, cq)); + } + ::grpc::Status verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> AsyncverifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(AsyncverifyUpdateRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> PrepareAsyncverifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(PrepareAsyncverifyUpdateRaw(context, request, cq)); + } + ::grpc::Status verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::crypto::VerifyResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> AsyncverifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(AsyncverifyFinalizeRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>> PrepareAsyncverifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>>(PrepareAsyncverifyFinalizeRaw(context, request, cq)); + } + class async final : + public StubInterface::async_interface { + public: + void bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, std::function) override; + void bootSystem(::grpc::ClientContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) override; + void addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, std::function) override; + void addProccess(::grpc::ClientContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) override; + void configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, std::function) override; + void configure(::grpc::ClientContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response, ::grpc::ClientUnaryReactor* reactor) override; + void generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, std::function) override; + void generateAESKey(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function) override; + void generateRSAKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, std::function) override; + void generateECCKeyPair(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getSignedDataLength(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getECCencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getECCDecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getRSAencryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getRSAdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getAESencryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, std::function) override; + void getAESdecryptedLength(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function) override; + void getEncryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, std::function) override; + void getDecryptedLen(::grpc::ClientContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) override; + void sign(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) override; + void verify(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function) override; + void getPublicECCKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, std::function) override; + void getPublicRSAKeyByUserId(::grpc::ClientContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function) override; + void ECCencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function) override; + void ECCdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, std::function) override; + void RSAencrypt(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, std::function) override; + void RSAdecrypt(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, std::function) override; + void AESencrypt(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, std::function) override; + void AESdecrypt(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, std::function) override; + void encrypt(::grpc::ClientContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, std::function) override; + void decrypt(::grpc::ClientContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) override; + void signUpdate(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, std::function) override; + void signFinalize(::grpc::ClientContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) override; + void verifyUpdate(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + void verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, std::function) override; + void verifyFinalize(::grpc::ClientContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + private: + friend class Stub; + explicit async(Stub* stub): stub_(stub) { } + Stub* stub() { return stub_; } + Stub* stub_; + }; + class async* async() override { return &async_stub_; } + + private: + std::shared_ptr< ::grpc::ChannelInterface> channel_; + class async async_stub_{this}; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* AsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* PrepareAsyncbootSystemRaw(::grpc::ClientContext* context, const ::crypto::BootSystemRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* AsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* PrepareAsyncaddProccessRaw(::grpc::ClientContext* context, const ::crypto::AddProcessRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* AsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::Empty>* PrepareAsyncconfigureRaw(::grpc::ClientContext* context, const ::crypto::ConfigureRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>* AsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateAESKeyResponse>* PrepareAsyncgenerateAESKeyRaw(::grpc::ClientContext* context, const ::crypto::GenerateAESKeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* AsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* PrepareAsyncgenerateRSAKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* AsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GenerateKeyPairResponse>* PrepareAsyncgenerateECCKeyPairRaw(::grpc::ClientContext* context, const ::crypto::GenerateKeyPairRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetSignedDataLengthRaw(::grpc::ClientContext* context, const ::crypto::GetHashLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetECCencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetECCDecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetRSAencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetRSAdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetAESencryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetAESdecryptedLengthRaw(::grpc::ClientContext* context, const ::crypto::GetAESLengthRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetEncryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* AsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::GetLengthResponse>* PrepareAsyncgetDecryptedLenRaw(::grpc::ClientContext* context, const ::crypto::GetWholeLength& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* AsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* PrepareAsyncsignRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* AsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* PrepareAsyncverifyRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* AsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* PrepareAsyncgetPublicECCKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* AsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::KeyResponse>* PrepareAsyncgetPublicRSAKeyByUserIdRaw(::grpc::ClientContext* context, const ::crypto::KeyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* AsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* PrepareAsyncECCencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* AsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* PrepareAsyncECCdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* AsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricEncryptResponse>* PrepareAsyncRSAencryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* AsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AsymetricDecryptResponse>* PrepareAsyncRSAdecryptRaw(::grpc::ClientContext* context, const ::crypto::AsymetricDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>* AsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AESEncryptResponse>* PrepareAsyncAESencryptRaw(::grpc::ClientContext* context, const ::crypto::AESEncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>* AsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::AESDecryptResponse>* PrepareAsyncAESdecryptRaw(::grpc::ClientContext* context, const ::crypto::AESDecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>* AsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::EncryptResponse>* PrepareAsyncencryptRaw(::grpc::ClientContext* context, const ::crypto::EncryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>* AsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::DecryptResponse>* PrepareAsyncdecryptRaw(::grpc::ClientContext* context, const ::crypto::DecryptRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* AsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* PrepareAsyncsignUpdateRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* AsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::SignResponse>* PrepareAsyncsignFinalizeRaw(::grpc::ClientContext* context, const ::crypto::SignRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* AsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* PrepareAsyncverifyUpdateRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* AsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::crypto::VerifyResponse>* PrepareAsyncverifyFinalizeRaw(::grpc::ClientContext* context, const ::crypto::VerifyRequest& request, ::grpc::CompletionQueue* cq) override; + const ::grpc::internal::RpcMethod rpcmethod_bootSystem_; + const ::grpc::internal::RpcMethod rpcmethod_addProccess_; + const ::grpc::internal::RpcMethod rpcmethod_configure_; + const ::grpc::internal::RpcMethod rpcmethod_generateAESKey_; + const ::grpc::internal::RpcMethod rpcmethod_generateRSAKeyPair_; + const ::grpc::internal::RpcMethod rpcmethod_generateECCKeyPair_; + const ::grpc::internal::RpcMethod rpcmethod_getSignedDataLength_; + const ::grpc::internal::RpcMethod rpcmethod_getECCencryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getECCDecryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getRSAencryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getRSAdecryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getAESencryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getAESdecryptedLength_; + const ::grpc::internal::RpcMethod rpcmethod_getEncryptedLen_; + const ::grpc::internal::RpcMethod rpcmethod_getDecryptedLen_; + const ::grpc::internal::RpcMethod rpcmethod_sign_; + const ::grpc::internal::RpcMethod rpcmethod_verify_; + const ::grpc::internal::RpcMethod rpcmethod_getPublicECCKeyByUserId_; + const ::grpc::internal::RpcMethod rpcmethod_getPublicRSAKeyByUserId_; + const ::grpc::internal::RpcMethod rpcmethod_ECCencrypt_; + const ::grpc::internal::RpcMethod rpcmethod_ECCdecrypt_; + const ::grpc::internal::RpcMethod rpcmethod_RSAencrypt_; + const ::grpc::internal::RpcMethod rpcmethod_RSAdecrypt_; + const ::grpc::internal::RpcMethod rpcmethod_AESencrypt_; + const ::grpc::internal::RpcMethod rpcmethod_AESdecrypt_; + const ::grpc::internal::RpcMethod rpcmethod_encrypt_; + const ::grpc::internal::RpcMethod rpcmethod_decrypt_; + const ::grpc::internal::RpcMethod rpcmethod_signUpdate_; + const ::grpc::internal::RpcMethod rpcmethod_signFinalize_; + const ::grpc::internal::RpcMethod rpcmethod_verifyUpdate_; + const ::grpc::internal::RpcMethod rpcmethod_verifyFinalize_; + }; + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + virtual ::grpc::Status bootSystem(::grpc::ServerContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response); + virtual ::grpc::Status addProccess(::grpc::ServerContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response); + virtual ::grpc::Status configure(::grpc::ServerContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response); + virtual ::grpc::Status generateAESKey(::grpc::ServerContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response); + virtual ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response); + virtual ::grpc::Status generateECCKeyPair(::grpc::ServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response); + virtual ::grpc::Status getSignedDataLength(::grpc::ServerContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getECCencryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getAESencryptedLength(::grpc::ServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getEncryptedLen(::grpc::ServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status getDecryptedLen(::grpc::ServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response); + virtual ::grpc::Status sign(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response); + virtual ::grpc::Status verify(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response); + virtual ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response); + virtual ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response); + virtual ::grpc::Status ECCencrypt(::grpc::ServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response); + virtual ::grpc::Status ECCdecrypt(::grpc::ServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response); + virtual ::grpc::Status RSAencrypt(::grpc::ServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response); + virtual ::grpc::Status RSAdecrypt(::grpc::ServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response); + virtual ::grpc::Status AESencrypt(::grpc::ServerContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response); + virtual ::grpc::Status AESdecrypt(::grpc::ServerContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response); + virtual ::grpc::Status encrypt(::grpc::ServerContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response); + virtual ::grpc::Status decrypt(::grpc::ServerContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response); + virtual ::grpc::Status signUpdate(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response); + virtual ::grpc::Status signFinalize(::grpc::ServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response); + virtual ::grpc::Status verifyUpdate(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response); + virtual ::grpc::Status verifyFinalize(::grpc::ServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response); + }; + template + class WithAsyncMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_bootSystem() { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestbootSystem(::grpc::ServerContext* context, ::crypto::BootSystemRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::Empty>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_addProccess() { + ::grpc::Service::MarkMethodAsync(1); + } + ~WithAsyncMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestaddProccess(::grpc::ServerContext* context, ::crypto::AddProcessRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::Empty>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_configure() { + ::grpc::Service::MarkMethodAsync(2); + } + ~WithAsyncMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestconfigure(::grpc::ServerContext* context, ::crypto::ConfigureRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::Empty>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_generateAESKey() { + ::grpc::Service::MarkMethodAsync(3); + } + ~WithAsyncMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateAESKey(::grpc::ServerContext* context, ::crypto::GenerateAESKeyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GenerateAESKeyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodAsync(4); + } + ~WithAsyncMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateRSAKeyPair(::grpc::ServerContext* context, ::crypto::GenerateKeyPairRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GenerateKeyPairResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(4, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodAsync(5); + } + ~WithAsyncMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateECCKeyPair(::grpc::ServerContext* context, ::crypto::GenerateKeyPairRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GenerateKeyPairResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodAsync(6); + } + ~WithAsyncMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetSignedDataLength(::grpc::ServerContext* context, ::crypto::GetHashLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodAsync(7); + } + ~WithAsyncMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetECCencryptedLength(::grpc::ServerContext* context, ::crypto::GetLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodAsync(8); + } + ~WithAsyncMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetECCDecryptedLength(::grpc::ServerContext* context, ::crypto::GetLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodAsync(9); + } + ~WithAsyncMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetRSAencryptedLength(::grpc::ServerContext* context, ::crypto::GetLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodAsync(10); + } + ~WithAsyncMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetRSAdecryptedLength(::grpc::ServerContext* context, ::crypto::GetLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodAsync(11); + } + ~WithAsyncMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetAESencryptedLength(::grpc::ServerContext* context, ::crypto::GetAESLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodAsync(12); + } + ~WithAsyncMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetAESdecryptedLength(::grpc::ServerContext* context, ::crypto::GetAESLengthRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodAsync(13); + } + ~WithAsyncMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetEncryptedLen(::grpc::ServerContext* context, ::crypto::GetWholeLength* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodAsync(14); + } + ~WithAsyncMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetDecryptedLen(::grpc::ServerContext* context, ::crypto::GetWholeLength* request, ::grpc::ServerAsyncResponseWriter< ::crypto::GetLengthResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_sign() { + ::grpc::Service::MarkMethodAsync(15); + } + ~WithAsyncMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestsign(::grpc::ServerContext* context, ::crypto::SignRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::SignResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_verify() { + ::grpc::Service::MarkMethodAsync(16); + } + ~WithAsyncMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestverify(::grpc::ServerContext* context, ::crypto::VerifyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::VerifyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodAsync(17); + } + ~WithAsyncMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetPublicECCKeyByUserId(::grpc::ServerContext* context, ::crypto::KeyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::KeyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(17, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodAsync(18); + } + ~WithAsyncMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetPublicRSAKeyByUserId(::grpc::ServerContext* context, ::crypto::KeyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::KeyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(18, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_ECCencrypt() { + ::grpc::Service::MarkMethodAsync(19); + } + ~WithAsyncMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestECCencrypt(::grpc::ServerContext* context, ::crypto::AsymetricEncryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AsymetricEncryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(19, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodAsync(20); + } + ~WithAsyncMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestECCdecrypt(::grpc::ServerContext* context, ::crypto::AsymetricDecryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AsymetricDecryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(20, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_RSAencrypt() { + ::grpc::Service::MarkMethodAsync(21); + } + ~WithAsyncMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRSAencrypt(::grpc::ServerContext* context, ::crypto::AsymetricEncryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AsymetricEncryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(21, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodAsync(22); + } + ~WithAsyncMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRSAdecrypt(::grpc::ServerContext* context, ::crypto::AsymetricDecryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AsymetricDecryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(22, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_AESencrypt() { + ::grpc::Service::MarkMethodAsync(23); + } + ~WithAsyncMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAESencrypt(::grpc::ServerContext* context, ::crypto::AESEncryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AESEncryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(23, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_AESdecrypt() { + ::grpc::Service::MarkMethodAsync(24); + } + ~WithAsyncMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAESdecrypt(::grpc::ServerContext* context, ::crypto::AESDecryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::AESDecryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(24, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_encrypt() { + ::grpc::Service::MarkMethodAsync(25); + } + ~WithAsyncMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestencrypt(::grpc::ServerContext* context, ::crypto::EncryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::EncryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(25, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_decrypt() { + ::grpc::Service::MarkMethodAsync(26); + } + ~WithAsyncMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestdecrypt(::grpc::ServerContext* context, ::crypto::DecryptRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::DecryptResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(26, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_signUpdate() { + ::grpc::Service::MarkMethodAsync(27); + } + ~WithAsyncMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestsignUpdate(::grpc::ServerContext* context, ::crypto::SignRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::SignResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(27, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_signFinalize() { + ::grpc::Service::MarkMethodAsync(28); + } + ~WithAsyncMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestsignFinalize(::grpc::ServerContext* context, ::crypto::SignRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::SignResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(28, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_verifyUpdate() { + ::grpc::Service::MarkMethodAsync(29); + } + ~WithAsyncMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestverifyUpdate(::grpc::ServerContext* context, ::crypto::VerifyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::VerifyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(29, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_verifyFinalize() { + ::grpc::Service::MarkMethodAsync(30); + } + ~WithAsyncMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestverifyFinalize(::grpc::ServerContext* context, ::crypto::VerifyRequest* request, ::grpc::ServerAsyncResponseWriter< ::crypto::VerifyResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(30, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_bootSystem > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > AsyncService; + template + class WithCallbackMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_bootSystem() { + ::grpc::Service::MarkMethodCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::BootSystemRequest, ::crypto::Empty>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::BootSystemRequest* request, ::crypto::Empty* response) { return this->bootSystem(context, request, response); }));} + void SetMessageAllocatorFor_bootSystem( + ::grpc::MessageAllocator< ::crypto::BootSystemRequest, ::crypto::Empty>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::BootSystemRequest, ::crypto::Empty>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* bootSystem( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_addProccess() { + ::grpc::Service::MarkMethodCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AddProcessRequest, ::crypto::Empty>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AddProcessRequest* request, ::crypto::Empty* response) { return this->addProccess(context, request, response); }));} + void SetMessageAllocatorFor_addProccess( + ::grpc::MessageAllocator< ::crypto::AddProcessRequest, ::crypto::Empty>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AddProcessRequest, ::crypto::Empty>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* addProccess( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_configure() { + ::grpc::Service::MarkMethodCallback(2, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::ConfigureRequest, ::crypto::Empty>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::ConfigureRequest* request, ::crypto::Empty* response) { return this->configure(context, request, response); }));} + void SetMessageAllocatorFor_configure( + ::grpc::MessageAllocator< ::crypto::ConfigureRequest, ::crypto::Empty>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(2); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::ConfigureRequest, ::crypto::Empty>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* configure( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_generateAESKey() { + ::grpc::Service::MarkMethodCallback(3, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GenerateAESKeyRequest* request, ::crypto::GenerateAESKeyResponse* response) { return this->generateAESKey(context, request, response); }));} + void SetMessageAllocatorFor_generateAESKey( + ::grpc::MessageAllocator< ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(3); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateAESKey( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodCallback(4, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response) { return this->generateRSAKeyPair(context, request, response); }));} + void SetMessageAllocatorFor_generateRSAKeyPair( + ::grpc::MessageAllocator< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(4); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateRSAKeyPair( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodCallback(5, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GenerateKeyPairRequest* request, ::crypto::GenerateKeyPairResponse* response) { return this->generateECCKeyPair(context, request, response); }));} + void SetMessageAllocatorFor_generateECCKeyPair( + ::grpc::MessageAllocator< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(5); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateECCKeyPair( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodCallback(6, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetHashLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getSignedDataLength(context, request, response); }));} + void SetMessageAllocatorFor_getSignedDataLength( + ::grpc::MessageAllocator< ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(6); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getSignedDataLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodCallback(7, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getECCencryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getECCencryptedLength( + ::grpc::MessageAllocator< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(7); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getECCencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodCallback(8, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getECCDecryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getECCDecryptedLength( + ::grpc::MessageAllocator< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(8); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getECCDecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodCallback(9, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getRSAencryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getRSAencryptedLength( + ::grpc::MessageAllocator< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(9); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getRSAencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodCallback(10, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getRSAdecryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getRSAdecryptedLength( + ::grpc::MessageAllocator< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(10); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getRSAdecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodCallback(11, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getAESencryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getAESencryptedLength( + ::grpc::MessageAllocator< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(11); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getAESencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodCallback(12, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetAESLengthRequest* request, ::crypto::GetLengthResponse* response) { return this->getAESdecryptedLength(context, request, response); }));} + void SetMessageAllocatorFor_getAESdecryptedLength( + ::grpc::MessageAllocator< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(12); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getAESdecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodCallback(13, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response) { return this->getEncryptedLen(context, request, response); }));} + void SetMessageAllocatorFor_getEncryptedLen( + ::grpc::MessageAllocator< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(13); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getEncryptedLen( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodCallback(14, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::GetWholeLength* request, ::crypto::GetLengthResponse* response) { return this->getDecryptedLen(context, request, response); }));} + void SetMessageAllocatorFor_getDecryptedLen( + ::grpc::MessageAllocator< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(14); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::GetWholeLength, ::crypto::GetLengthResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getDecryptedLen( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_sign() { + ::grpc::Service::MarkMethodCallback(15, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { return this->sign(context, request, response); }));} + void SetMessageAllocatorFor_sign( + ::grpc::MessageAllocator< ::crypto::SignRequest, ::crypto::SignResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* sign( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_verify() { + ::grpc::Service::MarkMethodCallback(16, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { return this->verify(context, request, response); }));} + void SetMessageAllocatorFor_verify( + ::grpc::MessageAllocator< ::crypto::VerifyRequest, ::crypto::VerifyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(16); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verify( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodCallback(17, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::KeyRequest, ::crypto::KeyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response) { return this->getPublicECCKeyByUserId(context, request, response); }));} + void SetMessageAllocatorFor_getPublicECCKeyByUserId( + ::grpc::MessageAllocator< ::crypto::KeyRequest, ::crypto::KeyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(17); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::KeyRequest, ::crypto::KeyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getPublicECCKeyByUserId( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodCallback(18, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::KeyRequest, ::crypto::KeyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::KeyRequest* request, ::crypto::KeyResponse* response) { return this->getPublicRSAKeyByUserId(context, request, response); }));} + void SetMessageAllocatorFor_getPublicRSAKeyByUserId( + ::grpc::MessageAllocator< ::crypto::KeyRequest, ::crypto::KeyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(18); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::KeyRequest, ::crypto::KeyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getPublicRSAKeyByUserId( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_ECCencrypt() { + ::grpc::Service::MarkMethodCallback(19, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response) { return this->ECCencrypt(context, request, response); }));} + void SetMessageAllocatorFor_ECCencrypt( + ::grpc::MessageAllocator< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(19); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* ECCencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodCallback(20, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response) { return this->ECCdecrypt(context, request, response); }));} + void SetMessageAllocatorFor_ECCdecrypt( + ::grpc::MessageAllocator< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(20); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* ECCdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_RSAencrypt() { + ::grpc::Service::MarkMethodCallback(21, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AsymetricEncryptRequest* request, ::crypto::AsymetricEncryptResponse* response) { return this->RSAencrypt(context, request, response); }));} + void SetMessageAllocatorFor_RSAencrypt( + ::grpc::MessageAllocator< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(21); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RSAencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodCallback(22, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AsymetricDecryptRequest* request, ::crypto::AsymetricDecryptResponse* response) { return this->RSAdecrypt(context, request, response); }));} + void SetMessageAllocatorFor_RSAdecrypt( + ::grpc::MessageAllocator< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(22); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RSAdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_AESencrypt() { + ::grpc::Service::MarkMethodCallback(23, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AESEncryptRequest* request, ::crypto::AESEncryptResponse* response) { return this->AESencrypt(context, request, response); }));} + void SetMessageAllocatorFor_AESencrypt( + ::grpc::MessageAllocator< ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(23); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* AESencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_AESdecrypt() { + ::grpc::Service::MarkMethodCallback(24, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::AESDecryptRequest* request, ::crypto::AESDecryptResponse* response) { return this->AESdecrypt(context, request, response); }));} + void SetMessageAllocatorFor_AESdecrypt( + ::grpc::MessageAllocator< ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(24); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* AESdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_encrypt() { + ::grpc::Service::MarkMethodCallback(25, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::EncryptRequest, ::crypto::EncryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::EncryptRequest* request, ::crypto::EncryptResponse* response) { return this->encrypt(context, request, response); }));} + void SetMessageAllocatorFor_encrypt( + ::grpc::MessageAllocator< ::crypto::EncryptRequest, ::crypto::EncryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(25); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::EncryptRequest, ::crypto::EncryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* encrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_decrypt() { + ::grpc::Service::MarkMethodCallback(26, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::DecryptRequest, ::crypto::DecryptResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::DecryptRequest* request, ::crypto::DecryptResponse* response) { return this->decrypt(context, request, response); }));} + void SetMessageAllocatorFor_decrypt( + ::grpc::MessageAllocator< ::crypto::DecryptRequest, ::crypto::DecryptResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(26); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::DecryptRequest, ::crypto::DecryptResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* decrypt( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_signUpdate() { + ::grpc::Service::MarkMethodCallback(27, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { return this->signUpdate(context, request, response); }));} + void SetMessageAllocatorFor_signUpdate( + ::grpc::MessageAllocator< ::crypto::SignRequest, ::crypto::SignResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(27); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* signUpdate( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_signFinalize() { + ::grpc::Service::MarkMethodCallback(28, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::SignRequest* request, ::crypto::SignResponse* response) { return this->signFinalize(context, request, response); }));} + void SetMessageAllocatorFor_signFinalize( + ::grpc::MessageAllocator< ::crypto::SignRequest, ::crypto::SignResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(28); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::SignRequest, ::crypto::SignResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* signFinalize( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_verifyUpdate() { + ::grpc::Service::MarkMethodCallback(29, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { return this->verifyUpdate(context, request, response); }));} + void SetMessageAllocatorFor_verifyUpdate( + ::grpc::MessageAllocator< ::crypto::VerifyRequest, ::crypto::VerifyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(29); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verifyUpdate( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_verifyFinalize() { + ::grpc::Service::MarkMethodCallback(30, + new ::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::crypto::VerifyRequest* request, ::crypto::VerifyResponse* response) { return this->verifyFinalize(context, request, response); }));} + void SetMessageAllocatorFor_verifyFinalize( + ::grpc::MessageAllocator< ::crypto::VerifyRequest, ::crypto::VerifyResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(30); + static_cast<::grpc::internal::CallbackUnaryHandler< ::crypto::VerifyRequest, ::crypto::VerifyResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verifyFinalize( + ::grpc::CallbackServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) { return nullptr; } + }; + typedef WithCallbackMethod_bootSystem > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CallbackService; + typedef CallbackService ExperimentalCallbackService; + template + class WithGenericMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_bootSystem() { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_addProccess() { + ::grpc::Service::MarkMethodGeneric(1); + } + ~WithGenericMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_configure() { + ::grpc::Service::MarkMethodGeneric(2); + } + ~WithGenericMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_generateAESKey() { + ::grpc::Service::MarkMethodGeneric(3); + } + ~WithGenericMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodGeneric(4); + } + ~WithGenericMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodGeneric(5); + } + ~WithGenericMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodGeneric(6); + } + ~WithGenericMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodGeneric(7); + } + ~WithGenericMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodGeneric(8); + } + ~WithGenericMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodGeneric(9); + } + ~WithGenericMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodGeneric(10); + } + ~WithGenericMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodGeneric(11); + } + ~WithGenericMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodGeneric(12); + } + ~WithGenericMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodGeneric(13); + } + ~WithGenericMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodGeneric(14); + } + ~WithGenericMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_sign() { + ::grpc::Service::MarkMethodGeneric(15); + } + ~WithGenericMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_verify() { + ::grpc::Service::MarkMethodGeneric(16); + } + ~WithGenericMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodGeneric(17); + } + ~WithGenericMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodGeneric(18); + } + ~WithGenericMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_ECCencrypt() { + ::grpc::Service::MarkMethodGeneric(19); + } + ~WithGenericMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodGeneric(20); + } + ~WithGenericMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_RSAencrypt() { + ::grpc::Service::MarkMethodGeneric(21); + } + ~WithGenericMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodGeneric(22); + } + ~WithGenericMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_AESencrypt() { + ::grpc::Service::MarkMethodGeneric(23); + } + ~WithGenericMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_AESdecrypt() { + ::grpc::Service::MarkMethodGeneric(24); + } + ~WithGenericMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_encrypt() { + ::grpc::Service::MarkMethodGeneric(25); + } + ~WithGenericMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_decrypt() { + ::grpc::Service::MarkMethodGeneric(26); + } + ~WithGenericMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_signUpdate() { + ::grpc::Service::MarkMethodGeneric(27); + } + ~WithGenericMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_signFinalize() { + ::grpc::Service::MarkMethodGeneric(28); + } + ~WithGenericMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_verifyUpdate() { + ::grpc::Service::MarkMethodGeneric(29); + } + ~WithGenericMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_verifyFinalize() { + ::grpc::Service::MarkMethodGeneric(30); + } + ~WithGenericMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithRawMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_bootSystem() { + ::grpc::Service::MarkMethodRaw(0); + } + ~WithRawMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestbootSystem(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_addProccess() { + ::grpc::Service::MarkMethodRaw(1); + } + ~WithRawMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestaddProccess(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_configure() { + ::grpc::Service::MarkMethodRaw(2); + } + ~WithRawMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestconfigure(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_generateAESKey() { + ::grpc::Service::MarkMethodRaw(3); + } + ~WithRawMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateAESKey(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodRaw(4); + } + ~WithRawMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateRSAKeyPair(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(4, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodRaw(5); + } + ~WithRawMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgenerateECCKeyPair(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(5, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodRaw(6); + } + ~WithRawMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetSignedDataLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(6, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodRaw(7); + } + ~WithRawMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetECCencryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodRaw(8); + } + ~WithRawMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetECCDecryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodRaw(9); + } + ~WithRawMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetRSAencryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodRaw(10); + } + ~WithRawMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetRSAdecryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(10, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodRaw(11); + } + ~WithRawMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetAESencryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(11, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodRaw(12); + } + ~WithRawMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetAESdecryptedLength(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(12, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodRaw(13); + } + ~WithRawMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetEncryptedLen(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(13, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodRaw(14); + } + ~WithRawMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetDecryptedLen(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_sign() { + ::grpc::Service::MarkMethodRaw(15); + } + ~WithRawMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestsign(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_verify() { + ::grpc::Service::MarkMethodRaw(16); + } + ~WithRawMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestverify(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodRaw(17); + } + ~WithRawMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetPublicECCKeyByUserId(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(17, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodRaw(18); + } + ~WithRawMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestgetPublicRSAKeyByUserId(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(18, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_ECCencrypt() { + ::grpc::Service::MarkMethodRaw(19); + } + ~WithRawMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestECCencrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(19, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodRaw(20); + } + ~WithRawMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestECCdecrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(20, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_RSAencrypt() { + ::grpc::Service::MarkMethodRaw(21); + } + ~WithRawMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRSAencrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(21, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodRaw(22); + } + ~WithRawMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRSAdecrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(22, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_AESencrypt() { + ::grpc::Service::MarkMethodRaw(23); + } + ~WithRawMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAESencrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(23, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_AESdecrypt() { + ::grpc::Service::MarkMethodRaw(24); + } + ~WithRawMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestAESdecrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(24, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_encrypt() { + ::grpc::Service::MarkMethodRaw(25); + } + ~WithRawMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestencrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(25, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_decrypt() { + ::grpc::Service::MarkMethodRaw(26); + } + ~WithRawMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void Requestdecrypt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(26, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_signUpdate() { + ::grpc::Service::MarkMethodRaw(27); + } + ~WithRawMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestsignUpdate(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(27, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_signFinalize() { + ::grpc::Service::MarkMethodRaw(28); + } + ~WithRawMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestsignFinalize(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(28, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_verifyUpdate() { + ::grpc::Service::MarkMethodRaw(29); + } + ~WithRawMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestverifyUpdate(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(29, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_verifyFinalize() { + ::grpc::Service::MarkMethodRaw(30); + } + ~WithRawMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestverifyFinalize(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(30, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawCallbackMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_bootSystem() { + ::grpc::Service::MarkMethodRawCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->bootSystem(context, request, response); })); + } + ~WithRawCallbackMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* bootSystem( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_addProccess() { + ::grpc::Service::MarkMethodRawCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->addProccess(context, request, response); })); + } + ~WithRawCallbackMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* addProccess( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_configure() { + ::grpc::Service::MarkMethodRawCallback(2, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->configure(context, request, response); })); + } + ~WithRawCallbackMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* configure( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_generateAESKey() { + ::grpc::Service::MarkMethodRawCallback(3, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->generateAESKey(context, request, response); })); + } + ~WithRawCallbackMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateAESKey( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodRawCallback(4, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->generateRSAKeyPair(context, request, response); })); + } + ~WithRawCallbackMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateRSAKeyPair( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodRawCallback(5, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->generateECCKeyPair(context, request, response); })); + } + ~WithRawCallbackMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* generateECCKeyPair( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodRawCallback(6, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getSignedDataLength(context, request, response); })); + } + ~WithRawCallbackMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getSignedDataLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodRawCallback(7, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getECCencryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getECCencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodRawCallback(8, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getECCDecryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getECCDecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodRawCallback(9, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getRSAencryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getRSAencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodRawCallback(10, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getRSAdecryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getRSAdecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodRawCallback(11, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getAESencryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getAESencryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodRawCallback(12, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getAESdecryptedLength(context, request, response); })); + } + ~WithRawCallbackMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getAESdecryptedLength( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodRawCallback(13, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getEncryptedLen(context, request, response); })); + } + ~WithRawCallbackMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getEncryptedLen( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodRawCallback(14, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getDecryptedLen(context, request, response); })); + } + ~WithRawCallbackMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getDecryptedLen( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_sign() { + ::grpc::Service::MarkMethodRawCallback(15, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->sign(context, request, response); })); + } + ~WithRawCallbackMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* sign( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_verify() { + ::grpc::Service::MarkMethodRawCallback(16, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->verify(context, request, response); })); + } + ~WithRawCallbackMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verify( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodRawCallback(17, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getPublicECCKeyByUserId(context, request, response); })); + } + ~WithRawCallbackMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getPublicECCKeyByUserId( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodRawCallback(18, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->getPublicRSAKeyByUserId(context, request, response); })); + } + ~WithRawCallbackMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* getPublicRSAKeyByUserId( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_ECCencrypt() { + ::grpc::Service::MarkMethodRawCallback(19, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->ECCencrypt(context, request, response); })); + } + ~WithRawCallbackMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* ECCencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodRawCallback(20, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->ECCdecrypt(context, request, response); })); + } + ~WithRawCallbackMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* ECCdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_RSAencrypt() { + ::grpc::Service::MarkMethodRawCallback(21, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->RSAencrypt(context, request, response); })); + } + ~WithRawCallbackMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RSAencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodRawCallback(22, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->RSAdecrypt(context, request, response); })); + } + ~WithRawCallbackMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* RSAdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_AESencrypt() { + ::grpc::Service::MarkMethodRawCallback(23, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->AESencrypt(context, request, response); })); + } + ~WithRawCallbackMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* AESencrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_AESdecrypt() { + ::grpc::Service::MarkMethodRawCallback(24, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->AESdecrypt(context, request, response); })); + } + ~WithRawCallbackMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* AESdecrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_encrypt() { + ::grpc::Service::MarkMethodRawCallback(25, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->encrypt(context, request, response); })); + } + ~WithRawCallbackMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* encrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_decrypt() { + ::grpc::Service::MarkMethodRawCallback(26, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->decrypt(context, request, response); })); + } + ~WithRawCallbackMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* decrypt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_signUpdate() { + ::grpc::Service::MarkMethodRawCallback(27, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->signUpdate(context, request, response); })); + } + ~WithRawCallbackMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* signUpdate( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_signFinalize() { + ::grpc::Service::MarkMethodRawCallback(28, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->signFinalize(context, request, response); })); + } + ~WithRawCallbackMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* signFinalize( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_verifyUpdate() { + ::grpc::Service::MarkMethodRawCallback(29, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->verifyUpdate(context, request, response); })); + } + ~WithRawCallbackMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verifyUpdate( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_verifyFinalize() { + ::grpc::Service::MarkMethodRawCallback(30, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->verifyFinalize(context, request, response); })); + } + ~WithRawCallbackMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* verifyFinalize( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithStreamedUnaryMethod_bootSystem : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_bootSystem() { + ::grpc::Service::MarkMethodStreamed(0, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::BootSystemRequest, ::crypto::Empty>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::BootSystemRequest, ::crypto::Empty>* streamer) { + return this->StreamedbootSystem(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_bootSystem() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status bootSystem(::grpc::ServerContext* /*context*/, const ::crypto::BootSystemRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedbootSystem(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::BootSystemRequest,::crypto::Empty>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_addProccess : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_addProccess() { + ::grpc::Service::MarkMethodStreamed(1, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AddProcessRequest, ::crypto::Empty>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AddProcessRequest, ::crypto::Empty>* streamer) { + return this->StreamedaddProccess(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_addProccess() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status addProccess(::grpc::ServerContext* /*context*/, const ::crypto::AddProcessRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedaddProccess(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AddProcessRequest,::crypto::Empty>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_configure : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_configure() { + ::grpc::Service::MarkMethodStreamed(2, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::ConfigureRequest, ::crypto::Empty>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::ConfigureRequest, ::crypto::Empty>* streamer) { + return this->Streamedconfigure(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_configure() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status configure(::grpc::ServerContext* /*context*/, const ::crypto::ConfigureRequest* /*request*/, ::crypto::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status Streamedconfigure(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::ConfigureRequest,::crypto::Empty>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_generateAESKey : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_generateAESKey() { + ::grpc::Service::MarkMethodStreamed(3, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GenerateAESKeyRequest, ::crypto::GenerateAESKeyResponse>* streamer) { + return this->StreamedgenerateAESKey(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_generateAESKey() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status generateAESKey(::grpc::ServerContext* /*context*/, const ::crypto::GenerateAESKeyRequest* /*request*/, ::crypto::GenerateAESKeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgenerateAESKey(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GenerateAESKeyRequest,::crypto::GenerateAESKeyResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_generateRSAKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_generateRSAKeyPair() { + ::grpc::Service::MarkMethodStreamed(4, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>* streamer) { + return this->StreamedgenerateRSAKeyPair(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_generateRSAKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status generateRSAKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgenerateRSAKeyPair(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GenerateKeyPairRequest,::crypto::GenerateKeyPairResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_generateECCKeyPair : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_generateECCKeyPair() { + ::grpc::Service::MarkMethodStreamed(5, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GenerateKeyPairRequest, ::crypto::GenerateKeyPairResponse>* streamer) { + return this->StreamedgenerateECCKeyPair(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_generateECCKeyPair() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status generateECCKeyPair(::grpc::ServerContext* /*context*/, const ::crypto::GenerateKeyPairRequest* /*request*/, ::crypto::GenerateKeyPairResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgenerateECCKeyPair(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GenerateKeyPairRequest,::crypto::GenerateKeyPairResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getSignedDataLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getSignedDataLength() { + ::grpc::Service::MarkMethodStreamed(6, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetHashLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetSignedDataLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getSignedDataLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getSignedDataLength(::grpc::ServerContext* /*context*/, const ::crypto::GetHashLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetSignedDataLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetHashLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getECCencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getECCencryptedLength() { + ::grpc::Service::MarkMethodStreamed(7, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetECCencryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getECCencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getECCencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetECCencryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getECCDecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getECCDecryptedLength() { + ::grpc::Service::MarkMethodStreamed(8, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetECCDecryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getECCDecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getECCDecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetECCDecryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getRSAencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getRSAencryptedLength() { + ::grpc::Service::MarkMethodStreamed(9, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetRSAencryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getRSAencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getRSAencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetRSAencryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getRSAdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getRSAdecryptedLength() { + ::grpc::Service::MarkMethodStreamed(10, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetRSAdecryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getRSAdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getRSAdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetRSAdecryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getAESencryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getAESencryptedLength() { + ::grpc::Service::MarkMethodStreamed(11, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetAESencryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getAESencryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getAESencryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetAESencryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetAESLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getAESdecryptedLength : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getAESdecryptedLength() { + ::grpc::Service::MarkMethodStreamed(12, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetAESLengthRequest, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetAESdecryptedLength(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getAESdecryptedLength() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getAESdecryptedLength(::grpc::ServerContext* /*context*/, const ::crypto::GetAESLengthRequest* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetAESdecryptedLength(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetAESLengthRequest,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getEncryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getEncryptedLen() { + ::grpc::Service::MarkMethodStreamed(13, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetWholeLength, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetWholeLength, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetEncryptedLen(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getEncryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getEncryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetEncryptedLen(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetWholeLength,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getDecryptedLen : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getDecryptedLen() { + ::grpc::Service::MarkMethodStreamed(14, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::GetWholeLength, ::crypto::GetLengthResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::GetWholeLength, ::crypto::GetLengthResponse>* streamer) { + return this->StreamedgetDecryptedLen(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getDecryptedLen() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getDecryptedLen(::grpc::ServerContext* /*context*/, const ::crypto::GetWholeLength* /*request*/, ::crypto::GetLengthResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetDecryptedLen(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::GetWholeLength,::crypto::GetLengthResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_sign : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_sign() { + ::grpc::Service::MarkMethodStreamed(15, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::SignRequest, ::crypto::SignResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::SignRequest, ::crypto::SignResponse>* streamer) { + return this->Streamedsign(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_sign() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status sign(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status Streamedsign(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::SignRequest,::crypto::SignResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_verify : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_verify() { + ::grpc::Service::MarkMethodStreamed(16, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>* streamer) { + return this->Streamedverify(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_verify() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status verify(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status Streamedverify(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::VerifyRequest,::crypto::VerifyResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getPublicECCKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getPublicECCKeyByUserId() { + ::grpc::Service::MarkMethodStreamed(17, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::KeyRequest, ::crypto::KeyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::KeyRequest, ::crypto::KeyResponse>* streamer) { + return this->StreamedgetPublicECCKeyByUserId(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getPublicECCKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getPublicECCKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetPublicECCKeyByUserId(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::KeyRequest,::crypto::KeyResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_getPublicRSAKeyByUserId : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_getPublicRSAKeyByUserId() { + ::grpc::Service::MarkMethodStreamed(18, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::KeyRequest, ::crypto::KeyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::KeyRequest, ::crypto::KeyResponse>* streamer) { + return this->StreamedgetPublicRSAKeyByUserId(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_getPublicRSAKeyByUserId() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status getPublicRSAKeyByUserId(::grpc::ServerContext* /*context*/, const ::crypto::KeyRequest* /*request*/, ::crypto::KeyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedgetPublicRSAKeyByUserId(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::KeyRequest,::crypto::KeyResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_ECCencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_ECCencrypt() { + ::grpc::Service::MarkMethodStreamed(19, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>* streamer) { + return this->StreamedECCencrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_ECCencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status ECCencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedECCencrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AsymetricEncryptRequest,::crypto::AsymetricEncryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_ECCdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_ECCdecrypt() { + ::grpc::Service::MarkMethodStreamed(20, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>* streamer) { + return this->StreamedECCdecrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_ECCdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status ECCdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedECCdecrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AsymetricDecryptRequest,::crypto::AsymetricDecryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_RSAencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_RSAencrypt() { + ::grpc::Service::MarkMethodStreamed(21, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AsymetricEncryptRequest, ::crypto::AsymetricEncryptResponse>* streamer) { + return this->StreamedRSAencrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_RSAencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status RSAencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricEncryptRequest* /*request*/, ::crypto::AsymetricEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedRSAencrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AsymetricEncryptRequest,::crypto::AsymetricEncryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_RSAdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_RSAdecrypt() { + ::grpc::Service::MarkMethodStreamed(22, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AsymetricDecryptRequest, ::crypto::AsymetricDecryptResponse>* streamer) { + return this->StreamedRSAdecrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_RSAdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status RSAdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AsymetricDecryptRequest* /*request*/, ::crypto::AsymetricDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedRSAdecrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AsymetricDecryptRequest,::crypto::AsymetricDecryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_AESencrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_AESencrypt() { + ::grpc::Service::MarkMethodStreamed(23, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AESEncryptRequest, ::crypto::AESEncryptResponse>* streamer) { + return this->StreamedAESencrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_AESencrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status AESencrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESEncryptRequest* /*request*/, ::crypto::AESEncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedAESencrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AESEncryptRequest,::crypto::AESEncryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_AESdecrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_AESdecrypt() { + ::grpc::Service::MarkMethodStreamed(24, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::AESDecryptRequest, ::crypto::AESDecryptResponse>* streamer) { + return this->StreamedAESdecrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_AESdecrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status AESdecrypt(::grpc::ServerContext* /*context*/, const ::crypto::AESDecryptRequest* /*request*/, ::crypto::AESDecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedAESdecrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::AESDecryptRequest,::crypto::AESDecryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_encrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_encrypt() { + ::grpc::Service::MarkMethodStreamed(25, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::EncryptRequest, ::crypto::EncryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::EncryptRequest, ::crypto::EncryptResponse>* streamer) { + return this->Streamedencrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_encrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status encrypt(::grpc::ServerContext* /*context*/, const ::crypto::EncryptRequest* /*request*/, ::crypto::EncryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status Streamedencrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::EncryptRequest,::crypto::EncryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_decrypt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_decrypt() { + ::grpc::Service::MarkMethodStreamed(26, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::DecryptRequest, ::crypto::DecryptResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::DecryptRequest, ::crypto::DecryptResponse>* streamer) { + return this->Streameddecrypt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_decrypt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status decrypt(::grpc::ServerContext* /*context*/, const ::crypto::DecryptRequest* /*request*/, ::crypto::DecryptResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status Streameddecrypt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::DecryptRequest,::crypto::DecryptResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_signUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_signUpdate() { + ::grpc::Service::MarkMethodStreamed(27, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::SignRequest, ::crypto::SignResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::SignRequest, ::crypto::SignResponse>* streamer) { + return this->StreamedsignUpdate(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_signUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status signUpdate(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedsignUpdate(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::SignRequest,::crypto::SignResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_signFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_signFinalize() { + ::grpc::Service::MarkMethodStreamed(28, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::SignRequest, ::crypto::SignResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::SignRequest, ::crypto::SignResponse>* streamer) { + return this->StreamedsignFinalize(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_signFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status signFinalize(::grpc::ServerContext* /*context*/, const ::crypto::SignRequest* /*request*/, ::crypto::SignResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedsignFinalize(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::SignRequest,::crypto::SignResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_verifyUpdate : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_verifyUpdate() { + ::grpc::Service::MarkMethodStreamed(29, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>* streamer) { + return this->StreamedverifyUpdate(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_verifyUpdate() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status verifyUpdate(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedverifyUpdate(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::VerifyRequest,::crypto::VerifyResponse>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_verifyFinalize : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_verifyFinalize() { + ::grpc::Service::MarkMethodStreamed(30, + new ::grpc::internal::StreamedUnaryHandler< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::crypto::VerifyRequest, ::crypto::VerifyResponse>* streamer) { + return this->StreamedverifyFinalize(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_verifyFinalize() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status verifyFinalize(::grpc::ServerContext* /*context*/, const ::crypto::VerifyRequest* /*request*/, ::crypto::VerifyResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedverifyFinalize(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::crypto::VerifyRequest,::crypto::VerifyResponse>* server_unary_streamer) = 0; + }; + typedef WithStreamedUnaryMethod_bootSystem > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedUnaryService; + typedef Service SplitStreamedService; + typedef WithStreamedUnaryMethod_bootSystem > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedService; +}; + +} // namespace crypto + + +#endif // GRPC_proto_2fencryption_2eproto__INCLUDED diff --git a/hsm-server/proto/encryption.grpc.pb.h:Zone.Identifier b/hsm-server/proto/encryption.grpc.pb.h:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/proto/encryption.pb.cc b/hsm-server/proto/encryption.pb.cc new file mode 100644 index 00000000..366a2cd6 --- /dev/null +++ b/hsm-server/proto/encryption.pb.cc @@ -0,0 +1,10148 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/encryption.proto + +#include "encryption.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace crypto { +constexpr AsymetricEncryptRequest::AsymetricEncryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0){} +struct AsymetricEncryptRequestDefaultTypeInternal { + constexpr AsymetricEncryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AsymetricEncryptRequestDefaultTypeInternal() {} + union { + AsymetricEncryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AsymetricEncryptRequestDefaultTypeInternal _AsymetricEncryptRequest_default_instance_; +constexpr AsymetricEncryptResponse::AsymetricEncryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : encrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct AsymetricEncryptResponseDefaultTypeInternal { + constexpr AsymetricEncryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AsymetricEncryptResponseDefaultTypeInternal() {} + union { + AsymetricEncryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AsymetricEncryptResponseDefaultTypeInternal _AsymetricEncryptResponse_default_instance_; +constexpr AsymetricDecryptRequest::AsymetricDecryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0){} +struct AsymetricDecryptRequestDefaultTypeInternal { + constexpr AsymetricDecryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AsymetricDecryptRequestDefaultTypeInternal() {} + union { + AsymetricDecryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AsymetricDecryptRequestDefaultTypeInternal _AsymetricDecryptRequest_default_instance_; +constexpr GetHashLengthRequest::GetHashLengthRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , func_(0) + + , datalen_(0){} +struct GetHashLengthRequestDefaultTypeInternal { + constexpr GetHashLengthRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GetHashLengthRequestDefaultTypeInternal() {} + union { + GetHashLengthRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GetHashLengthRequestDefaultTypeInternal _GetHashLengthRequest_default_instance_; +constexpr GetAESLengthRequest::GetAESLengthRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , datalen_(0) + , isfirst_(false) + , chainingmode_(0) +{} +struct GetAESLengthRequestDefaultTypeInternal { + constexpr GetAESLengthRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GetAESLengthRequestDefaultTypeInternal() {} + union { + GetAESLengthRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GetAESLengthRequestDefaultTypeInternal _GetAESLengthRequest_default_instance_; +constexpr AsymetricDecryptResponse::AsymetricDecryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : decrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct AsymetricDecryptResponseDefaultTypeInternal { + constexpr AsymetricDecryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AsymetricDecryptResponseDefaultTypeInternal() {} + union { + AsymetricDecryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AsymetricDecryptResponseDefaultTypeInternal _AsymetricDecryptResponse_default_instance_; +constexpr GetLengthRequest::GetLengthRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , inlen_(0){} +struct GetLengthRequestDefaultTypeInternal { + constexpr GetLengthRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GetLengthRequestDefaultTypeInternal() {} + union { + GetLengthRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GetLengthRequestDefaultTypeInternal _GetLengthRequest_default_instance_; +constexpr GetLengthResponse::GetLengthResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : len_(0){} +struct GetLengthResponseDefaultTypeInternal { + constexpr GetLengthResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GetLengthResponseDefaultTypeInternal() {} + union { + GetLengthResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GetLengthResponseDefaultTypeInternal _GetLengthResponse_default_instance_; +constexpr GetWholeLength::GetWholeLength( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , inlen_(0) + , isfirst_(false) + , userid_(0){} +struct GetWholeLengthDefaultTypeInternal { + constexpr GetWholeLengthDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GetWholeLengthDefaultTypeInternal() {} + union { + GetWholeLength _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GetWholeLengthDefaultTypeInternal _GetWholeLength_default_instance_; +constexpr GenerateAESKeyRequest::GenerateAESKeyRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : permissions_() + , _permissions_cached_byte_size_(0) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , userid_(0) + , keylength_(0) + + , destuserid_(0){} +struct GenerateAESKeyRequestDefaultTypeInternal { + constexpr GenerateAESKeyRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GenerateAESKeyRequestDefaultTypeInternal() {} + union { + GenerateAESKeyRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GenerateAESKeyRequestDefaultTypeInternal _GenerateAESKeyRequest_default_instance_; +constexpr GenerateAESKeyResponse::GenerateAESKeyResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : aeskey_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct GenerateAESKeyResponseDefaultTypeInternal { + constexpr GenerateAESKeyResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GenerateAESKeyResponseDefaultTypeInternal() {} + union { + GenerateAESKeyResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GenerateAESKeyResponseDefaultTypeInternal _GenerateAESKeyResponse_default_instance_; +constexpr GenerateKeyPairRequest::GenerateKeyPairRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : permissions_() + , _permissions_cached_byte_size_(0) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , userid_(0){} +struct GenerateKeyPairRequestDefaultTypeInternal { + constexpr GenerateKeyPairRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GenerateKeyPairRequestDefaultTypeInternal() {} + union { + GenerateKeyPairRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GenerateKeyPairRequestDefaultTypeInternal _GenerateKeyPairRequest_default_instance_; +constexpr GenerateKeyPairResponse::GenerateKeyPairResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : publickey_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , privatekey_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct GenerateKeyPairResponseDefaultTypeInternal { + constexpr GenerateKeyPairResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~GenerateKeyPairResponseDefaultTypeInternal() {} + union { + GenerateKeyPairResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GenerateKeyPairResponseDefaultTypeInternal _GenerateKeyPairResponse_default_instance_; +constexpr SignRequest::SignRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , hashfunc_(0) + + , counter_(int64_t{0}){} +struct SignRequestDefaultTypeInternal { + constexpr SignRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SignRequestDefaultTypeInternal() {} + union { + SignRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SignRequestDefaultTypeInternal _SignRequest_default_instance_; +constexpr SignResponse::SignResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : signature_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct SignResponseDefaultTypeInternal { + constexpr SignResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SignResponseDefaultTypeInternal() {} + union { + SignResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SignResponseDefaultTypeInternal _SignResponse_default_instance_; +constexpr VerifyRequest::VerifyRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , signature_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0) + , hashfunc_(0) + + , counter_(0){} +struct VerifyRequestDefaultTypeInternal { + constexpr VerifyRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~VerifyRequestDefaultTypeInternal() {} + union { + VerifyRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT VerifyRequestDefaultTypeInternal _VerifyRequest_default_instance_; +constexpr VerifyResponse::VerifyResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : out_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , valid_(false){} +struct VerifyResponseDefaultTypeInternal { + constexpr VerifyResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~VerifyResponseDefaultTypeInternal() {} + union { + VerifyResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT VerifyResponseDefaultTypeInternal _VerifyResponse_default_instance_; +constexpr KeyRequest::KeyRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , userid_(0){} +struct KeyRequestDefaultTypeInternal { + constexpr KeyRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~KeyRequestDefaultTypeInternal() {} + union { + KeyRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT KeyRequestDefaultTypeInternal _KeyRequest_default_instance_; +constexpr KeyResponse::KeyResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : key_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct KeyResponseDefaultTypeInternal { + constexpr KeyResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~KeyResponseDefaultTypeInternal() {} + union { + KeyResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT KeyResponseDefaultTypeInternal _KeyResponse_default_instance_; +constexpr UserKeyPermissions::UserKeyPermissions( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : permissions_() + , _permissions_cached_byte_size_(0) + , userid_(0){} +struct UserKeyPermissionsDefaultTypeInternal { + constexpr UserKeyPermissionsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~UserKeyPermissionsDefaultTypeInternal() {} + union { + UserKeyPermissions _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UserKeyPermissionsDefaultTypeInternal _UserKeyPermissions_default_instance_; +constexpr BootSystemRequest::BootSystemRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : usersidspermissions_() + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct BootSystemRequestDefaultTypeInternal { + constexpr BootSystemRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~BootSystemRequestDefaultTypeInternal() {} + union { + BootSystemRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BootSystemRequestDefaultTypeInternal _BootSystemRequest_default_instance_; +constexpr Empty::Empty( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct EmptyDefaultTypeInternal { + constexpr EmptyDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~EmptyDefaultTypeInternal() {} + union { + Empty _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EmptyDefaultTypeInternal _Empty_default_instance_; +constexpr CryptoConfig::CryptoConfig( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , hashfunction_(0) + + , aeskeylength_(0) + + , aeschainingmode_(0) + + , asymmetricfunction_(0) +{} +struct CryptoConfigDefaultTypeInternal { + constexpr CryptoConfigDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~CryptoConfigDefaultTypeInternal() {} + union { + CryptoConfig _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CryptoConfigDefaultTypeInternal _CryptoConfig_default_instance_; +constexpr ConfigureRequest::ConfigureRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , config_(nullptr) + , userid_(0){} +struct ConfigureRequestDefaultTypeInternal { + constexpr ConfigureRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ConfigureRequestDefaultTypeInternal() {} + union { + ConfigureRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConfigureRequestDefaultTypeInternal _ConfigureRequest_default_instance_; +constexpr AddProcessRequest::AddProcessRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : permissions_() + , _permissions_cached_byte_size_(0) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , userid_(0){} +struct AddProcessRequestDefaultTypeInternal { + constexpr AddProcessRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AddProcessRequestDefaultTypeInternal() {} + union { + AddProcessRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AddProcessRequestDefaultTypeInternal _AddProcessRequest_default_instance_; +constexpr EncryptRequest::EncryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0) + , counter_(int64_t{0}) + , isfirst_(false){} +struct EncryptRequestDefaultTypeInternal { + constexpr EncryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~EncryptRequestDefaultTypeInternal() {} + union { + EncryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EncryptRequestDefaultTypeInternal _EncryptRequest_default_instance_; +constexpr EncryptResponse::EncryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : encrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , signature_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct EncryptResponseDefaultTypeInternal { + constexpr EncryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~EncryptResponseDefaultTypeInternal() {} + union { + EncryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EncryptResponseDefaultTypeInternal _EncryptResponse_default_instance_; +constexpr DecryptRequest::DecryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : encrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , signature_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0) + , counter_(int64_t{0}) + , isfirst_(false){} +struct DecryptRequestDefaultTypeInternal { + constexpr DecryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~DecryptRequestDefaultTypeInternal() {} + union { + DecryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DecryptRequestDefaultTypeInternal _DecryptRequest_default_instance_; +constexpr DecryptResponse::DecryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : decrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct DecryptResponseDefaultTypeInternal { + constexpr DecryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~DecryptResponseDefaultTypeInternal() {} + union { + DecryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DecryptResponseDefaultTypeInternal _DecryptResponse_default_instance_; +constexpr AESEncryptRequest::AESEncryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0) + , counter_(int64_t{0}) + , func_(0) + + , keylength_(0) + + , chainingmode_(0) + + , isfirst_(false){} +struct AESEncryptRequestDefaultTypeInternal { + constexpr AESEncryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AESEncryptRequestDefaultTypeInternal() {} + union { + AESEncryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AESEncryptRequestDefaultTypeInternal _AESEncryptRequest_default_instance_; +constexpr AESEncryptResponse::AESEncryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : encrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct AESEncryptResponseDefaultTypeInternal { + constexpr AESEncryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AESEncryptResponseDefaultTypeInternal() {} + union { + AESEncryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AESEncryptResponseDefaultTypeInternal _AESEncryptResponse_default_instance_; +constexpr AESDecryptRequest::AESDecryptRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : datain_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , dataout_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , keyid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , messageid_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , senderid_(0) + , receiverid_(0) + , inlen_(0) + , func_(0) + + , keylength_(0) + + , chainingmode_(0) + + , counter_(int64_t{0}) + , isfirst_(false) + , userid_(0){} +struct AESDecryptRequestDefaultTypeInternal { + constexpr AESDecryptRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AESDecryptRequestDefaultTypeInternal() {} + union { + AESDecryptRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AESDecryptRequestDefaultTypeInternal _AESDecryptRequest_default_instance_; +constexpr AESDecryptResponse::AESDecryptResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : decrypteddata_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct AESDecryptResponseDefaultTypeInternal { + constexpr AESDecryptResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AESDecryptResponseDefaultTypeInternal() {} + union { + AESDecryptResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AESDecryptResponseDefaultTypeInternal _AESDecryptResponse_default_instance_; +} // namespace crypto +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_proto_2fencryption_2eproto[33]; +static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_proto_2fencryption_2eproto[5]; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_proto_2fencryption_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_proto_2fencryption_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricEncryptResponse, encrypteddata_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GetHashLengthRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GetHashLengthRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::GetHashLengthRequest, func_), + PROTOBUF_FIELD_OFFSET(::crypto::GetHashLengthRequest, datalen_), + PROTOBUF_FIELD_OFFSET(::crypto::GetHashLengthRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, datalen_), + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, chainingmode_), + PROTOBUF_FIELD_OFFSET(::crypto::GetAESLengthRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AsymetricDecryptResponse, decrypteddata_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthRequest, inlen_), + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GetLengthResponse, len_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, inlen_), + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, messageid_), + PROTOBUF_FIELD_OFFSET(::crypto::GetWholeLength, userid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, permissions_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, keylength_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, destuserid_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateAESKeyResponse, aeskey_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairRequest, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairRequest, permissions_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairResponse, publickey_), + PROTOBUF_FIELD_OFFSET(::crypto::GenerateKeyPairResponse, privatekey_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, hashfunc_), + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::SignRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::SignResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::SignResponse, signature_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, signature_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, hashfunc_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::VerifyResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::VerifyResponse, valid_), + PROTOBUF_FIELD_OFFSET(::crypto::VerifyResponse, out_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::KeyRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::KeyRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::KeyRequest, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::KeyRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::KeyResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::KeyResponse, key_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::UserKeyPermissions, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::UserKeyPermissions, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::UserKeyPermissions, permissions_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::BootSystemRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::BootSystemRequest, usersidspermissions_), + PROTOBUF_FIELD_OFFSET(::crypto::BootSystemRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::Empty, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, hashfunction_), + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, aeskeylength_), + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, aeschainingmode_), + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, asymmetricfunction_), + PROTOBUF_FIELD_OFFSET(::crypto::CryptoConfig, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::ConfigureRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::ConfigureRequest, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::ConfigureRequest, config_), + PROTOBUF_FIELD_OFFSET(::crypto::ConfigureRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AddProcessRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AddProcessRequest, userid_), + PROTOBUF_FIELD_OFFSET(::crypto::AddProcessRequest, permissions_), + PROTOBUF_FIELD_OFFSET(::crypto::AddProcessRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::EncryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::EncryptResponse, encrypteddata_), + PROTOBUF_FIELD_OFFSET(::crypto::EncryptResponse, signature_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, encrypteddata_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, signature_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::DecryptRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::DecryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::DecryptResponse, decrypteddata_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, data_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, func_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, keylength_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, chainingmode_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptRequest, messageid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AESEncryptResponse, encrypteddata_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, senderid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, receiverid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, datain_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, inlen_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, dataout_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, func_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, keylength_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, chainingmode_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, counter_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, keyid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, isfirst_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, messageid_), + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptRequest, userid_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::crypto::AESDecryptResponse, decrypteddata_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::crypto::AsymetricEncryptRequest)}, + { 10, -1, -1, sizeof(::crypto::AsymetricEncryptResponse)}, + { 17, -1, -1, sizeof(::crypto::AsymetricDecryptRequest)}, + { 28, -1, -1, sizeof(::crypto::GetHashLengthRequest)}, + { 38, -1, -1, sizeof(::crypto::GetAESLengthRequest)}, + { 49, -1, -1, sizeof(::crypto::AsymetricDecryptResponse)}, + { 56, -1, -1, sizeof(::crypto::GetLengthRequest)}, + { 65, -1, -1, sizeof(::crypto::GetLengthResponse)}, + { 72, -1, -1, sizeof(::crypto::GetWholeLength)}, + { 83, -1, -1, sizeof(::crypto::GenerateAESKeyRequest)}, + { 94, -1, -1, sizeof(::crypto::GenerateAESKeyResponse)}, + { 101, -1, -1, sizeof(::crypto::GenerateKeyPairRequest)}, + { 110, -1, -1, sizeof(::crypto::GenerateKeyPairResponse)}, + { 118, -1, -1, sizeof(::crypto::SignRequest)}, + { 130, -1, -1, sizeof(::crypto::SignResponse)}, + { 137, -1, -1, sizeof(::crypto::VerifyRequest)}, + { 151, -1, -1, sizeof(::crypto::VerifyResponse)}, + { 159, -1, -1, sizeof(::crypto::KeyRequest)}, + { 168, -1, -1, sizeof(::crypto::KeyResponse)}, + { 175, -1, -1, sizeof(::crypto::UserKeyPermissions)}, + { 183, -1, -1, sizeof(::crypto::BootSystemRequest)}, + { 191, -1, -1, sizeof(::crypto::Empty)}, + { 197, -1, -1, sizeof(::crypto::CryptoConfig)}, + { 208, -1, -1, sizeof(::crypto::ConfigureRequest)}, + { 217, -1, -1, sizeof(::crypto::AddProcessRequest)}, + { 226, -1, -1, sizeof(::crypto::EncryptRequest)}, + { 238, -1, -1, sizeof(::crypto::EncryptResponse)}, + { 246, -1, -1, sizeof(::crypto::DecryptRequest)}, + { 259, -1, -1, sizeof(::crypto::DecryptResponse)}, + { 266, -1, -1, sizeof(::crypto::AESEncryptRequest)}, + { 282, -1, -1, sizeof(::crypto::AESEncryptResponse)}, + { 289, -1, -1, sizeof(::crypto::AESDecryptRequest)}, + { 308, -1, -1, sizeof(::crypto::AESDecryptResponse)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::crypto::_AsymetricEncryptRequest_default_instance_), + reinterpret_cast(&::crypto::_AsymetricEncryptResponse_default_instance_), + reinterpret_cast(&::crypto::_AsymetricDecryptRequest_default_instance_), + reinterpret_cast(&::crypto::_GetHashLengthRequest_default_instance_), + reinterpret_cast(&::crypto::_GetAESLengthRequest_default_instance_), + reinterpret_cast(&::crypto::_AsymetricDecryptResponse_default_instance_), + reinterpret_cast(&::crypto::_GetLengthRequest_default_instance_), + reinterpret_cast(&::crypto::_GetLengthResponse_default_instance_), + reinterpret_cast(&::crypto::_GetWholeLength_default_instance_), + reinterpret_cast(&::crypto::_GenerateAESKeyRequest_default_instance_), + reinterpret_cast(&::crypto::_GenerateAESKeyResponse_default_instance_), + reinterpret_cast(&::crypto::_GenerateKeyPairRequest_default_instance_), + reinterpret_cast(&::crypto::_GenerateKeyPairResponse_default_instance_), + reinterpret_cast(&::crypto::_SignRequest_default_instance_), + reinterpret_cast(&::crypto::_SignResponse_default_instance_), + reinterpret_cast(&::crypto::_VerifyRequest_default_instance_), + reinterpret_cast(&::crypto::_VerifyResponse_default_instance_), + reinterpret_cast(&::crypto::_KeyRequest_default_instance_), + reinterpret_cast(&::crypto::_KeyResponse_default_instance_), + reinterpret_cast(&::crypto::_UserKeyPermissions_default_instance_), + reinterpret_cast(&::crypto::_BootSystemRequest_default_instance_), + reinterpret_cast(&::crypto::_Empty_default_instance_), + reinterpret_cast(&::crypto::_CryptoConfig_default_instance_), + reinterpret_cast(&::crypto::_ConfigureRequest_default_instance_), + reinterpret_cast(&::crypto::_AddProcessRequest_default_instance_), + reinterpret_cast(&::crypto::_EncryptRequest_default_instance_), + reinterpret_cast(&::crypto::_EncryptResponse_default_instance_), + reinterpret_cast(&::crypto::_DecryptRequest_default_instance_), + reinterpret_cast(&::crypto::_DecryptResponse_default_instance_), + reinterpret_cast(&::crypto::_AESEncryptRequest_default_instance_), + reinterpret_cast(&::crypto::_AESEncryptResponse_default_instance_), + reinterpret_cast(&::crypto::_AESDecryptRequest_default_instance_), + reinterpret_cast(&::crypto::_AESDecryptResponse_default_instance_), +}; + +const char descriptor_table_protodef_proto_2fencryption_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\026proto/encryption.proto\022\006crypto\"[\n\027Asym" + "etricEncryptRequest\022\020\n\010senderId\030\001 \001(\005\022\r\n" + "\005keyId\030\002 \001(\t\022\014\n\004data\030\003 \001(\014\022\021\n\tmessageId\030" + "\004 \001(\t\"1\n\030AsymetricEncryptResponse\022\025\n\renc" + "ryptedData\030\001 \001(\014\"o\n\027AsymetricDecryptRequ" + "est\022\020\n\010senderId\030\001 \001(\005\022\022\n\nreceiverId\030\002 \001(" + "\005\022\r\n\005keyId\030\003 \001(\t\022\014\n\004data\030\004 \001(\014\022\021\n\tmessag" + "eId\030\005 \001(\t\"p\n\024GetHashLengthRequest\022\020\n\010sen" + "derId\030\001 \001(\005\022\"\n\004func\030\002 \001(\0162\024.crypto.SHAAl" + "gorithm\022\017\n\007dataLen\030\003 \001(\005\022\021\n\tmessageId\030\004 " + "\001(\t\"\213\001\n\023GetAESLengthRequest\022\020\n\010senderId\030" + "\001 \001(\005\022\017\n\007dataLen\030\002 \001(\005\022\017\n\007isFirst\030\003 \001(\010\022" + "-\n\014chainingMode\030\004 \001(\0162\027.crypto.AESChaini" + "ngMode\022\021\n\tmessageId\030\005 \001(\t\"1\n\030AsymetricDe" + "cryptResponse\022\025\n\rdecryptedData\030\001 \001(\014\"F\n\020" + "GetLengthRequest\022\020\n\010senderId\030\001 \001(\005\022\r\n\005in" + "Len\030\002 \001(\005\022\021\n\tmessageId\030\003 \001(\t\" \n\021GetLengt" + "hResponse\022\013\n\003len\030\001 \001(\005\"e\n\016GetWholeLength" + "\022\020\n\010senderId\030\001 \001(\005\022\r\n\005inLen\030\002 \001(\005\022\017\n\007isF" + "irst\030\003 \001(\010\022\021\n\tmessageId\030\004 \001(\t\022\016\n\006userId\030" + "\005 \001(\005\"\243\001\n\025GenerateAESKeyRequest\022\016\n\006userI" + "d\030\001 \001(\005\022*\n\013permissions\030\002 \003(\0162\025.crypto.Ke" + "yPermission\022\'\n\tkeyLength\030\003 \001(\0162\024.crypto." + "AESKeyLength\022\022\n\ndestUserId\030\004 \001(\005\022\021\n\tmess" + "ageId\030\005 \001(\t\"(\n\026GenerateAESKeyResponse\022\016\n" + "\006aesKey\030\001 \001(\t\"g\n\026GenerateKeyPairRequest\022" + "\016\n\006userId\030\001 \001(\005\022*\n\013permissions\030\002 \003(\0162\025.c" + "rypto.KeyPermission\022\021\n\tmessageId\030\003 \001(\t\"@" + "\n\027GenerateKeyPairResponse\022\021\n\tpublicKey\030\001" + " \001(\t\022\022\n\nprivateKey\030\002 \001(\t\"\210\001\n\013SignRequest" + "\022\020\n\010senderId\030\001 \001(\005\022\014\n\004data\030\002 \001(\014\022&\n\010hash" + "Func\030\003 \001(\0162\024.crypto.SHAAlgorithm\022\017\n\007coun" + "ter\030\005 \001(\003\022\r\n\005keyId\030\006 \001(\t\022\021\n\tmessageId\030\007 " + "\001(\t\"!\n\014SignResponse\022\021\n\tsignature\030\001 \001(\014\"\261" + "\001\n\rVerifyRequest\022\020\n\010senderId\030\001 \001(\005\022\022\n\nre" + "ceiverId\030\002 \001(\005\022\014\n\004data\030\003 \001(\014\022\021\n\tsignatur" + "e\030\004 \001(\014\022&\n\010hashFunc\030\005 \001(\0162\024.crypto.SHAAl" + "gorithm\022\r\n\005keyId\030\006 \001(\t\022\017\n\007counter\030\007 \001(\005\022" + "\021\n\tmessageId\030\010 \001(\t\",\n\016VerifyResponse\022\r\n\005" + "valid\030\001 \001(\010\022\013\n\003out\030\002 \001(\014\"A\n\nKeyRequest\022\020" + "\n\010senderId\030\001 \001(\005\022\016\n\006userId\030\002 \001(\005\022\021\n\tmess" + "ageId\030\003 \001(\t\"\032\n\013KeyResponse\022\013\n\003key\030\001 \001(\t\"" + "P\n\022UserKeyPermissions\022\016\n\006userId\030\001 \001(\005\022*\n" + "\013permissions\030\002 \003(\0162\025.crypto.KeyPermissio" + "n\"_\n\021BootSystemRequest\0227\n\023usersIdsPermis" + "sions\030\001 \003(\0132\032.crypto.UserKeyPermissions\022" + "\021\n\tmessageId\030\005 \001(\t\"\007\n\005Empty\"\343\001\n\014CryptoCo" + "nfig\022*\n\014hashFunction\030\001 \001(\0162\024.crypto.SHAA" + "lgorithm\022*\n\014aesKeyLength\030\002 \001(\0162\024.crypto." + "AESKeyLength\0220\n\017aesChainingMode\030\003 \001(\0162\027." + "crypto.AESChainingMode\0226\n\022asymmetricFunc" + "tion\030\004 \001(\0162\032.crypto.AsymmetricFunction\022\021" + "\n\tmessageId\030\005 \001(\t\"[\n\020ConfigureRequest\022\016\n" + "\006userId\030\001 \001(\005\022$\n\006config\030\002 \001(\0132\024.crypto.C" + "ryptoConfig\022\021\n\tmessageId\030\003 \001(\t\"b\n\021AddPro" + "cessRequest\022\016\n\006userId\030\001 \001(\005\022*\n\013permissio" + "ns\030\002 \003(\0162\025.crypto.KeyPermission\022\021\n\tmessa" + "geId\030\004 \001(\t\"y\n\016EncryptRequest\022\020\n\010senderId" + "\030\001 \001(\005\022\022\n\nreceiverId\030\002 \001(\005\022\014\n\004data\030\003 \001(\014" + "\022\017\n\007counter\030\004 \001(\003\022\017\n\007isFirst\030\005 \001(\010\022\021\n\tme" + "ssageId\030\006 \001(\t\";\n\017EncryptResponse\022\025\n\rencr" + "yptedData\030\001 \001(\014\022\021\n\tsignature\030\002 \001(\014\"\225\001\n\016D" + "ecryptRequest\022\020\n\010senderId\030\001 \001(\005\022\022\n\nrecei" + "verId\030\002 \001(\005\022\025\n\rencryptedData\030\003 \001(\014\022\017\n\007co" + "unter\030\004 \001(\003\022\021\n\tsignature\030\005 \001(\014\022\017\n\007isFirs" + "t\030\006 \001(\010\022\021\n\tmessageId\030\007 \001(\t\"(\n\017DecryptRes" + "ponse\022\025\n\rdecryptedData\030\001 \001(\014\"\215\002\n\021AESEncr" + "yptRequest\022\020\n\010senderId\030\001 \001(\005\022\022\n\nreceiver" + "Id\030\002 \001(\005\022\014\n\004data\030\003 \001(\014\022(\n\004func\030\004 \001(\0162\032.c" + "rypto.AsymmetricFunction\022\017\n\007counter\030\005 \001(" + "\003\022\r\n\005keyId\030\006 \001(\t\022\'\n\tkeyLength\030\007 \001(\0162\024.cr" + "ypto.AESKeyLength\022-\n\014chainingMode\030\010 \001(\0162" + "\027.crypto.AESChainingMode\022\017\n\007isFirst\030\t \001(" + "\010\022\021\n\tmessageId\030\n \001(\t\"+\n\022AESEncryptRespon" + "se\022\025\n\rencryptedData\030\001 \001(\014\"\277\002\n\021AESDecrypt" + "Request\022\020\n\010senderId\030\001 \001(\005\022\022\n\nreceiverId\030" + "\002 \001(\005\022\016\n\006dataIn\030\003 \001(\014\022\r\n\005inLen\030\004 \001(\005\022\017\n\007" + "dataOut\030\005 \001(\014\022(\n\004func\030\006 \001(\0162\032.crypto.Asy" + "mmetricFunction\022\'\n\tkeyLength\030\007 \001(\0162\024.cry" + "pto.AESKeyLength\022-\n\014chainingMode\030\010 \001(\0162\027" + ".crypto.AESChainingMode\022\017\n\007counter\030\t \001(\003" + "\022\r\n\005keyId\030\n \001(\t\022\017\n\007isFirst\030\013 \001(\010\022\021\n\tmess" + "ageId\030\014 \001(\t\022\016\n\006userId\030\r \001(\005\"+\n\022AESDecryp" + "tResponse\022\025\n\rdecrypteddata\030\001 \001(\014*O\n\rKeyP" + "ermission\022\n\n\006VERIFY\020\000\022\010\n\004SIGN\020\001\022\013\n\007ENCRY" + "PT\020\002\022\013\n\007DECRYPT\020\003\022\016\n\nEXPORTABLE\020\004*>\n\017AES" + "ChainingMode\022\007\n\003ECB\020\000\022\007\n\003CBC\020\001\022\007\n\003CFB\020\002\022" + "\007\n\003OFB\020\003\022\007\n\003CTR\020\004*&\n\022AsymmetricFunction\022" + "\007\n\003RSA\020\000\022\007\n\003ECC\020\001*(\n\014SHAAlgorithm\022\n\n\006SHA" + "256\020\000\022\014\n\010SHA3_512\020\001*5\n\014AESKeyLength\022\013\n\007A" + "ES_128\020\000\022\013\n\007AES_192\020\001\022\013\n\007AES_256\020\0022\231\021\n\rC" + "ryptoService\0226\n\nbootSystem\022\031.crypto.Boot" + "SystemRequest\032\r.crypto.Empty\0227\n\013addProcc" + "ess\022\031.crypto.AddProcessRequest\032\r.crypto." + "Empty\0224\n\tconfigure\022\030.crypto.ConfigureReq" + "uest\032\r.crypto.Empty\022O\n\016generateAESKey\022\035." + "crypto.GenerateAESKeyRequest\032\036.crypto.Ge" + "nerateAESKeyResponse\022U\n\022generateRSAKeyPa" + "ir\022\036.crypto.GenerateKeyPairRequest\032\037.cry" + "pto.GenerateKeyPairResponse\022U\n\022generateE" + "CCKeyPair\022\036.crypto.GenerateKeyPairReques" + "t\032\037.crypto.GenerateKeyPairResponse\022N\n\023ge" + "tSignedDataLength\022\034.crypto.GetHashLength" + "Request\032\031.crypto.GetLengthResponse\022L\n\025ge" + "tECCencryptedLength\022\030.crypto.GetLengthRe" + "quest\032\031.crypto.GetLengthResponse\022L\n\025getE" + "CCDecryptedLength\022\030.crypto.GetLengthRequ" + "est\032\031.crypto.GetLengthResponse\022L\n\025getRSA" + "encryptedLength\022\030.crypto.GetLengthReques" + "t\032\031.crypto.GetLengthResponse\022L\n\025getRSAde" + "cryptedLength\022\030.crypto.GetLengthRequest\032" + "\031.crypto.GetLengthResponse\022O\n\025getAESencr" + "yptedLength\022\033.crypto.GetAESLengthRequest" + "\032\031.crypto.GetLengthResponse\022O\n\025getAESdec" + "ryptedLength\022\033.crypto.GetAESLengthReques" + "t\032\031.crypto.GetLengthResponse\022D\n\017getEncry" + "ptedLen\022\026.crypto.GetWholeLength\032\031.crypto" + ".GetLengthResponse\022D\n\017getDecryptedLen\022\026." + "crypto.GetWholeLength\032\031.crypto.GetLength" + "Response\0221\n\004sign\022\023.crypto.SignRequest\032\024." + "crypto.SignResponse\0227\n\006verify\022\025.crypto.V" + "erifyRequest\032\026.crypto.VerifyResponse\022B\n\027" + "getPublicECCKeyByUserId\022\022.crypto.KeyRequ" + "est\032\023.crypto.KeyResponse\022B\n\027getPublicRSA" + "KeyByUserId\022\022.crypto.KeyRequest\032\023.crypto" + ".KeyResponse\022O\n\nECCencrypt\022\037.crypto.Asym" + "etricEncryptRequest\032 .crypto.AsymetricEn" + "cryptResponse\022O\n\nECCdecrypt\022\037.crypto.Asy" + "metricDecryptRequest\032 .crypto.AsymetricD" + "ecryptResponse\022O\n\nRSAencrypt\022\037.crypto.As" + "ymetricEncryptRequest\032 .crypto.Asymetric" + "EncryptResponse\022O\n\nRSAdecrypt\022\037.crypto.A" + "symetricDecryptRequest\032 .crypto.Asymetri" + "cDecryptResponse\022C\n\nAESencrypt\022\031.crypto." + "AESEncryptRequest\032\032.crypto.AESEncryptRes" + "ponse\022C\n\nAESdecrypt\022\031.crypto.AESDecryptR" + "equest\032\032.crypto.AESDecryptResponse\022:\n\007en" + "crypt\022\026.crypto.EncryptRequest\032\027.crypto.E" + "ncryptResponse\022:\n\007decrypt\022\026.crypto.Decry" + "ptRequest\032\027.crypto.DecryptResponse\0227\n\nsi" + "gnUpdate\022\023.crypto.SignRequest\032\024.crypto.S" + "ignResponse\0229\n\014signFinalize\022\023.crypto.Sig" + "nRequest\032\024.crypto.SignResponse\022=\n\014verify" + "Update\022\025.crypto.VerifyRequest\032\026.crypto.V" + "erifyResponse\022\?\n\016verifyFinalize\022\025.crypto" + ".VerifyRequest\032\026.crypto.VerifyResponseb\006" + "proto3" + ; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_proto_2fencryption_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_proto_2fencryption_2eproto = { + false, false, 5846, descriptor_table_protodef_proto_2fencryption_2eproto, "proto/encryption.proto", + &descriptor_table_proto_2fencryption_2eproto_once, nullptr, 0, 33, + schemas, file_default_instances, TableStruct_proto_2fencryption_2eproto::offsets, + file_level_metadata_proto_2fencryption_2eproto, file_level_enum_descriptors_proto_2fencryption_2eproto, file_level_service_descriptors_proto_2fencryption_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_proto_2fencryption_2eproto_getter() { + return &descriptor_table_proto_2fencryption_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_proto_2fencryption_2eproto(&descriptor_table_proto_2fencryption_2eproto); +namespace crypto { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* KeyPermission_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_proto_2fencryption_2eproto); + return file_level_enum_descriptors_proto_2fencryption_2eproto[0]; +} +bool KeyPermission_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AESChainingMode_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_proto_2fencryption_2eproto); + return file_level_enum_descriptors_proto_2fencryption_2eproto[1]; +} +bool AESChainingMode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AsymmetricFunction_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_proto_2fencryption_2eproto); + return file_level_enum_descriptors_proto_2fencryption_2eproto[2]; +} +bool AsymmetricFunction_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SHAAlgorithm_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_proto_2fencryption_2eproto); + return file_level_enum_descriptors_proto_2fencryption_2eproto[3]; +} +bool SHAAlgorithm_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AESKeyLength_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_proto_2fencryption_2eproto); + return file_level_enum_descriptors_proto_2fencryption_2eproto[4]; +} +bool AESKeyLength_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + + +// =================================================================== + +class AsymetricEncryptRequest::_Internal { + public: +}; + +AsymetricEncryptRequest::AsymetricEncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AsymetricEncryptRequest) +} +AsymetricEncryptRequest::AsymetricEncryptRequest(const AsymetricEncryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + senderid_ = from.senderid_; + // @@protoc_insertion_point(copy_constructor:crypto.AsymetricEncryptRequest) +} + +void AsymetricEncryptRequest::SharedCtor() { +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +senderid_ = 0; +} + +AsymetricEncryptRequest::~AsymetricEncryptRequest() { + // @@protoc_insertion_point(destructor:crypto.AsymetricEncryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AsymetricEncryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AsymetricEncryptRequest::ArenaDtor(void* object) { + AsymetricEncryptRequest* _this = reinterpret_cast< AsymetricEncryptRequest* >(object); + (void)_this; +} +void AsymetricEncryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AsymetricEncryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AsymetricEncryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AsymetricEncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + keyid_.ClearToEmpty(); + data_.ClearToEmpty(); + messageid_.ClearToEmpty(); + senderid_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AsymetricEncryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string keyId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AsymetricEncryptRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AsymetricEncryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AsymetricEncryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AsymetricEncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // string keyId = 2; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AsymetricEncryptRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_keyid(), target); + } + + // bytes data = 3; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_data(), target); + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AsymetricEncryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AsymetricEncryptRequest) + return target; +} + +size_t AsymetricEncryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AsymetricEncryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string keyId = 2; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // bytes data = 3; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AsymetricEncryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AsymetricEncryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AsymetricEncryptRequest::GetClassData() const { return &_class_data_; } + +void AsymetricEncryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AsymetricEncryptRequest::MergeFrom(const AsymetricEncryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AsymetricEncryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AsymetricEncryptRequest::CopyFrom(const AsymetricEncryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AsymetricEncryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AsymetricEncryptRequest::IsInitialized() const { + return true; +} + +void AsymetricEncryptRequest::InternalSwap(AsymetricEncryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + swap(senderid_, other->senderid_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AsymetricEncryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[0]); +} + +// =================================================================== + +class AsymetricEncryptResponse::_Internal { + public: +}; + +AsymetricEncryptResponse::AsymetricEncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AsymetricEncryptResponse) +} +AsymetricEncryptResponse::AsymetricEncryptResponse(const AsymetricEncryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_encrypteddata().empty()) { + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_encrypteddata(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.AsymetricEncryptResponse) +} + +void AsymetricEncryptResponse::SharedCtor() { +encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +AsymetricEncryptResponse::~AsymetricEncryptResponse() { + // @@protoc_insertion_point(destructor:crypto.AsymetricEncryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AsymetricEncryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + encrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AsymetricEncryptResponse::ArenaDtor(void* object) { + AsymetricEncryptResponse* _this = reinterpret_cast< AsymetricEncryptResponse* >(object); + (void)_this; +} +void AsymetricEncryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AsymetricEncryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AsymetricEncryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AsymetricEncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + encrypteddata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AsymetricEncryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes encryptedData = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_encrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AsymetricEncryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AsymetricEncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_encrypteddata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AsymetricEncryptResponse) + return target; +} + +size_t AsymetricEncryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AsymetricEncryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_encrypteddata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AsymetricEncryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AsymetricEncryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AsymetricEncryptResponse::GetClassData() const { return &_class_data_; } + +void AsymetricEncryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AsymetricEncryptResponse::MergeFrom(const AsymetricEncryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AsymetricEncryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_encrypteddata().empty()) { + _internal_set_encrypteddata(from._internal_encrypteddata()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AsymetricEncryptResponse::CopyFrom(const AsymetricEncryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AsymetricEncryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AsymetricEncryptResponse::IsInitialized() const { + return true; +} + +void AsymetricEncryptResponse::InternalSwap(AsymetricEncryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &encrypteddata_, lhs_arena, + &other->encrypteddata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AsymetricEncryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[1]); +} + +// =================================================================== + +class AsymetricDecryptRequest::_Internal { + public: +}; + +AsymetricDecryptRequest::AsymetricDecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AsymetricDecryptRequest) +} +AsymetricDecryptRequest::AsymetricDecryptRequest(const AsymetricDecryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&receiverid_) - + reinterpret_cast(&senderid_)) + sizeof(receiverid_)); + // @@protoc_insertion_point(copy_constructor:crypto.AsymetricDecryptRequest) +} + +void AsymetricDecryptRequest::SharedCtor() { +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&receiverid_) - + reinterpret_cast(&senderid_)) + sizeof(receiverid_)); +} + +AsymetricDecryptRequest::~AsymetricDecryptRequest() { + // @@protoc_insertion_point(destructor:crypto.AsymetricDecryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AsymetricDecryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AsymetricDecryptRequest::ArenaDtor(void* object) { + AsymetricDecryptRequest* _this = reinterpret_cast< AsymetricDecryptRequest* >(object); + (void)_this; +} +void AsymetricDecryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AsymetricDecryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AsymetricDecryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AsymetricDecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + keyid_.ClearToEmpty(); + data_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&receiverid_) - + reinterpret_cast(&senderid_)) + sizeof(receiverid_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AsymetricDecryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string keyId = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AsymetricDecryptRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AsymetricDecryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AsymetricDecryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AsymetricDecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // string keyId = 3; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AsymetricDecryptRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_keyid(), target); + } + + // bytes data = 4; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 4, this->_internal_data(), target); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AsymetricDecryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AsymetricDecryptRequest) + return target; +} + +size_t AsymetricDecryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AsymetricDecryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string keyId = 3; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // bytes data = 4; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AsymetricDecryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AsymetricDecryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AsymetricDecryptRequest::GetClassData() const { return &_class_data_; } + +void AsymetricDecryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AsymetricDecryptRequest::MergeFrom(const AsymetricDecryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AsymetricDecryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AsymetricDecryptRequest::CopyFrom(const AsymetricDecryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AsymetricDecryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AsymetricDecryptRequest::IsInitialized() const { + return true; +} + +void AsymetricDecryptRequest::InternalSwap(AsymetricDecryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(AsymetricDecryptRequest, receiverid_) + + sizeof(AsymetricDecryptRequest::receiverid_) + - PROTOBUF_FIELD_OFFSET(AsymetricDecryptRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AsymetricDecryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[2]); +} + +// =================================================================== + +class GetHashLengthRequest::_Internal { + public: +}; + +GetHashLengthRequest::GetHashLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GetHashLengthRequest) +} +GetHashLengthRequest::GetHashLengthRequest(const GetHashLengthRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&datalen_) - + reinterpret_cast(&senderid_)) + sizeof(datalen_)); + // @@protoc_insertion_point(copy_constructor:crypto.GetHashLengthRequest) +} + +void GetHashLengthRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&datalen_) - + reinterpret_cast(&senderid_)) + sizeof(datalen_)); +} + +GetHashLengthRequest::~GetHashLengthRequest() { + // @@protoc_insertion_point(destructor:crypto.GetHashLengthRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GetHashLengthRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GetHashLengthRequest::ArenaDtor(void* object) { + GetHashLengthRequest* _this = reinterpret_cast< GetHashLengthRequest* >(object); + (void)_this; +} +void GetHashLengthRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GetHashLengthRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GetHashLengthRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GetHashLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&datalen_) - + reinterpret_cast(&senderid_)) + sizeof(datalen_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GetHashLengthRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.SHAAlgorithm func = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_func(static_cast<::crypto::SHAAlgorithm>(val)); + } else + goto handle_unusual; + continue; + // int32 dataLen = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + datalen_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GetHashLengthRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GetHashLengthRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GetHashLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // .crypto.SHAAlgorithm func = 2; + if (this->_internal_func() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_func(), target); + } + + // int32 dataLen = 3; + if (this->_internal_datalen() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_datalen(), target); + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GetHashLengthRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GetHashLengthRequest) + return target; +} + +size_t GetHashLengthRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GetHashLengthRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // .crypto.SHAAlgorithm func = 2; + if (this->_internal_func() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_func()); + } + + // int32 dataLen = 3; + if (this->_internal_datalen() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_datalen()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GetHashLengthRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GetHashLengthRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetHashLengthRequest::GetClassData() const { return &_class_data_; } + +void GetHashLengthRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GetHashLengthRequest::MergeFrom(const GetHashLengthRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GetHashLengthRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_func() != 0) { + _internal_set_func(from._internal_func()); + } + if (from._internal_datalen() != 0) { + _internal_set_datalen(from._internal_datalen()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GetHashLengthRequest::CopyFrom(const GetHashLengthRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GetHashLengthRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GetHashLengthRequest::IsInitialized() const { + return true; +} + +void GetHashLengthRequest::InternalSwap(GetHashLengthRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GetHashLengthRequest, datalen_) + + sizeof(GetHashLengthRequest::datalen_) + - PROTOBUF_FIELD_OFFSET(GetHashLengthRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GetHashLengthRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[3]); +} + +// =================================================================== + +class GetAESLengthRequest::_Internal { + public: +}; + +GetAESLengthRequest::GetAESLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GetAESLengthRequest) +} +GetAESLengthRequest::GetAESLengthRequest(const GetAESLengthRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&chainingmode_) - + reinterpret_cast(&senderid_)) + sizeof(chainingmode_)); + // @@protoc_insertion_point(copy_constructor:crypto.GetAESLengthRequest) +} + +void GetAESLengthRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&chainingmode_) - + reinterpret_cast(&senderid_)) + sizeof(chainingmode_)); +} + +GetAESLengthRequest::~GetAESLengthRequest() { + // @@protoc_insertion_point(destructor:crypto.GetAESLengthRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GetAESLengthRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GetAESLengthRequest::ArenaDtor(void* object) { + GetAESLengthRequest* _this = reinterpret_cast< GetAESLengthRequest* >(object); + (void)_this; +} +void GetAESLengthRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GetAESLengthRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GetAESLengthRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GetAESLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&chainingmode_) - + reinterpret_cast(&senderid_)) + sizeof(chainingmode_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GetAESLengthRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 dataLen = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + datalen_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool isFirst = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.AESChainingMode chainingMode = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_chainingmode(static_cast<::crypto::AESChainingMode>(val)); + } else + goto handle_unusual; + continue; + // string messageId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GetAESLengthRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GetAESLengthRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GetAESLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 dataLen = 2; + if (this->_internal_datalen() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_datalen(), target); + } + + // bool isFirst = 3; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_isfirst(), target); + } + + // .crypto.AESChainingMode chainingMode = 4; + if (this->_internal_chainingmode() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_chainingmode(), target); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GetAESLengthRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GetAESLengthRequest) + return target; +} + +size_t GetAESLengthRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GetAESLengthRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 dataLen = 2; + if (this->_internal_datalen() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_datalen()); + } + + // bool isFirst = 3; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + // .crypto.AESChainingMode chainingMode = 4; + if (this->_internal_chainingmode() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_chainingmode()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GetAESLengthRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GetAESLengthRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetAESLengthRequest::GetClassData() const { return &_class_data_; } + +void GetAESLengthRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GetAESLengthRequest::MergeFrom(const GetAESLengthRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GetAESLengthRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_datalen() != 0) { + _internal_set_datalen(from._internal_datalen()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + if (from._internal_chainingmode() != 0) { + _internal_set_chainingmode(from._internal_chainingmode()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GetAESLengthRequest::CopyFrom(const GetAESLengthRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GetAESLengthRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GetAESLengthRequest::IsInitialized() const { + return true; +} + +void GetAESLengthRequest::InternalSwap(GetAESLengthRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GetAESLengthRequest, chainingmode_) + + sizeof(GetAESLengthRequest::chainingmode_) + - PROTOBUF_FIELD_OFFSET(GetAESLengthRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GetAESLengthRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[4]); +} + +// =================================================================== + +class AsymetricDecryptResponse::_Internal { + public: +}; + +AsymetricDecryptResponse::AsymetricDecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AsymetricDecryptResponse) +} +AsymetricDecryptResponse::AsymetricDecryptResponse(const AsymetricDecryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_decrypteddata().empty()) { + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_decrypteddata(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.AsymetricDecryptResponse) +} + +void AsymetricDecryptResponse::SharedCtor() { +decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +AsymetricDecryptResponse::~AsymetricDecryptResponse() { + // @@protoc_insertion_point(destructor:crypto.AsymetricDecryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AsymetricDecryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + decrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AsymetricDecryptResponse::ArenaDtor(void* object) { + AsymetricDecryptResponse* _this = reinterpret_cast< AsymetricDecryptResponse* >(object); + (void)_this; +} +void AsymetricDecryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AsymetricDecryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AsymetricDecryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AsymetricDecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + decrypteddata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AsymetricDecryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes decryptedData = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_decrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AsymetricDecryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AsymetricDecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes decryptedData = 1; + if (!this->_internal_decrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_decrypteddata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AsymetricDecryptResponse) + return target; +} + +size_t AsymetricDecryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AsymetricDecryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes decryptedData = 1; + if (!this->_internal_decrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_decrypteddata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AsymetricDecryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AsymetricDecryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AsymetricDecryptResponse::GetClassData() const { return &_class_data_; } + +void AsymetricDecryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AsymetricDecryptResponse::MergeFrom(const AsymetricDecryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AsymetricDecryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_decrypteddata().empty()) { + _internal_set_decrypteddata(from._internal_decrypteddata()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AsymetricDecryptResponse::CopyFrom(const AsymetricDecryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AsymetricDecryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AsymetricDecryptResponse::IsInitialized() const { + return true; +} + +void AsymetricDecryptResponse::InternalSwap(AsymetricDecryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &decrypteddata_, lhs_arena, + &other->decrypteddata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AsymetricDecryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[5]); +} + +// =================================================================== + +class GetLengthRequest::_Internal { + public: +}; + +GetLengthRequest::GetLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GetLengthRequest) +} +GetLengthRequest::GetLengthRequest(const GetLengthRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&inlen_) - + reinterpret_cast(&senderid_)) + sizeof(inlen_)); + // @@protoc_insertion_point(copy_constructor:crypto.GetLengthRequest) +} + +void GetLengthRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&inlen_) - + reinterpret_cast(&senderid_)) + sizeof(inlen_)); +} + +GetLengthRequest::~GetLengthRequest() { + // @@protoc_insertion_point(destructor:crypto.GetLengthRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GetLengthRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GetLengthRequest::ArenaDtor(void* object) { + GetLengthRequest* _this = reinterpret_cast< GetLengthRequest* >(object); + (void)_this; +} +void GetLengthRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GetLengthRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GetLengthRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GetLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&inlen_) - + reinterpret_cast(&senderid_)) + sizeof(inlen_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GetLengthRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 inLen = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + inlen_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GetLengthRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GetLengthRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GetLengthRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 inLen = 2; + if (this->_internal_inlen() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_inlen(), target); + } + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GetLengthRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GetLengthRequest) + return target; +} + +size_t GetLengthRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GetLengthRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 inLen = 2; + if (this->_internal_inlen() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_inlen()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GetLengthRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GetLengthRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetLengthRequest::GetClassData() const { return &_class_data_; } + +void GetLengthRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GetLengthRequest::MergeFrom(const GetLengthRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GetLengthRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_inlen() != 0) { + _internal_set_inlen(from._internal_inlen()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GetLengthRequest::CopyFrom(const GetLengthRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GetLengthRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GetLengthRequest::IsInitialized() const { + return true; +} + +void GetLengthRequest::InternalSwap(GetLengthRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GetLengthRequest, inlen_) + + sizeof(GetLengthRequest::inlen_) + - PROTOBUF_FIELD_OFFSET(GetLengthRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GetLengthRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[6]); +} + +// =================================================================== + +class GetLengthResponse::_Internal { + public: +}; + +GetLengthResponse::GetLengthResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GetLengthResponse) +} +GetLengthResponse::GetLengthResponse(const GetLengthResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + len_ = from.len_; + // @@protoc_insertion_point(copy_constructor:crypto.GetLengthResponse) +} + +void GetLengthResponse::SharedCtor() { +len_ = 0; +} + +GetLengthResponse::~GetLengthResponse() { + // @@protoc_insertion_point(destructor:crypto.GetLengthResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GetLengthResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void GetLengthResponse::ArenaDtor(void* object) { + GetLengthResponse* _this = reinterpret_cast< GetLengthResponse* >(object); + (void)_this; +} +void GetLengthResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GetLengthResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GetLengthResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GetLengthResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + len_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GetLengthResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 len = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + len_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GetLengthResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GetLengthResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 len = 1; + if (this->_internal_len() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_len(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GetLengthResponse) + return target; +} + +size_t GetLengthResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GetLengthResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // int32 len = 1; + if (this->_internal_len() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_len()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GetLengthResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GetLengthResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetLengthResponse::GetClassData() const { return &_class_data_; } + +void GetLengthResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GetLengthResponse::MergeFrom(const GetLengthResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GetLengthResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_len() != 0) { + _internal_set_len(from._internal_len()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GetLengthResponse::CopyFrom(const GetLengthResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GetLengthResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GetLengthResponse::IsInitialized() const { + return true; +} + +void GetLengthResponse::InternalSwap(GetLengthResponse* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(len_, other->len_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GetLengthResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[7]); +} + +// =================================================================== + +class GetWholeLength::_Internal { + public: +}; + +GetWholeLength::GetWholeLength(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GetWholeLength) +} +GetWholeLength::GetWholeLength(const GetWholeLength& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + // @@protoc_insertion_point(copy_constructor:crypto.GetWholeLength) +} + +void GetWholeLength::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); +} + +GetWholeLength::~GetWholeLength() { + // @@protoc_insertion_point(destructor:crypto.GetWholeLength) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GetWholeLength::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GetWholeLength::ArenaDtor(void* object) { + GetWholeLength* _this = reinterpret_cast< GetWholeLength* >(object); + (void)_this; +} +void GetWholeLength::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GetWholeLength::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GetWholeLength::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GetWholeLength) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GetWholeLength::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 inLen = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + inlen_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool isFirst = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GetWholeLength.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 userId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GetWholeLength::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GetWholeLength) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 inLen = 2; + if (this->_internal_inlen() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_inlen(), target); + } + + // bool isFirst = 3; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_isfirst(), target); + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GetWholeLength.messageId"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_messageid(), target); + } + + // int32 userId = 5; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_userid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GetWholeLength) + return target; +} + +size_t GetWholeLength::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GetWholeLength) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 inLen = 2; + if (this->_internal_inlen() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_inlen()); + } + + // bool isFirst = 3; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + // int32 userId = 5; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GetWholeLength::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GetWholeLength::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetWholeLength::GetClassData() const { return &_class_data_; } + +void GetWholeLength::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GetWholeLength::MergeFrom(const GetWholeLength& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GetWholeLength) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_inlen() != 0) { + _internal_set_inlen(from._internal_inlen()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GetWholeLength::CopyFrom(const GetWholeLength& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GetWholeLength) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GetWholeLength::IsInitialized() const { + return true; +} + +void GetWholeLength::InternalSwap(GetWholeLength* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GetWholeLength, userid_) + + sizeof(GetWholeLength::userid_) + - PROTOBUF_FIELD_OFFSET(GetWholeLength, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GetWholeLength::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[8]); +} + +// =================================================================== + +class GenerateAESKeyRequest::_Internal { + public: +}; + +GenerateAESKeyRequest::GenerateAESKeyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + permissions_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GenerateAESKeyRequest) +} +GenerateAESKeyRequest::GenerateAESKeyRequest(const GenerateAESKeyRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + permissions_(from.permissions_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&userid_, &from.userid_, + static_cast(reinterpret_cast(&destuserid_) - + reinterpret_cast(&userid_)) + sizeof(destuserid_)); + // @@protoc_insertion_point(copy_constructor:crypto.GenerateAESKeyRequest) +} + +void GenerateAESKeyRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&userid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&destuserid_) - + reinterpret_cast(&userid_)) + sizeof(destuserid_)); +} + +GenerateAESKeyRequest::~GenerateAESKeyRequest() { + // @@protoc_insertion_point(destructor:crypto.GenerateAESKeyRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GenerateAESKeyRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GenerateAESKeyRequest::ArenaDtor(void* object) { + GenerateAESKeyRequest* _this = reinterpret_cast< GenerateAESKeyRequest* >(object); + (void)_this; +} +void GenerateAESKeyRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GenerateAESKeyRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GenerateAESKeyRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GenerateAESKeyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + permissions_.Clear(); + messageid_.ClearToEmpty(); + ::memset(&userid_, 0, static_cast( + reinterpret_cast(&destuserid_) - + reinterpret_cast(&userid_)) + sizeof(destuserid_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GenerateAESKeyRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 userId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .crypto.KeyPermission permissions = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_permissions(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_add_permissions(static_cast<::crypto::KeyPermission>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESKeyLength keyLength = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_keylength(static_cast<::crypto::AESKeyLength>(val)); + } else + goto handle_unusual; + continue; + // int32 destUserId = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + destuserid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GenerateAESKeyRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GenerateAESKeyRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GenerateAESKeyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_userid(), target); + } + + // repeated .crypto.KeyPermission permissions = 2; + { + int byte_size = _permissions_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, permissions_, byte_size, target); + } + } + + // .crypto.AESKeyLength keyLength = 3; + if (this->_internal_keylength() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_keylength(), target); + } + + // int32 destUserId = 4; + if (this->_internal_destuserid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_destuserid(), target); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GenerateAESKeyRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GenerateAESKeyRequest) + return target; +} + +size_t GenerateAESKeyRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GenerateAESKeyRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .crypto.KeyPermission permissions = 2; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_permissions_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_permissions(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _permissions_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + // .crypto.AESKeyLength keyLength = 3; + if (this->_internal_keylength() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_keylength()); + } + + // int32 destUserId = 4; + if (this->_internal_destuserid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_destuserid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GenerateAESKeyRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GenerateAESKeyRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GenerateAESKeyRequest::GetClassData() const { return &_class_data_; } + +void GenerateAESKeyRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GenerateAESKeyRequest::MergeFrom(const GenerateAESKeyRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GenerateAESKeyRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + permissions_.MergeFrom(from.permissions_); + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + if (from._internal_keylength() != 0) { + _internal_set_keylength(from._internal_keylength()); + } + if (from._internal_destuserid() != 0) { + _internal_set_destuserid(from._internal_destuserid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GenerateAESKeyRequest::CopyFrom(const GenerateAESKeyRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GenerateAESKeyRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GenerateAESKeyRequest::IsInitialized() const { + return true; +} + +void GenerateAESKeyRequest::InternalSwap(GenerateAESKeyRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + permissions_.InternalSwap(&other->permissions_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(GenerateAESKeyRequest, destuserid_) + + sizeof(GenerateAESKeyRequest::destuserid_) + - PROTOBUF_FIELD_OFFSET(GenerateAESKeyRequest, userid_)>( + reinterpret_cast(&userid_), + reinterpret_cast(&other->userid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GenerateAESKeyRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[9]); +} + +// =================================================================== + +class GenerateAESKeyResponse::_Internal { + public: +}; + +GenerateAESKeyResponse::GenerateAESKeyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GenerateAESKeyResponse) +} +GenerateAESKeyResponse::GenerateAESKeyResponse(const GenerateAESKeyResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + aeskey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_aeskey().empty()) { + aeskey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aeskey(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.GenerateAESKeyResponse) +} + +void GenerateAESKeyResponse::SharedCtor() { +aeskey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +GenerateAESKeyResponse::~GenerateAESKeyResponse() { + // @@protoc_insertion_point(destructor:crypto.GenerateAESKeyResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GenerateAESKeyResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + aeskey_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GenerateAESKeyResponse::ArenaDtor(void* object) { + GenerateAESKeyResponse* _this = reinterpret_cast< GenerateAESKeyResponse* >(object); + (void)_this; +} +void GenerateAESKeyResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GenerateAESKeyResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GenerateAESKeyResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GenerateAESKeyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + aeskey_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GenerateAESKeyResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string aesKey = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_aeskey(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GenerateAESKeyResponse.aesKey")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GenerateAESKeyResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GenerateAESKeyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string aesKey = 1; + if (!this->_internal_aeskey().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_aeskey().data(), static_cast(this->_internal_aeskey().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GenerateAESKeyResponse.aesKey"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_aeskey(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GenerateAESKeyResponse) + return target; +} + +size_t GenerateAESKeyResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GenerateAESKeyResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string aesKey = 1; + if (!this->_internal_aeskey().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_aeskey()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GenerateAESKeyResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GenerateAESKeyResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GenerateAESKeyResponse::GetClassData() const { return &_class_data_; } + +void GenerateAESKeyResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GenerateAESKeyResponse::MergeFrom(const GenerateAESKeyResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GenerateAESKeyResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_aeskey().empty()) { + _internal_set_aeskey(from._internal_aeskey()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GenerateAESKeyResponse::CopyFrom(const GenerateAESKeyResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GenerateAESKeyResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GenerateAESKeyResponse::IsInitialized() const { + return true; +} + +void GenerateAESKeyResponse::InternalSwap(GenerateAESKeyResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &aeskey_, lhs_arena, + &other->aeskey_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GenerateAESKeyResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[10]); +} + +// =================================================================== + +class GenerateKeyPairRequest::_Internal { + public: +}; + +GenerateKeyPairRequest::GenerateKeyPairRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + permissions_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GenerateKeyPairRequest) +} +GenerateKeyPairRequest::GenerateKeyPairRequest(const GenerateKeyPairRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + permissions_(from.permissions_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + userid_ = from.userid_; + // @@protoc_insertion_point(copy_constructor:crypto.GenerateKeyPairRequest) +} + +void GenerateKeyPairRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +userid_ = 0; +} + +GenerateKeyPairRequest::~GenerateKeyPairRequest() { + // @@protoc_insertion_point(destructor:crypto.GenerateKeyPairRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GenerateKeyPairRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GenerateKeyPairRequest::ArenaDtor(void* object) { + GenerateKeyPairRequest* _this = reinterpret_cast< GenerateKeyPairRequest* >(object); + (void)_this; +} +void GenerateKeyPairRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GenerateKeyPairRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GenerateKeyPairRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GenerateKeyPairRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + permissions_.Clear(); + messageid_.ClearToEmpty(); + userid_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GenerateKeyPairRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 userId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .crypto.KeyPermission permissions = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_permissions(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_add_permissions(static_cast<::crypto::KeyPermission>(val)); + } else + goto handle_unusual; + continue; + // string messageId = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GenerateKeyPairRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GenerateKeyPairRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GenerateKeyPairRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_userid(), target); + } + + // repeated .crypto.KeyPermission permissions = 2; + { + int byte_size = _permissions_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, permissions_, byte_size, target); + } + } + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GenerateKeyPairRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GenerateKeyPairRequest) + return target; +} + +size_t GenerateKeyPairRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GenerateKeyPairRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .crypto.KeyPermission permissions = 2; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_permissions_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_permissions(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _permissions_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GenerateKeyPairRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GenerateKeyPairRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GenerateKeyPairRequest::GetClassData() const { return &_class_data_; } + +void GenerateKeyPairRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GenerateKeyPairRequest::MergeFrom(const GenerateKeyPairRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GenerateKeyPairRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + permissions_.MergeFrom(from.permissions_); + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GenerateKeyPairRequest::CopyFrom(const GenerateKeyPairRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GenerateKeyPairRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GenerateKeyPairRequest::IsInitialized() const { + return true; +} + +void GenerateKeyPairRequest::InternalSwap(GenerateKeyPairRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + permissions_.InternalSwap(&other->permissions_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + swap(userid_, other->userid_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GenerateKeyPairRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[11]); +} + +// =================================================================== + +class GenerateKeyPairResponse::_Internal { + public: +}; + +GenerateKeyPairResponse::GenerateKeyPairResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.GenerateKeyPairResponse) +} +GenerateKeyPairResponse::GenerateKeyPairResponse(const GenerateKeyPairResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + publickey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_publickey().empty()) { + publickey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_publickey(), + GetArenaForAllocation()); + } + privatekey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_privatekey().empty()) { + privatekey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_privatekey(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.GenerateKeyPairResponse) +} + +void GenerateKeyPairResponse::SharedCtor() { +publickey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +privatekey_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +GenerateKeyPairResponse::~GenerateKeyPairResponse() { + // @@protoc_insertion_point(destructor:crypto.GenerateKeyPairResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void GenerateKeyPairResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + publickey_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + privatekey_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void GenerateKeyPairResponse::ArenaDtor(void* object) { + GenerateKeyPairResponse* _this = reinterpret_cast< GenerateKeyPairResponse* >(object); + (void)_this; +} +void GenerateKeyPairResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void GenerateKeyPairResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void GenerateKeyPairResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.GenerateKeyPairResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + publickey_.ClearToEmpty(); + privatekey_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* GenerateKeyPairResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string publicKey = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_publickey(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GenerateKeyPairResponse.publicKey")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string privateKey = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_privatekey(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.GenerateKeyPairResponse.privateKey")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* GenerateKeyPairResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.GenerateKeyPairResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string publicKey = 1; + if (!this->_internal_publickey().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_publickey().data(), static_cast(this->_internal_publickey().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GenerateKeyPairResponse.publicKey"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_publickey(), target); + } + + // string privateKey = 2; + if (!this->_internal_privatekey().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_privatekey().data(), static_cast(this->_internal_privatekey().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.GenerateKeyPairResponse.privateKey"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_privatekey(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.GenerateKeyPairResponse) + return target; +} + +size_t GenerateKeyPairResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.GenerateKeyPairResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string publicKey = 1; + if (!this->_internal_publickey().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_publickey()); + } + + // string privateKey = 2; + if (!this->_internal_privatekey().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_privatekey()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GenerateKeyPairResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + GenerateKeyPairResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GenerateKeyPairResponse::GetClassData() const { return &_class_data_; } + +void GenerateKeyPairResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void GenerateKeyPairResponse::MergeFrom(const GenerateKeyPairResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.GenerateKeyPairResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_publickey().empty()) { + _internal_set_publickey(from._internal_publickey()); + } + if (!from._internal_privatekey().empty()) { + _internal_set_privatekey(from._internal_privatekey()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void GenerateKeyPairResponse::CopyFrom(const GenerateKeyPairResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.GenerateKeyPairResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GenerateKeyPairResponse::IsInitialized() const { + return true; +} + +void GenerateKeyPairResponse::InternalSwap(GenerateKeyPairResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &publickey_, lhs_arena, + &other->publickey_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &privatekey_, lhs_arena, + &other->privatekey_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata GenerateKeyPairResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[12]); +} + +// =================================================================== + +class SignRequest::_Internal { + public: +}; + +SignRequest::SignRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.SignRequest) +} +SignRequest::SignRequest(const SignRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); + // @@protoc_insertion_point(copy_constructor:crypto.SignRequest) +} + +void SignRequest::SharedCtor() { +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); +} + +SignRequest::~SignRequest() { + // @@protoc_insertion_point(destructor:crypto.SignRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void SignRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SignRequest::ArenaDtor(void* object) { + SignRequest* _this = reinterpret_cast< SignRequest* >(object); + (void)_this; +} +void SignRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SignRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SignRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.SignRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + data_.ClearToEmpty(); + keyid_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* SignRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.SHAAlgorithm hashFunc = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_hashfunc(static_cast<::crypto::SHAAlgorithm>(val)); + } else + goto handle_unusual; + continue; + // int64 counter = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string keyId = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.SignRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.SignRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* SignRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.SignRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // bytes data = 2; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 2, this->_internal_data(), target); + } + + // .crypto.SHAAlgorithm hashFunc = 3; + if (this->_internal_hashfunc() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_hashfunc(), target); + } + + // int64 counter = 5; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_counter(), target); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.SignRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 6, this->_internal_keyid(), target); + } + + // string messageId = 7; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.SignRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 7, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.SignRequest) + return target; +} + +size_t SignRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.SignRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes data = 2; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // string messageId = 7; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // .crypto.SHAAlgorithm hashFunc = 3; + if (this->_internal_hashfunc() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_hashfunc()); + } + + // int64 counter = 5; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SignRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + SignRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SignRequest::GetClassData() const { return &_class_data_; } + +void SignRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void SignRequest::MergeFrom(const SignRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.SignRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_hashfunc() != 0) { + _internal_set_hashfunc(from._internal_hashfunc()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void SignRequest::CopyFrom(const SignRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.SignRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SignRequest::IsInitialized() const { + return true; +} + +void SignRequest::InternalSwap(SignRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SignRequest, counter_) + + sizeof(SignRequest::counter_) + - PROTOBUF_FIELD_OFFSET(SignRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata SignRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[13]); +} + +// =================================================================== + +class SignResponse::_Internal { + public: +}; + +SignResponse::SignResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.SignResponse) +} +SignResponse::SignResponse(const SignResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_signature().empty()) { + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_signature(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.SignResponse) +} + +void SignResponse::SharedCtor() { +signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +SignResponse::~SignResponse() { + // @@protoc_insertion_point(destructor:crypto.SignResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void SignResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + signature_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SignResponse::ArenaDtor(void* object) { + SignResponse* _this = reinterpret_cast< SignResponse* >(object); + (void)_this; +} +void SignResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SignResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SignResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.SignResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + signature_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* SignResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes signature = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_signature(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* SignResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.SignResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes signature = 1; + if (!this->_internal_signature().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_signature(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.SignResponse) + return target; +} + +size_t SignResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.SignResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes signature = 1; + if (!this->_internal_signature().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_signature()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SignResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + SignResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SignResponse::GetClassData() const { return &_class_data_; } + +void SignResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void SignResponse::MergeFrom(const SignResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.SignResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_signature().empty()) { + _internal_set_signature(from._internal_signature()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void SignResponse::CopyFrom(const SignResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.SignResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SignResponse::IsInitialized() const { + return true; +} + +void SignResponse::InternalSwap(SignResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &signature_, lhs_arena, + &other->signature_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata SignResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[14]); +} + +// =================================================================== + +class VerifyRequest::_Internal { + public: +}; + +VerifyRequest::VerifyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.VerifyRequest) +} +VerifyRequest::VerifyRequest(const VerifyRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_signature().empty()) { + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_signature(), + GetArenaForAllocation()); + } + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); + // @@protoc_insertion_point(copy_constructor:crypto.VerifyRequest) +} + +void VerifyRequest::SharedCtor() { +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); +} + +VerifyRequest::~VerifyRequest() { + // @@protoc_insertion_point(destructor:crypto.VerifyRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void VerifyRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + signature_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void VerifyRequest::ArenaDtor(void* object) { + VerifyRequest* _this = reinterpret_cast< VerifyRequest* >(object); + (void)_this; +} +void VerifyRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void VerifyRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void VerifyRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.VerifyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + data_.ClearToEmpty(); + signature_.ClearToEmpty(); + keyid_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&counter_) - + reinterpret_cast(&senderid_)) + sizeof(counter_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* VerifyRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes signature = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_signature(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.SHAAlgorithm hashFunc = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_hashfunc(static_cast<::crypto::SHAAlgorithm>(val)); + } else + goto handle_unusual; + continue; + // string keyId = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.VerifyRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 counter = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.VerifyRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* VerifyRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.VerifyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // bytes data = 3; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_data(), target); + } + + // bytes signature = 4; + if (!this->_internal_signature().empty()) { + target = stream->WriteBytesMaybeAliased( + 4, this->_internal_signature(), target); + } + + // .crypto.SHAAlgorithm hashFunc = 5; + if (this->_internal_hashfunc() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 5, this->_internal_hashfunc(), target); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.VerifyRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 6, this->_internal_keyid(), target); + } + + // int32 counter = 7; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_counter(), target); + } + + // string messageId = 8; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.VerifyRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 8, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.VerifyRequest) + return target; +} + +size_t VerifyRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.VerifyRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes data = 3; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // bytes signature = 4; + if (!this->_internal_signature().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_signature()); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // string messageId = 8; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + // .crypto.SHAAlgorithm hashFunc = 5; + if (this->_internal_hashfunc() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_hashfunc()); + } + + // int32 counter = 7; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_counter()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VerifyRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + VerifyRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VerifyRequest::GetClassData() const { return &_class_data_; } + +void VerifyRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void VerifyRequest::MergeFrom(const VerifyRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.VerifyRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_signature().empty()) { + _internal_set_signature(from._internal_signature()); + } + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + if (from._internal_hashfunc() != 0) { + _internal_set_hashfunc(from._internal_hashfunc()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void VerifyRequest::CopyFrom(const VerifyRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.VerifyRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool VerifyRequest::IsInitialized() const { + return true; +} + +void VerifyRequest::InternalSwap(VerifyRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &signature_, lhs_arena, + &other->signature_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(VerifyRequest, counter_) + + sizeof(VerifyRequest::counter_) + - PROTOBUF_FIELD_OFFSET(VerifyRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata VerifyRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[15]); +} + +// =================================================================== + +class VerifyResponse::_Internal { + public: +}; + +VerifyResponse::VerifyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.VerifyResponse) +} +VerifyResponse::VerifyResponse(const VerifyResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + out_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_out().empty()) { + out_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_out(), + GetArenaForAllocation()); + } + valid_ = from.valid_; + // @@protoc_insertion_point(copy_constructor:crypto.VerifyResponse) +} + +void VerifyResponse::SharedCtor() { +out_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +valid_ = false; +} + +VerifyResponse::~VerifyResponse() { + // @@protoc_insertion_point(destructor:crypto.VerifyResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void VerifyResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + out_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void VerifyResponse::ArenaDtor(void* object) { + VerifyResponse* _this = reinterpret_cast< VerifyResponse* >(object); + (void)_this; +} +void VerifyResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void VerifyResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void VerifyResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.VerifyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + out_.ClearToEmpty(); + valid_ = false; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* VerifyResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bool valid = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + valid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes out = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_out(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* VerifyResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.VerifyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bool valid = 1; + if (this->_internal_valid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_valid(), target); + } + + // bytes out = 2; + if (!this->_internal_out().empty()) { + target = stream->WriteBytesMaybeAliased( + 2, this->_internal_out(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.VerifyResponse) + return target; +} + +size_t VerifyResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.VerifyResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes out = 2; + if (!this->_internal_out().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_out()); + } + + // bool valid = 1; + if (this->_internal_valid() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VerifyResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + VerifyResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VerifyResponse::GetClassData() const { return &_class_data_; } + +void VerifyResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void VerifyResponse::MergeFrom(const VerifyResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.VerifyResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_out().empty()) { + _internal_set_out(from._internal_out()); + } + if (from._internal_valid() != 0) { + _internal_set_valid(from._internal_valid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void VerifyResponse::CopyFrom(const VerifyResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.VerifyResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool VerifyResponse::IsInitialized() const { + return true; +} + +void VerifyResponse::InternalSwap(VerifyResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &out_, lhs_arena, + &other->out_, rhs_arena + ); + swap(valid_, other->valid_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata VerifyResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[16]); +} + +// =================================================================== + +class KeyRequest::_Internal { + public: +}; + +KeyRequest::KeyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.KeyRequest) +} +KeyRequest::KeyRequest(const KeyRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + // @@protoc_insertion_point(copy_constructor:crypto.KeyRequest) +} + +void KeyRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); +} + +KeyRequest::~KeyRequest() { + // @@protoc_insertion_point(destructor:crypto.KeyRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void KeyRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void KeyRequest::ArenaDtor(void* object) { + KeyRequest* _this = reinterpret_cast< KeyRequest* >(object); + (void)_this; +} +void KeyRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void KeyRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void KeyRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.KeyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* KeyRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 userId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.KeyRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* KeyRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.KeyRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 userId = 2; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_userid(), target); + } + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.KeyRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.KeyRequest) + return target; +} + +size_t KeyRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.KeyRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 userId = 2; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData KeyRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + KeyRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*KeyRequest::GetClassData() const { return &_class_data_; } + +void KeyRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void KeyRequest::MergeFrom(const KeyRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.KeyRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void KeyRequest::CopyFrom(const KeyRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.KeyRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool KeyRequest::IsInitialized() const { + return true; +} + +void KeyRequest::InternalSwap(KeyRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(KeyRequest, userid_) + + sizeof(KeyRequest::userid_) + - PROTOBUF_FIELD_OFFSET(KeyRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata KeyRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[17]); +} + +// =================================================================== + +class KeyResponse::_Internal { + public: +}; + +KeyResponse::KeyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.KeyResponse) +} +KeyResponse::KeyResponse(const KeyResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_key().empty()) { + key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_key(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.KeyResponse) +} + +void KeyResponse::SharedCtor() { +key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +KeyResponse::~KeyResponse() { + // @@protoc_insertion_point(destructor:crypto.KeyResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void KeyResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + key_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void KeyResponse::ArenaDtor(void* object) { + KeyResponse* _this = reinterpret_cast< KeyResponse* >(object); + (void)_this; +} +void KeyResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void KeyResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void KeyResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.KeyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + key_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* KeyResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string key = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_key(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.KeyResponse.key")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* KeyResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.KeyResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string key = 1; + if (!this->_internal_key().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_key().data(), static_cast(this->_internal_key().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.KeyResponse.key"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_key(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.KeyResponse) + return target; +} + +size_t KeyResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.KeyResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string key = 1; + if (!this->_internal_key().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_key()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData KeyResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + KeyResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*KeyResponse::GetClassData() const { return &_class_data_; } + +void KeyResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void KeyResponse::MergeFrom(const KeyResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.KeyResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_key().empty()) { + _internal_set_key(from._internal_key()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void KeyResponse::CopyFrom(const KeyResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.KeyResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool KeyResponse::IsInitialized() const { + return true; +} + +void KeyResponse::InternalSwap(KeyResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &key_, lhs_arena, + &other->key_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata KeyResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[18]); +} + +// =================================================================== + +class UserKeyPermissions::_Internal { + public: +}; + +UserKeyPermissions::UserKeyPermissions(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + permissions_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.UserKeyPermissions) +} +UserKeyPermissions::UserKeyPermissions(const UserKeyPermissions& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + permissions_(from.permissions_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + userid_ = from.userid_; + // @@protoc_insertion_point(copy_constructor:crypto.UserKeyPermissions) +} + +void UserKeyPermissions::SharedCtor() { +userid_ = 0; +} + +UserKeyPermissions::~UserKeyPermissions() { + // @@protoc_insertion_point(destructor:crypto.UserKeyPermissions) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void UserKeyPermissions::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void UserKeyPermissions::ArenaDtor(void* object) { + UserKeyPermissions* _this = reinterpret_cast< UserKeyPermissions* >(object); + (void)_this; +} +void UserKeyPermissions::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void UserKeyPermissions::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void UserKeyPermissions::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.UserKeyPermissions) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + permissions_.Clear(); + userid_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* UserKeyPermissions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 userId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .crypto.KeyPermission permissions = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_permissions(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_add_permissions(static_cast<::crypto::KeyPermission>(val)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* UserKeyPermissions::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.UserKeyPermissions) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_userid(), target); + } + + // repeated .crypto.KeyPermission permissions = 2; + { + int byte_size = _permissions_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, permissions_, byte_size, target); + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.UserKeyPermissions) + return target; +} + +size_t UserKeyPermissions::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.UserKeyPermissions) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .crypto.KeyPermission permissions = 2; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_permissions_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_permissions(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _permissions_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UserKeyPermissions::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + UserKeyPermissions::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UserKeyPermissions::GetClassData() const { return &_class_data_; } + +void UserKeyPermissions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void UserKeyPermissions::MergeFrom(const UserKeyPermissions& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.UserKeyPermissions) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + permissions_.MergeFrom(from.permissions_); + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void UserKeyPermissions::CopyFrom(const UserKeyPermissions& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.UserKeyPermissions) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UserKeyPermissions::IsInitialized() const { + return true; +} + +void UserKeyPermissions::InternalSwap(UserKeyPermissions* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + permissions_.InternalSwap(&other->permissions_); + swap(userid_, other->userid_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata UserKeyPermissions::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[19]); +} + +// =================================================================== + +class BootSystemRequest::_Internal { + public: +}; + +BootSystemRequest::BootSystemRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + usersidspermissions_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.BootSystemRequest) +} +BootSystemRequest::BootSystemRequest(const BootSystemRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + usersidspermissions_(from.usersidspermissions_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.BootSystemRequest) +} + +void BootSystemRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +BootSystemRequest::~BootSystemRequest() { + // @@protoc_insertion_point(destructor:crypto.BootSystemRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void BootSystemRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void BootSystemRequest::ArenaDtor(void* object) { + BootSystemRequest* _this = reinterpret_cast< BootSystemRequest* >(object); + (void)_this; +} +void BootSystemRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void BootSystemRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void BootSystemRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.BootSystemRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + usersidspermissions_.Clear(); + messageid_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* BootSystemRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .crypto.UserKeyPermissions usersIdsPermissions = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_usersidspermissions(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else + goto handle_unusual; + continue; + // string messageId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.BootSystemRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* BootSystemRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.BootSystemRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .crypto.UserKeyPermissions usersIdsPermissions = 1; + for (unsigned int i = 0, + n = static_cast(this->_internal_usersidspermissions_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, this->_internal_usersidspermissions(i), target, stream); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.BootSystemRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.BootSystemRequest) + return target; +} + +size_t BootSystemRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.BootSystemRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .crypto.UserKeyPermissions usersIdsPermissions = 1; + total_size += 1UL * this->_internal_usersidspermissions_size(); + for (const auto& msg : this->usersidspermissions_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BootSystemRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + BootSystemRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*BootSystemRequest::GetClassData() const { return &_class_data_; } + +void BootSystemRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void BootSystemRequest::MergeFrom(const BootSystemRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.BootSystemRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + usersidspermissions_.MergeFrom(from.usersidspermissions_); + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void BootSystemRequest::CopyFrom(const BootSystemRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.BootSystemRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool BootSystemRequest::IsInitialized() const { + return true; +} + +void BootSystemRequest::InternalSwap(BootSystemRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + usersidspermissions_.InternalSwap(&other->usersidspermissions_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata BootSystemRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[20]); +} + +// =================================================================== + +class Empty::_Internal { + public: +}; + +Empty::Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase(arena, is_message_owned) { + // @@protoc_insertion_point(arena_constructor:crypto.Empty) +} +Empty::Empty(const Empty& from) + : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:crypto.Empty) +} + + + + + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Empty::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl, + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl, +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Empty::GetClassData() const { return &_class_data_; } + + + + + + + +::PROTOBUF_NAMESPACE_ID::Metadata Empty::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[21]); +} + +// =================================================================== + +class CryptoConfig::_Internal { + public: +}; + +CryptoConfig::CryptoConfig(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.CryptoConfig) +} +CryptoConfig::CryptoConfig(const CryptoConfig& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&hashfunction_, &from.hashfunction_, + static_cast(reinterpret_cast(&asymmetricfunction_) - + reinterpret_cast(&hashfunction_)) + sizeof(asymmetricfunction_)); + // @@protoc_insertion_point(copy_constructor:crypto.CryptoConfig) +} + +void CryptoConfig::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&hashfunction_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&asymmetricfunction_) - + reinterpret_cast(&hashfunction_)) + sizeof(asymmetricfunction_)); +} + +CryptoConfig::~CryptoConfig() { + // @@protoc_insertion_point(destructor:crypto.CryptoConfig) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void CryptoConfig::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void CryptoConfig::ArenaDtor(void* object) { + CryptoConfig* _this = reinterpret_cast< CryptoConfig* >(object); + (void)_this; +} +void CryptoConfig::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void CryptoConfig::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void CryptoConfig::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.CryptoConfig) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + ::memset(&hashfunction_, 0, static_cast( + reinterpret_cast(&asymmetricfunction_) - + reinterpret_cast(&hashfunction_)) + sizeof(asymmetricfunction_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* CryptoConfig::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // .crypto.SHAAlgorithm hashFunction = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_hashfunction(static_cast<::crypto::SHAAlgorithm>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESKeyLength aesKeyLength = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_aeskeylength(static_cast<::crypto::AESKeyLength>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESChainingMode aesChainingMode = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_aeschainingmode(static_cast<::crypto::AESChainingMode>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AsymmetricFunction asymmetricFunction = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_asymmetricfunction(static_cast<::crypto::AsymmetricFunction>(val)); + } else + goto handle_unusual; + continue; + // string messageId = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.CryptoConfig.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* CryptoConfig::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.CryptoConfig) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // .crypto.SHAAlgorithm hashFunction = 1; + if (this->_internal_hashfunction() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_hashfunction(), target); + } + + // .crypto.AESKeyLength aesKeyLength = 2; + if (this->_internal_aeskeylength() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_aeskeylength(), target); + } + + // .crypto.AESChainingMode aesChainingMode = 3; + if (this->_internal_aeschainingmode() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_aeschainingmode(), target); + } + + // .crypto.AsymmetricFunction asymmetricFunction = 4; + if (this->_internal_asymmetricfunction() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_asymmetricfunction(), target); + } + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.CryptoConfig.messageId"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.CryptoConfig) + return target; +} + +size_t CryptoConfig::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.CryptoConfig) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 5; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // .crypto.SHAAlgorithm hashFunction = 1; + if (this->_internal_hashfunction() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_hashfunction()); + } + + // .crypto.AESKeyLength aesKeyLength = 2; + if (this->_internal_aeskeylength() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_aeskeylength()); + } + + // .crypto.AESChainingMode aesChainingMode = 3; + if (this->_internal_aeschainingmode() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_aeschainingmode()); + } + + // .crypto.AsymmetricFunction asymmetricFunction = 4; + if (this->_internal_asymmetricfunction() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_asymmetricfunction()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CryptoConfig::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + CryptoConfig::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CryptoConfig::GetClassData() const { return &_class_data_; } + +void CryptoConfig::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void CryptoConfig::MergeFrom(const CryptoConfig& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.CryptoConfig) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_hashfunction() != 0) { + _internal_set_hashfunction(from._internal_hashfunction()); + } + if (from._internal_aeskeylength() != 0) { + _internal_set_aeskeylength(from._internal_aeskeylength()); + } + if (from._internal_aeschainingmode() != 0) { + _internal_set_aeschainingmode(from._internal_aeschainingmode()); + } + if (from._internal_asymmetricfunction() != 0) { + _internal_set_asymmetricfunction(from._internal_asymmetricfunction()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void CryptoConfig::CopyFrom(const CryptoConfig& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.CryptoConfig) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CryptoConfig::IsInitialized() const { + return true; +} + +void CryptoConfig::InternalSwap(CryptoConfig* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(CryptoConfig, asymmetricfunction_) + + sizeof(CryptoConfig::asymmetricfunction_) + - PROTOBUF_FIELD_OFFSET(CryptoConfig, hashfunction_)>( + reinterpret_cast(&hashfunction_), + reinterpret_cast(&other->hashfunction_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata CryptoConfig::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[22]); +} + +// =================================================================== + +class ConfigureRequest::_Internal { + public: + static const ::crypto::CryptoConfig& config(const ConfigureRequest* msg); +}; + +const ::crypto::CryptoConfig& +ConfigureRequest::_Internal::config(const ConfigureRequest* msg) { + return *msg->config_; +} +ConfigureRequest::ConfigureRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.ConfigureRequest) +} +ConfigureRequest::ConfigureRequest(const ConfigureRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + if (from._internal_has_config()) { + config_ = new ::crypto::CryptoConfig(*from.config_); + } else { + config_ = nullptr; + } + userid_ = from.userid_; + // @@protoc_insertion_point(copy_constructor:crypto.ConfigureRequest) +} + +void ConfigureRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&config_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&config_)) + sizeof(userid_)); +} + +ConfigureRequest::~ConfigureRequest() { + // @@protoc_insertion_point(destructor:crypto.ConfigureRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void ConfigureRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete config_; +} + +void ConfigureRequest::ArenaDtor(void* object) { + ConfigureRequest* _this = reinterpret_cast< ConfigureRequest* >(object); + (void)_this; +} +void ConfigureRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ConfigureRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ConfigureRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.ConfigureRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + messageid_.ClearToEmpty(); + if (GetArenaForAllocation() == nullptr && config_ != nullptr) { + delete config_; + } + config_ = nullptr; + userid_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* ConfigureRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 userId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.CryptoConfig config = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_config(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.ConfigureRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* ConfigureRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.ConfigureRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_userid(), target); + } + + // .crypto.CryptoConfig config = 2; + if (this->_internal_has_config()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::config(this), target, stream); + } + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.ConfigureRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.ConfigureRequest) + return target; +} + +size_t ConfigureRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.ConfigureRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string messageId = 3; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // .crypto.CryptoConfig config = 2; + if (this->_internal_has_config()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *config_); + } + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ConfigureRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + ConfigureRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ConfigureRequest::GetClassData() const { return &_class_data_; } + +void ConfigureRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void ConfigureRequest::MergeFrom(const ConfigureRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.ConfigureRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_has_config()) { + _internal_mutable_config()->::crypto::CryptoConfig::MergeFrom(from._internal_config()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void ConfigureRequest::CopyFrom(const ConfigureRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.ConfigureRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ConfigureRequest::IsInitialized() const { + return true; +} + +void ConfigureRequest::InternalSwap(ConfigureRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ConfigureRequest, userid_) + + sizeof(ConfigureRequest::userid_) + - PROTOBUF_FIELD_OFFSET(ConfigureRequest, config_)>( + reinterpret_cast(&config_), + reinterpret_cast(&other->config_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ConfigureRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[23]); +} + +// =================================================================== + +class AddProcessRequest::_Internal { + public: +}; + +AddProcessRequest::AddProcessRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + permissions_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AddProcessRequest) +} +AddProcessRequest::AddProcessRequest(const AddProcessRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + permissions_(from.permissions_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + userid_ = from.userid_; + // @@protoc_insertion_point(copy_constructor:crypto.AddProcessRequest) +} + +void AddProcessRequest::SharedCtor() { +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +userid_ = 0; +} + +AddProcessRequest::~AddProcessRequest() { + // @@protoc_insertion_point(destructor:crypto.AddProcessRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AddProcessRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AddProcessRequest::ArenaDtor(void* object) { + AddProcessRequest* _this = reinterpret_cast< AddProcessRequest* >(object); + (void)_this; +} +void AddProcessRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AddProcessRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AddProcessRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AddProcessRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + permissions_.Clear(); + messageid_.ClearToEmpty(); + userid_ = 0; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AddProcessRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 userId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .crypto.KeyPermission permissions = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_permissions(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_add_permissions(static_cast<::crypto::KeyPermission>(val)); + } else + goto handle_unusual; + continue; + // string messageId = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AddProcessRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AddProcessRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AddProcessRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_userid(), target); + } + + // repeated .crypto.KeyPermission permissions = 2; + { + int byte_size = _permissions_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, permissions_, byte_size, target); + } + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AddProcessRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AddProcessRequest) + return target; +} + +size_t AddProcessRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AddProcessRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .crypto.KeyPermission permissions = 2; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_permissions_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_permissions(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _permissions_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // string messageId = 4; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 userId = 1; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AddProcessRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AddProcessRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AddProcessRequest::GetClassData() const { return &_class_data_; } + +void AddProcessRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AddProcessRequest::MergeFrom(const AddProcessRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AddProcessRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + permissions_.MergeFrom(from.permissions_); + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AddProcessRequest::CopyFrom(const AddProcessRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AddProcessRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AddProcessRequest::IsInitialized() const { + return true; +} + +void AddProcessRequest::InternalSwap(AddProcessRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + permissions_.InternalSwap(&other->permissions_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + swap(userid_, other->userid_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AddProcessRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[24]); +} + +// =================================================================== + +class EncryptRequest::_Internal { + public: +}; + +EncryptRequest::EncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.EncryptRequest) +} +EncryptRequest::EncryptRequest(const EncryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + // @@protoc_insertion_point(copy_constructor:crypto.EncryptRequest) +} + +void EncryptRequest::SharedCtor() { +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); +} + +EncryptRequest::~EncryptRequest() { + // @@protoc_insertion_point(destructor:crypto.EncryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void EncryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void EncryptRequest::ArenaDtor(void* object) { + EncryptRequest* _this = reinterpret_cast< EncryptRequest* >(object); + (void)_this; +} +void EncryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void EncryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void EncryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.EncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + data_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* EncryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int64 counter = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool isFirst = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.EncryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* EncryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.EncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // bytes data = 3; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_data(), target); + } + + // int64 counter = 4; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_counter(), target); + } + + // bool isFirst = 5; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_isfirst(), target); + } + + // string messageId = 6; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.EncryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 6, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.EncryptRequest) + return target; +} + +size_t EncryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.EncryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes data = 3; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // string messageId = 6; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + // int64 counter = 4; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter()); + } + + // bool isFirst = 5; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EncryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + EncryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EncryptRequest::GetClassData() const { return &_class_data_; } + +void EncryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void EncryptRequest::MergeFrom(const EncryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.EncryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void EncryptRequest::CopyFrom(const EncryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.EncryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EncryptRequest::IsInitialized() const { + return true; +} + +void EncryptRequest::InternalSwap(EncryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(EncryptRequest, isfirst_) + + sizeof(EncryptRequest::isfirst_) + - PROTOBUF_FIELD_OFFSET(EncryptRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata EncryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[25]); +} + +// =================================================================== + +class EncryptResponse::_Internal { + public: +}; + +EncryptResponse::EncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.EncryptResponse) +} +EncryptResponse::EncryptResponse(const EncryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_encrypteddata().empty()) { + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_encrypteddata(), + GetArenaForAllocation()); + } + signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_signature().empty()) { + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_signature(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.EncryptResponse) +} + +void EncryptResponse::SharedCtor() { +encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +EncryptResponse::~EncryptResponse() { + // @@protoc_insertion_point(destructor:crypto.EncryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void EncryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + encrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + signature_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void EncryptResponse::ArenaDtor(void* object) { + EncryptResponse* _this = reinterpret_cast< EncryptResponse* >(object); + (void)_this; +} +void EncryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void EncryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void EncryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.EncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + encrypteddata_.ClearToEmpty(); + signature_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* EncryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes encryptedData = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_encrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes signature = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_signature(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* EncryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.EncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_encrypteddata(), target); + } + + // bytes signature = 2; + if (!this->_internal_signature().empty()) { + target = stream->WriteBytesMaybeAliased( + 2, this->_internal_signature(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.EncryptResponse) + return target; +} + +size_t EncryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.EncryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_encrypteddata()); + } + + // bytes signature = 2; + if (!this->_internal_signature().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_signature()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EncryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + EncryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EncryptResponse::GetClassData() const { return &_class_data_; } + +void EncryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void EncryptResponse::MergeFrom(const EncryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.EncryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_encrypteddata().empty()) { + _internal_set_encrypteddata(from._internal_encrypteddata()); + } + if (!from._internal_signature().empty()) { + _internal_set_signature(from._internal_signature()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void EncryptResponse::CopyFrom(const EncryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.EncryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EncryptResponse::IsInitialized() const { + return true; +} + +void EncryptResponse::InternalSwap(EncryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &encrypteddata_, lhs_arena, + &other->encrypteddata_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &signature_, lhs_arena, + &other->signature_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata EncryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[26]); +} + +// =================================================================== + +class DecryptRequest::_Internal { + public: +}; + +DecryptRequest::DecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.DecryptRequest) +} +DecryptRequest::DecryptRequest(const DecryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_encrypteddata().empty()) { + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_encrypteddata(), + GetArenaForAllocation()); + } + signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_signature().empty()) { + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_signature(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + // @@protoc_insertion_point(copy_constructor:crypto.DecryptRequest) +} + +void DecryptRequest::SharedCtor() { +encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +signature_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); +} + +DecryptRequest::~DecryptRequest() { + // @@protoc_insertion_point(destructor:crypto.DecryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void DecryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + encrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + signature_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void DecryptRequest::ArenaDtor(void* object) { + DecryptRequest* _this = reinterpret_cast< DecryptRequest* >(object); + (void)_this; +} +void DecryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void DecryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void DecryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.DecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + encrypteddata_.ClearToEmpty(); + signature_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* DecryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes encryptedData = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_encrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int64 counter = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes signature = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_signature(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool isFirst = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.DecryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* DecryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.DecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // bytes encryptedData = 3; + if (!this->_internal_encrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_encrypteddata(), target); + } + + // int64 counter = 4; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_counter(), target); + } + + // bytes signature = 5; + if (!this->_internal_signature().empty()) { + target = stream->WriteBytesMaybeAliased( + 5, this->_internal_signature(), target); + } + + // bool isFirst = 6; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_isfirst(), target); + } + + // string messageId = 7; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.DecryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 7, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.DecryptRequest) + return target; +} + +size_t DecryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.DecryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes encryptedData = 3; + if (!this->_internal_encrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_encrypteddata()); + } + + // bytes signature = 5; + if (!this->_internal_signature().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_signature()); + } + + // string messageId = 7; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + // int64 counter = 4; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter()); + } + + // bool isFirst = 6; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DecryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + DecryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DecryptRequest::GetClassData() const { return &_class_data_; } + +void DecryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void DecryptRequest::MergeFrom(const DecryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.DecryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_encrypteddata().empty()) { + _internal_set_encrypteddata(from._internal_encrypteddata()); + } + if (!from._internal_signature().empty()) { + _internal_set_signature(from._internal_signature()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void DecryptRequest::CopyFrom(const DecryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.DecryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DecryptRequest::IsInitialized() const { + return true; +} + +void DecryptRequest::InternalSwap(DecryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &encrypteddata_, lhs_arena, + &other->encrypteddata_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &signature_, lhs_arena, + &other->signature_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(DecryptRequest, isfirst_) + + sizeof(DecryptRequest::isfirst_) + - PROTOBUF_FIELD_OFFSET(DecryptRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata DecryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[27]); +} + +// =================================================================== + +class DecryptResponse::_Internal { + public: +}; + +DecryptResponse::DecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.DecryptResponse) +} +DecryptResponse::DecryptResponse(const DecryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_decrypteddata().empty()) { + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_decrypteddata(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.DecryptResponse) +} + +void DecryptResponse::SharedCtor() { +decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +DecryptResponse::~DecryptResponse() { + // @@protoc_insertion_point(destructor:crypto.DecryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void DecryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + decrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void DecryptResponse::ArenaDtor(void* object) { + DecryptResponse* _this = reinterpret_cast< DecryptResponse* >(object); + (void)_this; +} +void DecryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void DecryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void DecryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.DecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + decrypteddata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* DecryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes decryptedData = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_decrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* DecryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.DecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes decryptedData = 1; + if (!this->_internal_decrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_decrypteddata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.DecryptResponse) + return target; +} + +size_t DecryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.DecryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes decryptedData = 1; + if (!this->_internal_decrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_decrypteddata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DecryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + DecryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DecryptResponse::GetClassData() const { return &_class_data_; } + +void DecryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void DecryptResponse::MergeFrom(const DecryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.DecryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_decrypteddata().empty()) { + _internal_set_decrypteddata(from._internal_decrypteddata()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void DecryptResponse::CopyFrom(const DecryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.DecryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DecryptResponse::IsInitialized() const { + return true; +} + +void DecryptResponse::InternalSwap(DecryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &decrypteddata_, lhs_arena, + &other->decrypteddata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata DecryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[28]); +} + +// =================================================================== + +class AESEncryptRequest::_Internal { + public: +}; + +AESEncryptRequest::AESEncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AESEncryptRequest) +} +AESEncryptRequest::AESEncryptRequest(const AESEncryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data().empty()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + // @@protoc_insertion_point(copy_constructor:crypto.AESEncryptRequest) +} + +void AESEncryptRequest::SharedCtor() { +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); +} + +AESEncryptRequest::~AESEncryptRequest() { + // @@protoc_insertion_point(destructor:crypto.AESEncryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AESEncryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AESEncryptRequest::ArenaDtor(void* object) { + AESEncryptRequest* _this = reinterpret_cast< AESEncryptRequest* >(object); + (void)_this; +} +void AESEncryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AESEncryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AESEncryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AESEncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + data_.ClearToEmpty(); + keyid_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&isfirst_) - + reinterpret_cast(&senderid_)) + sizeof(isfirst_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AESEncryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes data = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.AsymmetricFunction func = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_func(static_cast<::crypto::AsymmetricFunction>(val)); + } else + goto handle_unusual; + continue; + // int64 counter = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string keyId = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AESEncryptRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.AESKeyLength keyLength = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_keylength(static_cast<::crypto::AESKeyLength>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESChainingMode chainingMode = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_chainingmode(static_cast<::crypto::AESChainingMode>(val)); + } else + goto handle_unusual; + continue; + // bool isFirst = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AESEncryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AESEncryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AESEncryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // bytes data = 3; + if (!this->_internal_data().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_data(), target); + } + + // .crypto.AsymmetricFunction func = 4; + if (this->_internal_func() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_func(), target); + } + + // int64 counter = 5; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_counter(), target); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AESEncryptRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 6, this->_internal_keyid(), target); + } + + // .crypto.AESKeyLength keyLength = 7; + if (this->_internal_keylength() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_keylength(), target); + } + + // .crypto.AESChainingMode chainingMode = 8; + if (this->_internal_chainingmode() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 8, this->_internal_chainingmode(), target); + } + + // bool isFirst = 9; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(9, this->_internal_isfirst(), target); + } + + // string messageId = 10; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AESEncryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 10, this->_internal_messageid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AESEncryptRequest) + return target; +} + +size_t AESEncryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AESEncryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes data = 3; + if (!this->_internal_data().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + // string keyId = 6; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // string messageId = 10; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + // int64 counter = 5; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter()); + } + + // .crypto.AsymmetricFunction func = 4; + if (this->_internal_func() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_func()); + } + + // .crypto.AESKeyLength keyLength = 7; + if (this->_internal_keylength() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_keylength()); + } + + // .crypto.AESChainingMode chainingMode = 8; + if (this->_internal_chainingmode() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_chainingmode()); + } + + // bool isFirst = 9; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AESEncryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AESEncryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AESEncryptRequest::GetClassData() const { return &_class_data_; } + +void AESEncryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AESEncryptRequest::MergeFrom(const AESEncryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AESEncryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_data().empty()) { + _internal_set_data(from._internal_data()); + } + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + if (from._internal_func() != 0) { + _internal_set_func(from._internal_func()); + } + if (from._internal_keylength() != 0) { + _internal_set_keylength(from._internal_keylength()); + } + if (from._internal_chainingmode() != 0) { + _internal_set_chainingmode(from._internal_chainingmode()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AESEncryptRequest::CopyFrom(const AESEncryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AESEncryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AESEncryptRequest::IsInitialized() const { + return true; +} + +void AESEncryptRequest::InternalSwap(AESEncryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(AESEncryptRequest, isfirst_) + + sizeof(AESEncryptRequest::isfirst_) + - PROTOBUF_FIELD_OFFSET(AESEncryptRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AESEncryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[29]); +} + +// =================================================================== + +class AESEncryptResponse::_Internal { + public: +}; + +AESEncryptResponse::AESEncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AESEncryptResponse) +} +AESEncryptResponse::AESEncryptResponse(const AESEncryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_encrypteddata().empty()) { + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_encrypteddata(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.AESEncryptResponse) +} + +void AESEncryptResponse::SharedCtor() { +encrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +AESEncryptResponse::~AESEncryptResponse() { + // @@protoc_insertion_point(destructor:crypto.AESEncryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AESEncryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + encrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AESEncryptResponse::ArenaDtor(void* object) { + AESEncryptResponse* _this = reinterpret_cast< AESEncryptResponse* >(object); + (void)_this; +} +void AESEncryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AESEncryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AESEncryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AESEncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + encrypteddata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AESEncryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes encryptedData = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_encrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AESEncryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AESEncryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_encrypteddata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AESEncryptResponse) + return target; +} + +size_t AESEncryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AESEncryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes encryptedData = 1; + if (!this->_internal_encrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_encrypteddata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AESEncryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AESEncryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AESEncryptResponse::GetClassData() const { return &_class_data_; } + +void AESEncryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AESEncryptResponse::MergeFrom(const AESEncryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AESEncryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_encrypteddata().empty()) { + _internal_set_encrypteddata(from._internal_encrypteddata()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AESEncryptResponse::CopyFrom(const AESEncryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AESEncryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AESEncryptResponse::IsInitialized() const { + return true; +} + +void AESEncryptResponse::InternalSwap(AESEncryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &encrypteddata_, lhs_arena, + &other->encrypteddata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AESEncryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[30]); +} + +// =================================================================== + +class AESDecryptRequest::_Internal { + public: +}; + +AESDecryptRequest::AESDecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AESDecryptRequest) +} +AESDecryptRequest::AESDecryptRequest(const AESDecryptRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + datain_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_datain().empty()) { + datain_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_datain(), + GetArenaForAllocation()); + } + dataout_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_dataout().empty()) { + dataout_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_dataout(), + GetArenaForAllocation()); + } + keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_keyid().empty()) { + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_keyid(), + GetArenaForAllocation()); + } + messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_messageid().empty()) { + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_messageid(), + GetArenaForAllocation()); + } + ::memcpy(&senderid_, &from.senderid_, + static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + // @@protoc_insertion_point(copy_constructor:crypto.AESDecryptRequest) +} + +void AESDecryptRequest::SharedCtor() { +datain_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +dataout_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +keyid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +messageid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&senderid_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); +} + +AESDecryptRequest::~AESDecryptRequest() { + // @@protoc_insertion_point(destructor:crypto.AESDecryptRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AESDecryptRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + datain_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + dataout_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + keyid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + messageid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AESDecryptRequest::ArenaDtor(void* object) { + AESDecryptRequest* _this = reinterpret_cast< AESDecryptRequest* >(object); + (void)_this; +} +void AESDecryptRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AESDecryptRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AESDecryptRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AESDecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + datain_.ClearToEmpty(); + dataout_.ClearToEmpty(); + keyid_.ClearToEmpty(); + messageid_.ClearToEmpty(); + ::memset(&senderid_, 0, static_cast( + reinterpret_cast(&userid_) - + reinterpret_cast(&senderid_)) + sizeof(userid_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AESDecryptRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // int32 senderId = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + senderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 receiverId = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + receiverid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes dataIn = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_datain(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 inLen = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + inlen_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes dataOut = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + auto str = _internal_mutable_dataout(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .crypto.AsymmetricFunction func = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_func(static_cast<::crypto::AsymmetricFunction>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESKeyLength keyLength = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_keylength(static_cast<::crypto::AESKeyLength>(val)); + } else + goto handle_unusual; + continue; + // .crypto.AESChainingMode chainingMode = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { + ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_chainingmode(static_cast<::crypto::AESChainingMode>(val)); + } else + goto handle_unusual; + continue; + // int64 counter = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) { + counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string keyId = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { + auto str = _internal_mutable_keyid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AESDecryptRequest.keyId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool isFirst = 11; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 88)) { + isfirst_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string messageId = 12; + case 12: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) { + auto str = _internal_mutable_messageid(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "crypto.AESDecryptRequest.messageId")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int32 userId = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 104)) { + userid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AESDecryptRequest::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AESDecryptRequest) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_senderid(), target); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_receiverid(), target); + } + + // bytes dataIn = 3; + if (!this->_internal_datain().empty()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_datain(), target); + } + + // int32 inLen = 4; + if (this->_internal_inlen() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_inlen(), target); + } + + // bytes dataOut = 5; + if (!this->_internal_dataout().empty()) { + target = stream->WriteBytesMaybeAliased( + 5, this->_internal_dataout(), target); + } + + // .crypto.AsymmetricFunction func = 6; + if (this->_internal_func() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 6, this->_internal_func(), target); + } + + // .crypto.AESKeyLength keyLength = 7; + if (this->_internal_keylength() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_keylength(), target); + } + + // .crypto.AESChainingMode chainingMode = 8; + if (this->_internal_chainingmode() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 8, this->_internal_chainingmode(), target); + } + + // int64 counter = 9; + if (this->_internal_counter() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(9, this->_internal_counter(), target); + } + + // string keyId = 10; + if (!this->_internal_keyid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_keyid().data(), static_cast(this->_internal_keyid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AESDecryptRequest.keyId"); + target = stream->WriteStringMaybeAliased( + 10, this->_internal_keyid(), target); + } + + // bool isFirst = 11; + if (this->_internal_isfirst() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(11, this->_internal_isfirst(), target); + } + + // string messageId = 12; + if (!this->_internal_messageid().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_messageid().data(), static_cast(this->_internal_messageid().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "crypto.AESDecryptRequest.messageId"); + target = stream->WriteStringMaybeAliased( + 12, this->_internal_messageid(), target); + } + + // int32 userId = 13; + if (this->_internal_userid() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(13, this->_internal_userid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AESDecryptRequest) + return target; +} + +size_t AESDecryptRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AESDecryptRequest) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes dataIn = 3; + if (!this->_internal_datain().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_datain()); + } + + // bytes dataOut = 5; + if (!this->_internal_dataout().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_dataout()); + } + + // string keyId = 10; + if (!this->_internal_keyid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_keyid()); + } + + // string messageId = 12; + if (!this->_internal_messageid().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_messageid()); + } + + // int32 senderId = 1; + if (this->_internal_senderid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_senderid()); + } + + // int32 receiverId = 2; + if (this->_internal_receiverid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_receiverid()); + } + + // int32 inLen = 4; + if (this->_internal_inlen() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_inlen()); + } + + // .crypto.AsymmetricFunction func = 6; + if (this->_internal_func() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_func()); + } + + // .crypto.AESKeyLength keyLength = 7; + if (this->_internal_keylength() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_keylength()); + } + + // .crypto.AESChainingMode chainingMode = 8; + if (this->_internal_chainingmode() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_chainingmode()); + } + + // int64 counter = 9; + if (this->_internal_counter() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_counter()); + } + + // bool isFirst = 11; + if (this->_internal_isfirst() != 0) { + total_size += 1 + 1; + } + + // int32 userId = 13; + if (this->_internal_userid() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_userid()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AESDecryptRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AESDecryptRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AESDecryptRequest::GetClassData() const { return &_class_data_; } + +void AESDecryptRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AESDecryptRequest::MergeFrom(const AESDecryptRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AESDecryptRequest) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_datain().empty()) { + _internal_set_datain(from._internal_datain()); + } + if (!from._internal_dataout().empty()) { + _internal_set_dataout(from._internal_dataout()); + } + if (!from._internal_keyid().empty()) { + _internal_set_keyid(from._internal_keyid()); + } + if (!from._internal_messageid().empty()) { + _internal_set_messageid(from._internal_messageid()); + } + if (from._internal_senderid() != 0) { + _internal_set_senderid(from._internal_senderid()); + } + if (from._internal_receiverid() != 0) { + _internal_set_receiverid(from._internal_receiverid()); + } + if (from._internal_inlen() != 0) { + _internal_set_inlen(from._internal_inlen()); + } + if (from._internal_func() != 0) { + _internal_set_func(from._internal_func()); + } + if (from._internal_keylength() != 0) { + _internal_set_keylength(from._internal_keylength()); + } + if (from._internal_chainingmode() != 0) { + _internal_set_chainingmode(from._internal_chainingmode()); + } + if (from._internal_counter() != 0) { + _internal_set_counter(from._internal_counter()); + } + if (from._internal_isfirst() != 0) { + _internal_set_isfirst(from._internal_isfirst()); + } + if (from._internal_userid() != 0) { + _internal_set_userid(from._internal_userid()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AESDecryptRequest::CopyFrom(const AESDecryptRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AESDecryptRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AESDecryptRequest::IsInitialized() const { + return true; +} + +void AESDecryptRequest::InternalSwap(AESDecryptRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &datain_, lhs_arena, + &other->datain_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &dataout_, lhs_arena, + &other->dataout_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &keyid_, lhs_arena, + &other->keyid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &messageid_, lhs_arena, + &other->messageid_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(AESDecryptRequest, userid_) + + sizeof(AESDecryptRequest::userid_) + - PROTOBUF_FIELD_OFFSET(AESDecryptRequest, senderid_)>( + reinterpret_cast(&senderid_), + reinterpret_cast(&other->senderid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AESDecryptRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[31]); +} + +// =================================================================== + +class AESDecryptResponse::_Internal { + public: +}; + +AESDecryptResponse::AESDecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:crypto.AESDecryptResponse) +} +AESDecryptResponse::AESDecryptResponse(const AESDecryptResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_decrypteddata().empty()) { + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_decrypteddata(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:crypto.AESDecryptResponse) +} + +void AESDecryptResponse::SharedCtor() { +decrypteddata_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +AESDecryptResponse::~AESDecryptResponse() { + // @@protoc_insertion_point(destructor:crypto.AESDecryptResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void AESDecryptResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + decrypteddata_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void AESDecryptResponse::ArenaDtor(void* object) { + AESDecryptResponse* _this = reinterpret_cast< AESDecryptResponse* >(object); + (void)_this; +} +void AESDecryptResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void AESDecryptResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void AESDecryptResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:crypto.AESDecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + decrypteddata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* AESDecryptResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bytes decrypteddata = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_decrypteddata(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* AESDecryptResponse::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:crypto.AESDecryptResponse) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // bytes decrypteddata = 1; + if (!this->_internal_decrypteddata().empty()) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_decrypteddata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:crypto.AESDecryptResponse) + return target; +} + +size_t AESDecryptResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:crypto.AESDecryptResponse) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // bytes decrypteddata = 1; + if (!this->_internal_decrypteddata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_decrypteddata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AESDecryptResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + AESDecryptResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AESDecryptResponse::GetClassData() const { return &_class_data_; } + +void AESDecryptResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void AESDecryptResponse::MergeFrom(const AESDecryptResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:crypto.AESDecryptResponse) + GOOGLE_DCHECK_NE(&from, this); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_decrypteddata().empty()) { + _internal_set_decrypteddata(from._internal_decrypteddata()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void AESDecryptResponse::CopyFrom(const AESDecryptResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:crypto.AESDecryptResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AESDecryptResponse::IsInitialized() const { + return true; +} + +void AESDecryptResponse::InternalSwap(AESDecryptResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &decrypteddata_, lhs_arena, + &other->decrypteddata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata AESDecryptResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_proto_2fencryption_2eproto_getter, &descriptor_table_proto_2fencryption_2eproto_once, + file_level_metadata_proto_2fencryption_2eproto[32]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace crypto +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::crypto::AsymetricEncryptRequest* Arena::CreateMaybeMessage< ::crypto::AsymetricEncryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AsymetricEncryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AsymetricEncryptResponse* Arena::CreateMaybeMessage< ::crypto::AsymetricEncryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AsymetricEncryptResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AsymetricDecryptRequest* Arena::CreateMaybeMessage< ::crypto::AsymetricDecryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AsymetricDecryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GetHashLengthRequest* Arena::CreateMaybeMessage< ::crypto::GetHashLengthRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GetHashLengthRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GetAESLengthRequest* Arena::CreateMaybeMessage< ::crypto::GetAESLengthRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GetAESLengthRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AsymetricDecryptResponse* Arena::CreateMaybeMessage< ::crypto::AsymetricDecryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AsymetricDecryptResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GetLengthRequest* Arena::CreateMaybeMessage< ::crypto::GetLengthRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GetLengthRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GetLengthResponse* Arena::CreateMaybeMessage< ::crypto::GetLengthResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GetLengthResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GetWholeLength* Arena::CreateMaybeMessage< ::crypto::GetWholeLength >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GetWholeLength >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GenerateAESKeyRequest* Arena::CreateMaybeMessage< ::crypto::GenerateAESKeyRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GenerateAESKeyRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GenerateAESKeyResponse* Arena::CreateMaybeMessage< ::crypto::GenerateAESKeyResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GenerateAESKeyResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GenerateKeyPairRequest* Arena::CreateMaybeMessage< ::crypto::GenerateKeyPairRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GenerateKeyPairRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::GenerateKeyPairResponse* Arena::CreateMaybeMessage< ::crypto::GenerateKeyPairResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::GenerateKeyPairResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::SignRequest* Arena::CreateMaybeMessage< ::crypto::SignRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::SignRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::SignResponse* Arena::CreateMaybeMessage< ::crypto::SignResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::SignResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::VerifyRequest* Arena::CreateMaybeMessage< ::crypto::VerifyRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::VerifyRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::VerifyResponse* Arena::CreateMaybeMessage< ::crypto::VerifyResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::VerifyResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::KeyRequest* Arena::CreateMaybeMessage< ::crypto::KeyRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::KeyRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::KeyResponse* Arena::CreateMaybeMessage< ::crypto::KeyResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::KeyResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::UserKeyPermissions* Arena::CreateMaybeMessage< ::crypto::UserKeyPermissions >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::UserKeyPermissions >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::BootSystemRequest* Arena::CreateMaybeMessage< ::crypto::BootSystemRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::BootSystemRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::Empty* Arena::CreateMaybeMessage< ::crypto::Empty >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::Empty >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::CryptoConfig* Arena::CreateMaybeMessage< ::crypto::CryptoConfig >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::CryptoConfig >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::ConfigureRequest* Arena::CreateMaybeMessage< ::crypto::ConfigureRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::ConfigureRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AddProcessRequest* Arena::CreateMaybeMessage< ::crypto::AddProcessRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AddProcessRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::EncryptRequest* Arena::CreateMaybeMessage< ::crypto::EncryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::EncryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::EncryptResponse* Arena::CreateMaybeMessage< ::crypto::EncryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::EncryptResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::DecryptRequest* Arena::CreateMaybeMessage< ::crypto::DecryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::DecryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::DecryptResponse* Arena::CreateMaybeMessage< ::crypto::DecryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::DecryptResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AESEncryptRequest* Arena::CreateMaybeMessage< ::crypto::AESEncryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AESEncryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AESEncryptResponse* Arena::CreateMaybeMessage< ::crypto::AESEncryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AESEncryptResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AESDecryptRequest* Arena::CreateMaybeMessage< ::crypto::AESDecryptRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AESDecryptRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::crypto::AESDecryptResponse* Arena::CreateMaybeMessage< ::crypto::AESDecryptResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::crypto::AESDecryptResponse >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/hsm-server/proto/encryption.pb.cc:Zone.Identifier b/hsm-server/proto/encryption.pb.cc:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/proto/encryption.pb.h b/hsm-server/proto/encryption.pb.h new file mode 100644 index 00000000..33e5c77a --- /dev/null +++ b/hsm-server/proto/encryption.pb.h @@ -0,0 +1,10293 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/encryption.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_proto_2fencryption_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_proto_2fencryption_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3018000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_proto_2fencryption_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_proto_2fencryption_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[33] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_proto_2fencryption_2eproto; +namespace crypto { +class AESDecryptRequest; +struct AESDecryptRequestDefaultTypeInternal; +extern AESDecryptRequestDefaultTypeInternal _AESDecryptRequest_default_instance_; +class AESDecryptResponse; +struct AESDecryptResponseDefaultTypeInternal; +extern AESDecryptResponseDefaultTypeInternal _AESDecryptResponse_default_instance_; +class AESEncryptRequest; +struct AESEncryptRequestDefaultTypeInternal; +extern AESEncryptRequestDefaultTypeInternal _AESEncryptRequest_default_instance_; +class AESEncryptResponse; +struct AESEncryptResponseDefaultTypeInternal; +extern AESEncryptResponseDefaultTypeInternal _AESEncryptResponse_default_instance_; +class AddProcessRequest; +struct AddProcessRequestDefaultTypeInternal; +extern AddProcessRequestDefaultTypeInternal _AddProcessRequest_default_instance_; +class AsymetricDecryptRequest; +struct AsymetricDecryptRequestDefaultTypeInternal; +extern AsymetricDecryptRequestDefaultTypeInternal _AsymetricDecryptRequest_default_instance_; +class AsymetricDecryptResponse; +struct AsymetricDecryptResponseDefaultTypeInternal; +extern AsymetricDecryptResponseDefaultTypeInternal _AsymetricDecryptResponse_default_instance_; +class AsymetricEncryptRequest; +struct AsymetricEncryptRequestDefaultTypeInternal; +extern AsymetricEncryptRequestDefaultTypeInternal _AsymetricEncryptRequest_default_instance_; +class AsymetricEncryptResponse; +struct AsymetricEncryptResponseDefaultTypeInternal; +extern AsymetricEncryptResponseDefaultTypeInternal _AsymetricEncryptResponse_default_instance_; +class BootSystemRequest; +struct BootSystemRequestDefaultTypeInternal; +extern BootSystemRequestDefaultTypeInternal _BootSystemRequest_default_instance_; +class ConfigureRequest; +struct ConfigureRequestDefaultTypeInternal; +extern ConfigureRequestDefaultTypeInternal _ConfigureRequest_default_instance_; +class CryptoConfig; +struct CryptoConfigDefaultTypeInternal; +extern CryptoConfigDefaultTypeInternal _CryptoConfig_default_instance_; +class DecryptRequest; +struct DecryptRequestDefaultTypeInternal; +extern DecryptRequestDefaultTypeInternal _DecryptRequest_default_instance_; +class DecryptResponse; +struct DecryptResponseDefaultTypeInternal; +extern DecryptResponseDefaultTypeInternal _DecryptResponse_default_instance_; +class Empty; +struct EmptyDefaultTypeInternal; +extern EmptyDefaultTypeInternal _Empty_default_instance_; +class EncryptRequest; +struct EncryptRequestDefaultTypeInternal; +extern EncryptRequestDefaultTypeInternal _EncryptRequest_default_instance_; +class EncryptResponse; +struct EncryptResponseDefaultTypeInternal; +extern EncryptResponseDefaultTypeInternal _EncryptResponse_default_instance_; +class GenerateAESKeyRequest; +struct GenerateAESKeyRequestDefaultTypeInternal; +extern GenerateAESKeyRequestDefaultTypeInternal _GenerateAESKeyRequest_default_instance_; +class GenerateAESKeyResponse; +struct GenerateAESKeyResponseDefaultTypeInternal; +extern GenerateAESKeyResponseDefaultTypeInternal _GenerateAESKeyResponse_default_instance_; +class GenerateKeyPairRequest; +struct GenerateKeyPairRequestDefaultTypeInternal; +extern GenerateKeyPairRequestDefaultTypeInternal _GenerateKeyPairRequest_default_instance_; +class GenerateKeyPairResponse; +struct GenerateKeyPairResponseDefaultTypeInternal; +extern GenerateKeyPairResponseDefaultTypeInternal _GenerateKeyPairResponse_default_instance_; +class GetAESLengthRequest; +struct GetAESLengthRequestDefaultTypeInternal; +extern GetAESLengthRequestDefaultTypeInternal _GetAESLengthRequest_default_instance_; +class GetHashLengthRequest; +struct GetHashLengthRequestDefaultTypeInternal; +extern GetHashLengthRequestDefaultTypeInternal _GetHashLengthRequest_default_instance_; +class GetLengthRequest; +struct GetLengthRequestDefaultTypeInternal; +extern GetLengthRequestDefaultTypeInternal _GetLengthRequest_default_instance_; +class GetLengthResponse; +struct GetLengthResponseDefaultTypeInternal; +extern GetLengthResponseDefaultTypeInternal _GetLengthResponse_default_instance_; +class GetWholeLength; +struct GetWholeLengthDefaultTypeInternal; +extern GetWholeLengthDefaultTypeInternal _GetWholeLength_default_instance_; +class KeyRequest; +struct KeyRequestDefaultTypeInternal; +extern KeyRequestDefaultTypeInternal _KeyRequest_default_instance_; +class KeyResponse; +struct KeyResponseDefaultTypeInternal; +extern KeyResponseDefaultTypeInternal _KeyResponse_default_instance_; +class SignRequest; +struct SignRequestDefaultTypeInternal; +extern SignRequestDefaultTypeInternal _SignRequest_default_instance_; +class SignResponse; +struct SignResponseDefaultTypeInternal; +extern SignResponseDefaultTypeInternal _SignResponse_default_instance_; +class UserKeyPermissions; +struct UserKeyPermissionsDefaultTypeInternal; +extern UserKeyPermissionsDefaultTypeInternal _UserKeyPermissions_default_instance_; +class VerifyRequest; +struct VerifyRequestDefaultTypeInternal; +extern VerifyRequestDefaultTypeInternal _VerifyRequest_default_instance_; +class VerifyResponse; +struct VerifyResponseDefaultTypeInternal; +extern VerifyResponseDefaultTypeInternal _VerifyResponse_default_instance_; +} // namespace crypto +PROTOBUF_NAMESPACE_OPEN +template<> ::crypto::AESDecryptRequest* Arena::CreateMaybeMessage<::crypto::AESDecryptRequest>(Arena*); +template<> ::crypto::AESDecryptResponse* Arena::CreateMaybeMessage<::crypto::AESDecryptResponse>(Arena*); +template<> ::crypto::AESEncryptRequest* Arena::CreateMaybeMessage<::crypto::AESEncryptRequest>(Arena*); +template<> ::crypto::AESEncryptResponse* Arena::CreateMaybeMessage<::crypto::AESEncryptResponse>(Arena*); +template<> ::crypto::AddProcessRequest* Arena::CreateMaybeMessage<::crypto::AddProcessRequest>(Arena*); +template<> ::crypto::AsymetricDecryptRequest* Arena::CreateMaybeMessage<::crypto::AsymetricDecryptRequest>(Arena*); +template<> ::crypto::AsymetricDecryptResponse* Arena::CreateMaybeMessage<::crypto::AsymetricDecryptResponse>(Arena*); +template<> ::crypto::AsymetricEncryptRequest* Arena::CreateMaybeMessage<::crypto::AsymetricEncryptRequest>(Arena*); +template<> ::crypto::AsymetricEncryptResponse* Arena::CreateMaybeMessage<::crypto::AsymetricEncryptResponse>(Arena*); +template<> ::crypto::BootSystemRequest* Arena::CreateMaybeMessage<::crypto::BootSystemRequest>(Arena*); +template<> ::crypto::ConfigureRequest* Arena::CreateMaybeMessage<::crypto::ConfigureRequest>(Arena*); +template<> ::crypto::CryptoConfig* Arena::CreateMaybeMessage<::crypto::CryptoConfig>(Arena*); +template<> ::crypto::DecryptRequest* Arena::CreateMaybeMessage<::crypto::DecryptRequest>(Arena*); +template<> ::crypto::DecryptResponse* Arena::CreateMaybeMessage<::crypto::DecryptResponse>(Arena*); +template<> ::crypto::Empty* Arena::CreateMaybeMessage<::crypto::Empty>(Arena*); +template<> ::crypto::EncryptRequest* Arena::CreateMaybeMessage<::crypto::EncryptRequest>(Arena*); +template<> ::crypto::EncryptResponse* Arena::CreateMaybeMessage<::crypto::EncryptResponse>(Arena*); +template<> ::crypto::GenerateAESKeyRequest* Arena::CreateMaybeMessage<::crypto::GenerateAESKeyRequest>(Arena*); +template<> ::crypto::GenerateAESKeyResponse* Arena::CreateMaybeMessage<::crypto::GenerateAESKeyResponse>(Arena*); +template<> ::crypto::GenerateKeyPairRequest* Arena::CreateMaybeMessage<::crypto::GenerateKeyPairRequest>(Arena*); +template<> ::crypto::GenerateKeyPairResponse* Arena::CreateMaybeMessage<::crypto::GenerateKeyPairResponse>(Arena*); +template<> ::crypto::GetAESLengthRequest* Arena::CreateMaybeMessage<::crypto::GetAESLengthRequest>(Arena*); +template<> ::crypto::GetHashLengthRequest* Arena::CreateMaybeMessage<::crypto::GetHashLengthRequest>(Arena*); +template<> ::crypto::GetLengthRequest* Arena::CreateMaybeMessage<::crypto::GetLengthRequest>(Arena*); +template<> ::crypto::GetLengthResponse* Arena::CreateMaybeMessage<::crypto::GetLengthResponse>(Arena*); +template<> ::crypto::GetWholeLength* Arena::CreateMaybeMessage<::crypto::GetWholeLength>(Arena*); +template<> ::crypto::KeyRequest* Arena::CreateMaybeMessage<::crypto::KeyRequest>(Arena*); +template<> ::crypto::KeyResponse* Arena::CreateMaybeMessage<::crypto::KeyResponse>(Arena*); +template<> ::crypto::SignRequest* Arena::CreateMaybeMessage<::crypto::SignRequest>(Arena*); +template<> ::crypto::SignResponse* Arena::CreateMaybeMessage<::crypto::SignResponse>(Arena*); +template<> ::crypto::UserKeyPermissions* Arena::CreateMaybeMessage<::crypto::UserKeyPermissions>(Arena*); +template<> ::crypto::VerifyRequest* Arena::CreateMaybeMessage<::crypto::VerifyRequest>(Arena*); +template<> ::crypto::VerifyResponse* Arena::CreateMaybeMessage<::crypto::VerifyResponse>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace crypto { + +enum KeyPermission : int { + VERIFY = 0, + SIGN = 1, + ENCRYPT = 2, + DECRYPT = 3, + EXPORTABLE = 4, + KeyPermission_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + KeyPermission_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool KeyPermission_IsValid(int value); +constexpr KeyPermission KeyPermission_MIN = VERIFY; +constexpr KeyPermission KeyPermission_MAX = EXPORTABLE; +constexpr int KeyPermission_ARRAYSIZE = KeyPermission_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* KeyPermission_descriptor(); +template +inline const std::string& KeyPermission_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function KeyPermission_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + KeyPermission_descriptor(), enum_t_value); +} +inline bool KeyPermission_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, KeyPermission* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + KeyPermission_descriptor(), name, value); +} +enum AESChainingMode : int { + ECB = 0, + CBC = 1, + CFB = 2, + OFB = 3, + CTR = 4, + AESChainingMode_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + AESChainingMode_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool AESChainingMode_IsValid(int value); +constexpr AESChainingMode AESChainingMode_MIN = ECB; +constexpr AESChainingMode AESChainingMode_MAX = CTR; +constexpr int AESChainingMode_ARRAYSIZE = AESChainingMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AESChainingMode_descriptor(); +template +inline const std::string& AESChainingMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function AESChainingMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + AESChainingMode_descriptor(), enum_t_value); +} +inline bool AESChainingMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AESChainingMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + AESChainingMode_descriptor(), name, value); +} +enum AsymmetricFunction : int { + RSA = 0, + ECC = 1, + AsymmetricFunction_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + AsymmetricFunction_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool AsymmetricFunction_IsValid(int value); +constexpr AsymmetricFunction AsymmetricFunction_MIN = RSA; +constexpr AsymmetricFunction AsymmetricFunction_MAX = ECC; +constexpr int AsymmetricFunction_ARRAYSIZE = AsymmetricFunction_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AsymmetricFunction_descriptor(); +template +inline const std::string& AsymmetricFunction_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function AsymmetricFunction_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + AsymmetricFunction_descriptor(), enum_t_value); +} +inline bool AsymmetricFunction_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AsymmetricFunction* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + AsymmetricFunction_descriptor(), name, value); +} +enum SHAAlgorithm : int { + SHA256 = 0, + SHA3_512 = 1, + SHAAlgorithm_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + SHAAlgorithm_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool SHAAlgorithm_IsValid(int value); +constexpr SHAAlgorithm SHAAlgorithm_MIN = SHA256; +constexpr SHAAlgorithm SHAAlgorithm_MAX = SHA3_512; +constexpr int SHAAlgorithm_ARRAYSIZE = SHAAlgorithm_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SHAAlgorithm_descriptor(); +template +inline const std::string& SHAAlgorithm_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SHAAlgorithm_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SHAAlgorithm_descriptor(), enum_t_value); +} +inline bool SHAAlgorithm_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SHAAlgorithm* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SHAAlgorithm_descriptor(), name, value); +} +enum AESKeyLength : int { + AES_128 = 0, + AES_192 = 1, + AES_256 = 2, + AESKeyLength_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), + AESKeyLength_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() +}; +bool AESKeyLength_IsValid(int value); +constexpr AESKeyLength AESKeyLength_MIN = AES_128; +constexpr AESKeyLength AESKeyLength_MAX = AES_256; +constexpr int AESKeyLength_ARRAYSIZE = AESKeyLength_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AESKeyLength_descriptor(); +template +inline const std::string& AESKeyLength_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function AESKeyLength_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + AESKeyLength_descriptor(), enum_t_value); +} +inline bool AESKeyLength_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AESKeyLength* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + AESKeyLength_descriptor(), name, value); +} +// =================================================================== + +class AsymetricEncryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AsymetricEncryptRequest) */ { + public: + inline AsymetricEncryptRequest() : AsymetricEncryptRequest(nullptr) {} + ~AsymetricEncryptRequest() override; + explicit constexpr AsymetricEncryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AsymetricEncryptRequest(const AsymetricEncryptRequest& from); + AsymetricEncryptRequest(AsymetricEncryptRequest&& from) noexcept + : AsymetricEncryptRequest() { + *this = ::std::move(from); + } + + inline AsymetricEncryptRequest& operator=(const AsymetricEncryptRequest& from) { + CopyFrom(from); + return *this; + } + inline AsymetricEncryptRequest& operator=(AsymetricEncryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AsymetricEncryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const AsymetricEncryptRequest* internal_default_instance() { + return reinterpret_cast( + &_AsymetricEncryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(AsymetricEncryptRequest& a, AsymetricEncryptRequest& b) { + a.Swap(&b); + } + inline void Swap(AsymetricEncryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AsymetricEncryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AsymetricEncryptRequest* New() const final { + return new AsymetricEncryptRequest(); + } + + AsymetricEncryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AsymetricEncryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AsymetricEncryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AsymetricEncryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AsymetricEncryptRequest"; + } + protected: + explicit AsymetricEncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kKeyIdFieldNumber = 2, + kDataFieldNumber = 3, + kMessageIdFieldNumber = 4, + kSenderIdFieldNumber = 1, + }; + // string keyId = 2; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // bytes data = 3; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // string messageId = 4; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.AsymetricEncryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AsymetricEncryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AsymetricEncryptResponse) */ { + public: + inline AsymetricEncryptResponse() : AsymetricEncryptResponse(nullptr) {} + ~AsymetricEncryptResponse() override; + explicit constexpr AsymetricEncryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AsymetricEncryptResponse(const AsymetricEncryptResponse& from); + AsymetricEncryptResponse(AsymetricEncryptResponse&& from) noexcept + : AsymetricEncryptResponse() { + *this = ::std::move(from); + } + + inline AsymetricEncryptResponse& operator=(const AsymetricEncryptResponse& from) { + CopyFrom(from); + return *this; + } + inline AsymetricEncryptResponse& operator=(AsymetricEncryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AsymetricEncryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const AsymetricEncryptResponse* internal_default_instance() { + return reinterpret_cast( + &_AsymetricEncryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(AsymetricEncryptResponse& a, AsymetricEncryptResponse& b) { + a.Swap(&b); + } + inline void Swap(AsymetricEncryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AsymetricEncryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AsymetricEncryptResponse* New() const final { + return new AsymetricEncryptResponse(); + } + + AsymetricEncryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AsymetricEncryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AsymetricEncryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AsymetricEncryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AsymetricEncryptResponse"; + } + protected: + explicit AsymetricEncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEncryptedDataFieldNumber = 1, + }; + // bytes encryptedData = 1; + void clear_encrypteddata(); + const std::string& encrypteddata() const; + template + void set_encrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_encrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_encrypteddata(); + void set_allocated_encrypteddata(std::string* encrypteddata); + private: + const std::string& _internal_encrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_encrypteddata(const std::string& value); + std::string* _internal_mutable_encrypteddata(); + public: + + // @@protoc_insertion_point(class_scope:crypto.AsymetricEncryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr encrypteddata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AsymetricDecryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AsymetricDecryptRequest) */ { + public: + inline AsymetricDecryptRequest() : AsymetricDecryptRequest(nullptr) {} + ~AsymetricDecryptRequest() override; + explicit constexpr AsymetricDecryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AsymetricDecryptRequest(const AsymetricDecryptRequest& from); + AsymetricDecryptRequest(AsymetricDecryptRequest&& from) noexcept + : AsymetricDecryptRequest() { + *this = ::std::move(from); + } + + inline AsymetricDecryptRequest& operator=(const AsymetricDecryptRequest& from) { + CopyFrom(from); + return *this; + } + inline AsymetricDecryptRequest& operator=(AsymetricDecryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AsymetricDecryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const AsymetricDecryptRequest* internal_default_instance() { + return reinterpret_cast( + &_AsymetricDecryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(AsymetricDecryptRequest& a, AsymetricDecryptRequest& b) { + a.Swap(&b); + } + inline void Swap(AsymetricDecryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AsymetricDecryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AsymetricDecryptRequest* New() const final { + return new AsymetricDecryptRequest(); + } + + AsymetricDecryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AsymetricDecryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AsymetricDecryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AsymetricDecryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AsymetricDecryptRequest"; + } + protected: + explicit AsymetricDecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kKeyIdFieldNumber = 3, + kDataFieldNumber = 4, + kMessageIdFieldNumber = 5, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + }; + // string keyId = 3; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // bytes data = 4; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // string messageId = 5; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.AsymetricDecryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GetHashLengthRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GetHashLengthRequest) */ { + public: + inline GetHashLengthRequest() : GetHashLengthRequest(nullptr) {} + ~GetHashLengthRequest() override; + explicit constexpr GetHashLengthRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GetHashLengthRequest(const GetHashLengthRequest& from); + GetHashLengthRequest(GetHashLengthRequest&& from) noexcept + : GetHashLengthRequest() { + *this = ::std::move(from); + } + + inline GetHashLengthRequest& operator=(const GetHashLengthRequest& from) { + CopyFrom(from); + return *this; + } + inline GetHashLengthRequest& operator=(GetHashLengthRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GetHashLengthRequest& default_instance() { + return *internal_default_instance(); + } + static inline const GetHashLengthRequest* internal_default_instance() { + return reinterpret_cast( + &_GetHashLengthRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(GetHashLengthRequest& a, GetHashLengthRequest& b) { + a.Swap(&b); + } + inline void Swap(GetHashLengthRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GetHashLengthRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GetHashLengthRequest* New() const final { + return new GetHashLengthRequest(); + } + + GetHashLengthRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GetHashLengthRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GetHashLengthRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GetHashLengthRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GetHashLengthRequest"; + } + protected: + explicit GetHashLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 4, + kSenderIdFieldNumber = 1, + kFuncFieldNumber = 2, + kDataLenFieldNumber = 3, + }; + // string messageId = 4; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // .crypto.SHAAlgorithm func = 2; + void clear_func(); + ::crypto::SHAAlgorithm func() const; + void set_func(::crypto::SHAAlgorithm value); + private: + ::crypto::SHAAlgorithm _internal_func() const; + void _internal_set_func(::crypto::SHAAlgorithm value); + public: + + // int32 dataLen = 3; + void clear_datalen(); + ::PROTOBUF_NAMESPACE_ID::int32 datalen() const; + void set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_datalen() const; + void _internal_set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GetHashLengthRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + int func_; + ::PROTOBUF_NAMESPACE_ID::int32 datalen_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GetAESLengthRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GetAESLengthRequest) */ { + public: + inline GetAESLengthRequest() : GetAESLengthRequest(nullptr) {} + ~GetAESLengthRequest() override; + explicit constexpr GetAESLengthRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GetAESLengthRequest(const GetAESLengthRequest& from); + GetAESLengthRequest(GetAESLengthRequest&& from) noexcept + : GetAESLengthRequest() { + *this = ::std::move(from); + } + + inline GetAESLengthRequest& operator=(const GetAESLengthRequest& from) { + CopyFrom(from); + return *this; + } + inline GetAESLengthRequest& operator=(GetAESLengthRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GetAESLengthRequest& default_instance() { + return *internal_default_instance(); + } + static inline const GetAESLengthRequest* internal_default_instance() { + return reinterpret_cast( + &_GetAESLengthRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(GetAESLengthRequest& a, GetAESLengthRequest& b) { + a.Swap(&b); + } + inline void Swap(GetAESLengthRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GetAESLengthRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GetAESLengthRequest* New() const final { + return new GetAESLengthRequest(); + } + + GetAESLengthRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GetAESLengthRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GetAESLengthRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GetAESLengthRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GetAESLengthRequest"; + } + protected: + explicit GetAESLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 5, + kSenderIdFieldNumber = 1, + kDataLenFieldNumber = 2, + kIsFirstFieldNumber = 3, + kChainingModeFieldNumber = 4, + }; + // string messageId = 5; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 dataLen = 2; + void clear_datalen(); + ::PROTOBUF_NAMESPACE_ID::int32 datalen() const; + void set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_datalen() const; + void _internal_set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // bool isFirst = 3; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // .crypto.AESChainingMode chainingMode = 4; + void clear_chainingmode(); + ::crypto::AESChainingMode chainingmode() const; + void set_chainingmode(::crypto::AESChainingMode value); + private: + ::crypto::AESChainingMode _internal_chainingmode() const; + void _internal_set_chainingmode(::crypto::AESChainingMode value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GetAESLengthRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 datalen_; + bool isfirst_; + int chainingmode_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AsymetricDecryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AsymetricDecryptResponse) */ { + public: + inline AsymetricDecryptResponse() : AsymetricDecryptResponse(nullptr) {} + ~AsymetricDecryptResponse() override; + explicit constexpr AsymetricDecryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AsymetricDecryptResponse(const AsymetricDecryptResponse& from); + AsymetricDecryptResponse(AsymetricDecryptResponse&& from) noexcept + : AsymetricDecryptResponse() { + *this = ::std::move(from); + } + + inline AsymetricDecryptResponse& operator=(const AsymetricDecryptResponse& from) { + CopyFrom(from); + return *this; + } + inline AsymetricDecryptResponse& operator=(AsymetricDecryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AsymetricDecryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const AsymetricDecryptResponse* internal_default_instance() { + return reinterpret_cast( + &_AsymetricDecryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(AsymetricDecryptResponse& a, AsymetricDecryptResponse& b) { + a.Swap(&b); + } + inline void Swap(AsymetricDecryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AsymetricDecryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AsymetricDecryptResponse* New() const final { + return new AsymetricDecryptResponse(); + } + + AsymetricDecryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AsymetricDecryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AsymetricDecryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AsymetricDecryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AsymetricDecryptResponse"; + } + protected: + explicit AsymetricDecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDecryptedDataFieldNumber = 1, + }; + // bytes decryptedData = 1; + void clear_decrypteddata(); + const std::string& decrypteddata() const; + template + void set_decrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_decrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_decrypteddata(); + void set_allocated_decrypteddata(std::string* decrypteddata); + private: + const std::string& _internal_decrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_decrypteddata(const std::string& value); + std::string* _internal_mutable_decrypteddata(); + public: + + // @@protoc_insertion_point(class_scope:crypto.AsymetricDecryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr decrypteddata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GetLengthRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GetLengthRequest) */ { + public: + inline GetLengthRequest() : GetLengthRequest(nullptr) {} + ~GetLengthRequest() override; + explicit constexpr GetLengthRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GetLengthRequest(const GetLengthRequest& from); + GetLengthRequest(GetLengthRequest&& from) noexcept + : GetLengthRequest() { + *this = ::std::move(from); + } + + inline GetLengthRequest& operator=(const GetLengthRequest& from) { + CopyFrom(from); + return *this; + } + inline GetLengthRequest& operator=(GetLengthRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GetLengthRequest& default_instance() { + return *internal_default_instance(); + } + static inline const GetLengthRequest* internal_default_instance() { + return reinterpret_cast( + &_GetLengthRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(GetLengthRequest& a, GetLengthRequest& b) { + a.Swap(&b); + } + inline void Swap(GetLengthRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GetLengthRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GetLengthRequest* New() const final { + return new GetLengthRequest(); + } + + GetLengthRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GetLengthRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GetLengthRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GetLengthRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GetLengthRequest"; + } + protected: + explicit GetLengthRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 3, + kSenderIdFieldNumber = 1, + kInLenFieldNumber = 2, + }; + // string messageId = 3; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 inLen = 2; + void clear_inlen(); + ::PROTOBUF_NAMESPACE_ID::int32 inlen() const; + void set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_inlen() const; + void _internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GetLengthRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 inlen_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GetLengthResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GetLengthResponse) */ { + public: + inline GetLengthResponse() : GetLengthResponse(nullptr) {} + ~GetLengthResponse() override; + explicit constexpr GetLengthResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GetLengthResponse(const GetLengthResponse& from); + GetLengthResponse(GetLengthResponse&& from) noexcept + : GetLengthResponse() { + *this = ::std::move(from); + } + + inline GetLengthResponse& operator=(const GetLengthResponse& from) { + CopyFrom(from); + return *this; + } + inline GetLengthResponse& operator=(GetLengthResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GetLengthResponse& default_instance() { + return *internal_default_instance(); + } + static inline const GetLengthResponse* internal_default_instance() { + return reinterpret_cast( + &_GetLengthResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(GetLengthResponse& a, GetLengthResponse& b) { + a.Swap(&b); + } + inline void Swap(GetLengthResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GetLengthResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GetLengthResponse* New() const final { + return new GetLengthResponse(); + } + + GetLengthResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GetLengthResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GetLengthResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GetLengthResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GetLengthResponse"; + } + protected: + explicit GetLengthResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kLenFieldNumber = 1, + }; + // int32 len = 1; + void clear_len(); + ::PROTOBUF_NAMESPACE_ID::int32 len() const; + void set_len(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_len() const; + void _internal_set_len(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GetLengthResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::int32 len_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GetWholeLength final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GetWholeLength) */ { + public: + inline GetWholeLength() : GetWholeLength(nullptr) {} + ~GetWholeLength() override; + explicit constexpr GetWholeLength(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GetWholeLength(const GetWholeLength& from); + GetWholeLength(GetWholeLength&& from) noexcept + : GetWholeLength() { + *this = ::std::move(from); + } + + inline GetWholeLength& operator=(const GetWholeLength& from) { + CopyFrom(from); + return *this; + } + inline GetWholeLength& operator=(GetWholeLength&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GetWholeLength& default_instance() { + return *internal_default_instance(); + } + static inline const GetWholeLength* internal_default_instance() { + return reinterpret_cast( + &_GetWholeLength_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(GetWholeLength& a, GetWholeLength& b) { + a.Swap(&b); + } + inline void Swap(GetWholeLength* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GetWholeLength* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GetWholeLength* New() const final { + return new GetWholeLength(); + } + + GetWholeLength* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GetWholeLength& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GetWholeLength& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GetWholeLength* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GetWholeLength"; + } + protected: + explicit GetWholeLength(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 4, + kSenderIdFieldNumber = 1, + kInLenFieldNumber = 2, + kIsFirstFieldNumber = 3, + kUserIdFieldNumber = 5, + }; + // string messageId = 4; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 inLen = 2; + void clear_inlen(); + ::PROTOBUF_NAMESPACE_ID::int32 inlen() const; + void set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_inlen() const; + void _internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // bool isFirst = 3; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // int32 userId = 5; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GetWholeLength) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 inlen_; + bool isfirst_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GenerateAESKeyRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GenerateAESKeyRequest) */ { + public: + inline GenerateAESKeyRequest() : GenerateAESKeyRequest(nullptr) {} + ~GenerateAESKeyRequest() override; + explicit constexpr GenerateAESKeyRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GenerateAESKeyRequest(const GenerateAESKeyRequest& from); + GenerateAESKeyRequest(GenerateAESKeyRequest&& from) noexcept + : GenerateAESKeyRequest() { + *this = ::std::move(from); + } + + inline GenerateAESKeyRequest& operator=(const GenerateAESKeyRequest& from) { + CopyFrom(from); + return *this; + } + inline GenerateAESKeyRequest& operator=(GenerateAESKeyRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GenerateAESKeyRequest& default_instance() { + return *internal_default_instance(); + } + static inline const GenerateAESKeyRequest* internal_default_instance() { + return reinterpret_cast( + &_GenerateAESKeyRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(GenerateAESKeyRequest& a, GenerateAESKeyRequest& b) { + a.Swap(&b); + } + inline void Swap(GenerateAESKeyRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GenerateAESKeyRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GenerateAESKeyRequest* New() const final { + return new GenerateAESKeyRequest(); + } + + GenerateAESKeyRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GenerateAESKeyRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GenerateAESKeyRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GenerateAESKeyRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GenerateAESKeyRequest"; + } + protected: + explicit GenerateAESKeyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPermissionsFieldNumber = 2, + kMessageIdFieldNumber = 5, + kUserIdFieldNumber = 1, + kKeyLengthFieldNumber = 3, + kDestUserIdFieldNumber = 4, + }; + // repeated .crypto.KeyPermission permissions = 2; + int permissions_size() const; + private: + int _internal_permissions_size() const; + public: + void clear_permissions(); + private: + ::crypto::KeyPermission _internal_permissions(int index) const; + void _internal_add_permissions(::crypto::KeyPermission value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_permissions(); + public: + ::crypto::KeyPermission permissions(int index) const; + void set_permissions(int index, ::crypto::KeyPermission value); + void add_permissions(::crypto::KeyPermission value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& permissions() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_permissions(); + + // string messageId = 5; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 userId = 1; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // .crypto.AESKeyLength keyLength = 3; + void clear_keylength(); + ::crypto::AESKeyLength keylength() const; + void set_keylength(::crypto::AESKeyLength value); + private: + ::crypto::AESKeyLength _internal_keylength() const; + void _internal_set_keylength(::crypto::AESKeyLength value); + public: + + // int32 destUserId = 4; + void clear_destuserid(); + ::PROTOBUF_NAMESPACE_ID::int32 destuserid() const; + void set_destuserid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_destuserid() const; + void _internal_set_destuserid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GenerateAESKeyRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField permissions_; + mutable std::atomic _permissions_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + int keylength_; + ::PROTOBUF_NAMESPACE_ID::int32 destuserid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GenerateAESKeyResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GenerateAESKeyResponse) */ { + public: + inline GenerateAESKeyResponse() : GenerateAESKeyResponse(nullptr) {} + ~GenerateAESKeyResponse() override; + explicit constexpr GenerateAESKeyResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GenerateAESKeyResponse(const GenerateAESKeyResponse& from); + GenerateAESKeyResponse(GenerateAESKeyResponse&& from) noexcept + : GenerateAESKeyResponse() { + *this = ::std::move(from); + } + + inline GenerateAESKeyResponse& operator=(const GenerateAESKeyResponse& from) { + CopyFrom(from); + return *this; + } + inline GenerateAESKeyResponse& operator=(GenerateAESKeyResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GenerateAESKeyResponse& default_instance() { + return *internal_default_instance(); + } + static inline const GenerateAESKeyResponse* internal_default_instance() { + return reinterpret_cast( + &_GenerateAESKeyResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 10; + + friend void swap(GenerateAESKeyResponse& a, GenerateAESKeyResponse& b) { + a.Swap(&b); + } + inline void Swap(GenerateAESKeyResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GenerateAESKeyResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GenerateAESKeyResponse* New() const final { + return new GenerateAESKeyResponse(); + } + + GenerateAESKeyResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GenerateAESKeyResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GenerateAESKeyResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GenerateAESKeyResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GenerateAESKeyResponse"; + } + protected: + explicit GenerateAESKeyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAesKeyFieldNumber = 1, + }; + // string aesKey = 1; + void clear_aeskey(); + const std::string& aeskey() const; + template + void set_aeskey(ArgT0&& arg0, ArgT... args); + std::string* mutable_aeskey(); + PROTOBUF_MUST_USE_RESULT std::string* release_aeskey(); + void set_allocated_aeskey(std::string* aeskey); + private: + const std::string& _internal_aeskey() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_aeskey(const std::string& value); + std::string* _internal_mutable_aeskey(); + public: + + // @@protoc_insertion_point(class_scope:crypto.GenerateAESKeyResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr aeskey_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GenerateKeyPairRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GenerateKeyPairRequest) */ { + public: + inline GenerateKeyPairRequest() : GenerateKeyPairRequest(nullptr) {} + ~GenerateKeyPairRequest() override; + explicit constexpr GenerateKeyPairRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GenerateKeyPairRequest(const GenerateKeyPairRequest& from); + GenerateKeyPairRequest(GenerateKeyPairRequest&& from) noexcept + : GenerateKeyPairRequest() { + *this = ::std::move(from); + } + + inline GenerateKeyPairRequest& operator=(const GenerateKeyPairRequest& from) { + CopyFrom(from); + return *this; + } + inline GenerateKeyPairRequest& operator=(GenerateKeyPairRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GenerateKeyPairRequest& default_instance() { + return *internal_default_instance(); + } + static inline const GenerateKeyPairRequest* internal_default_instance() { + return reinterpret_cast( + &_GenerateKeyPairRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 11; + + friend void swap(GenerateKeyPairRequest& a, GenerateKeyPairRequest& b) { + a.Swap(&b); + } + inline void Swap(GenerateKeyPairRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GenerateKeyPairRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GenerateKeyPairRequest* New() const final { + return new GenerateKeyPairRequest(); + } + + GenerateKeyPairRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GenerateKeyPairRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GenerateKeyPairRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GenerateKeyPairRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GenerateKeyPairRequest"; + } + protected: + explicit GenerateKeyPairRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPermissionsFieldNumber = 2, + kMessageIdFieldNumber = 3, + kUserIdFieldNumber = 1, + }; + // repeated .crypto.KeyPermission permissions = 2; + int permissions_size() const; + private: + int _internal_permissions_size() const; + public: + void clear_permissions(); + private: + ::crypto::KeyPermission _internal_permissions(int index) const; + void _internal_add_permissions(::crypto::KeyPermission value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_permissions(); + public: + ::crypto::KeyPermission permissions(int index) const; + void set_permissions(int index, ::crypto::KeyPermission value); + void add_permissions(::crypto::KeyPermission value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& permissions() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_permissions(); + + // string messageId = 3; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 userId = 1; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.GenerateKeyPairRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField permissions_; + mutable std::atomic _permissions_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class GenerateKeyPairResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.GenerateKeyPairResponse) */ { + public: + inline GenerateKeyPairResponse() : GenerateKeyPairResponse(nullptr) {} + ~GenerateKeyPairResponse() override; + explicit constexpr GenerateKeyPairResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + GenerateKeyPairResponse(const GenerateKeyPairResponse& from); + GenerateKeyPairResponse(GenerateKeyPairResponse&& from) noexcept + : GenerateKeyPairResponse() { + *this = ::std::move(from); + } + + inline GenerateKeyPairResponse& operator=(const GenerateKeyPairResponse& from) { + CopyFrom(from); + return *this; + } + inline GenerateKeyPairResponse& operator=(GenerateKeyPairResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const GenerateKeyPairResponse& default_instance() { + return *internal_default_instance(); + } + static inline const GenerateKeyPairResponse* internal_default_instance() { + return reinterpret_cast( + &_GenerateKeyPairResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 12; + + friend void swap(GenerateKeyPairResponse& a, GenerateKeyPairResponse& b) { + a.Swap(&b); + } + inline void Swap(GenerateKeyPairResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(GenerateKeyPairResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline GenerateKeyPairResponse* New() const final { + return new GenerateKeyPairResponse(); + } + + GenerateKeyPairResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const GenerateKeyPairResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const GenerateKeyPairResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(GenerateKeyPairResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.GenerateKeyPairResponse"; + } + protected: + explicit GenerateKeyPairResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPublicKeyFieldNumber = 1, + kPrivateKeyFieldNumber = 2, + }; + // string publicKey = 1; + void clear_publickey(); + const std::string& publickey() const; + template + void set_publickey(ArgT0&& arg0, ArgT... args); + std::string* mutable_publickey(); + PROTOBUF_MUST_USE_RESULT std::string* release_publickey(); + void set_allocated_publickey(std::string* publickey); + private: + const std::string& _internal_publickey() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_publickey(const std::string& value); + std::string* _internal_mutable_publickey(); + public: + + // string privateKey = 2; + void clear_privatekey(); + const std::string& privatekey() const; + template + void set_privatekey(ArgT0&& arg0, ArgT... args); + std::string* mutable_privatekey(); + PROTOBUF_MUST_USE_RESULT std::string* release_privatekey(); + void set_allocated_privatekey(std::string* privatekey); + private: + const std::string& _internal_privatekey() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_privatekey(const std::string& value); + std::string* _internal_mutable_privatekey(); + public: + + // @@protoc_insertion_point(class_scope:crypto.GenerateKeyPairResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr publickey_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr privatekey_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class SignRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.SignRequest) */ { + public: + inline SignRequest() : SignRequest(nullptr) {} + ~SignRequest() override; + explicit constexpr SignRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SignRequest(const SignRequest& from); + SignRequest(SignRequest&& from) noexcept + : SignRequest() { + *this = ::std::move(from); + } + + inline SignRequest& operator=(const SignRequest& from) { + CopyFrom(from); + return *this; + } + inline SignRequest& operator=(SignRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const SignRequest& default_instance() { + return *internal_default_instance(); + } + static inline const SignRequest* internal_default_instance() { + return reinterpret_cast( + &_SignRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 13; + + friend void swap(SignRequest& a, SignRequest& b) { + a.Swap(&b); + } + inline void Swap(SignRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SignRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SignRequest* New() const final { + return new SignRequest(); + } + + SignRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const SignRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const SignRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SignRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.SignRequest"; + } + protected: + explicit SignRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 2, + kKeyIdFieldNumber = 6, + kMessageIdFieldNumber = 7, + kSenderIdFieldNumber = 1, + kHashFuncFieldNumber = 3, + kCounterFieldNumber = 5, + }; + // bytes data = 2; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // string keyId = 6; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // string messageId = 7; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // .crypto.SHAAlgorithm hashFunc = 3; + void clear_hashfunc(); + ::crypto::SHAAlgorithm hashfunc() const; + void set_hashfunc(::crypto::SHAAlgorithm value); + private: + ::crypto::SHAAlgorithm _internal_hashfunc() const; + void _internal_set_hashfunc(::crypto::SHAAlgorithm value); + public: + + // int64 counter = 5; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int64 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.SignRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + int hashfunc_; + ::PROTOBUF_NAMESPACE_ID::int64 counter_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class SignResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.SignResponse) */ { + public: + inline SignResponse() : SignResponse(nullptr) {} + ~SignResponse() override; + explicit constexpr SignResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SignResponse(const SignResponse& from); + SignResponse(SignResponse&& from) noexcept + : SignResponse() { + *this = ::std::move(from); + } + + inline SignResponse& operator=(const SignResponse& from) { + CopyFrom(from); + return *this; + } + inline SignResponse& operator=(SignResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const SignResponse& default_instance() { + return *internal_default_instance(); + } + static inline const SignResponse* internal_default_instance() { + return reinterpret_cast( + &_SignResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 14; + + friend void swap(SignResponse& a, SignResponse& b) { + a.Swap(&b); + } + inline void Swap(SignResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SignResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SignResponse* New() const final { + return new SignResponse(); + } + + SignResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const SignResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const SignResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SignResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.SignResponse"; + } + protected: + explicit SignResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSignatureFieldNumber = 1, + }; + // bytes signature = 1; + void clear_signature(); + const std::string& signature() const; + template + void set_signature(ArgT0&& arg0, ArgT... args); + std::string* mutable_signature(); + PROTOBUF_MUST_USE_RESULT std::string* release_signature(); + void set_allocated_signature(std::string* signature); + private: + const std::string& _internal_signature() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_signature(const std::string& value); + std::string* _internal_mutable_signature(); + public: + + // @@protoc_insertion_point(class_scope:crypto.SignResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr signature_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class VerifyRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.VerifyRequest) */ { + public: + inline VerifyRequest() : VerifyRequest(nullptr) {} + ~VerifyRequest() override; + explicit constexpr VerifyRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + VerifyRequest(const VerifyRequest& from); + VerifyRequest(VerifyRequest&& from) noexcept + : VerifyRequest() { + *this = ::std::move(from); + } + + inline VerifyRequest& operator=(const VerifyRequest& from) { + CopyFrom(from); + return *this; + } + inline VerifyRequest& operator=(VerifyRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const VerifyRequest& default_instance() { + return *internal_default_instance(); + } + static inline const VerifyRequest* internal_default_instance() { + return reinterpret_cast( + &_VerifyRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 15; + + friend void swap(VerifyRequest& a, VerifyRequest& b) { + a.Swap(&b); + } + inline void Swap(VerifyRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(VerifyRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline VerifyRequest* New() const final { + return new VerifyRequest(); + } + + VerifyRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const VerifyRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const VerifyRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(VerifyRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.VerifyRequest"; + } + protected: + explicit VerifyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 3, + kSignatureFieldNumber = 4, + kKeyIdFieldNumber = 6, + kMessageIdFieldNumber = 8, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + kHashFuncFieldNumber = 5, + kCounterFieldNumber = 7, + }; + // bytes data = 3; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // bytes signature = 4; + void clear_signature(); + const std::string& signature() const; + template + void set_signature(ArgT0&& arg0, ArgT... args); + std::string* mutable_signature(); + PROTOBUF_MUST_USE_RESULT std::string* release_signature(); + void set_allocated_signature(std::string* signature); + private: + const std::string& _internal_signature() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_signature(const std::string& value); + std::string* _internal_mutable_signature(); + public: + + // string keyId = 6; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // string messageId = 8; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // .crypto.SHAAlgorithm hashFunc = 5; + void clear_hashfunc(); + ::crypto::SHAAlgorithm hashfunc() const; + void set_hashfunc(::crypto::SHAAlgorithm value); + private: + ::crypto::SHAAlgorithm _internal_hashfunc() const; + void _internal_set_hashfunc(::crypto::SHAAlgorithm value); + public: + + // int32 counter = 7; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int32 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.VerifyRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr signature_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + int hashfunc_; + ::PROTOBUF_NAMESPACE_ID::int32 counter_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class VerifyResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.VerifyResponse) */ { + public: + inline VerifyResponse() : VerifyResponse(nullptr) {} + ~VerifyResponse() override; + explicit constexpr VerifyResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + VerifyResponse(const VerifyResponse& from); + VerifyResponse(VerifyResponse&& from) noexcept + : VerifyResponse() { + *this = ::std::move(from); + } + + inline VerifyResponse& operator=(const VerifyResponse& from) { + CopyFrom(from); + return *this; + } + inline VerifyResponse& operator=(VerifyResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const VerifyResponse& default_instance() { + return *internal_default_instance(); + } + static inline const VerifyResponse* internal_default_instance() { + return reinterpret_cast( + &_VerifyResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 16; + + friend void swap(VerifyResponse& a, VerifyResponse& b) { + a.Swap(&b); + } + inline void Swap(VerifyResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(VerifyResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline VerifyResponse* New() const final { + return new VerifyResponse(); + } + + VerifyResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const VerifyResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const VerifyResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(VerifyResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.VerifyResponse"; + } + protected: + explicit VerifyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOutFieldNumber = 2, + kValidFieldNumber = 1, + }; + // bytes out = 2; + void clear_out(); + const std::string& out() const; + template + void set_out(ArgT0&& arg0, ArgT... args); + std::string* mutable_out(); + PROTOBUF_MUST_USE_RESULT std::string* release_out(); + void set_allocated_out(std::string* out); + private: + const std::string& _internal_out() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_out(const std::string& value); + std::string* _internal_mutable_out(); + public: + + // bool valid = 1; + void clear_valid(); + bool valid() const; + void set_valid(bool value); + private: + bool _internal_valid() const; + void _internal_set_valid(bool value); + public: + + // @@protoc_insertion_point(class_scope:crypto.VerifyResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr out_; + bool valid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class KeyRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.KeyRequest) */ { + public: + inline KeyRequest() : KeyRequest(nullptr) {} + ~KeyRequest() override; + explicit constexpr KeyRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + KeyRequest(const KeyRequest& from); + KeyRequest(KeyRequest&& from) noexcept + : KeyRequest() { + *this = ::std::move(from); + } + + inline KeyRequest& operator=(const KeyRequest& from) { + CopyFrom(from); + return *this; + } + inline KeyRequest& operator=(KeyRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const KeyRequest& default_instance() { + return *internal_default_instance(); + } + static inline const KeyRequest* internal_default_instance() { + return reinterpret_cast( + &_KeyRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 17; + + friend void swap(KeyRequest& a, KeyRequest& b) { + a.Swap(&b); + } + inline void Swap(KeyRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(KeyRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline KeyRequest* New() const final { + return new KeyRequest(); + } + + KeyRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const KeyRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const KeyRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(KeyRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.KeyRequest"; + } + protected: + explicit KeyRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 3, + kSenderIdFieldNumber = 1, + kUserIdFieldNumber = 2, + }; + // string messageId = 3; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 userId = 2; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.KeyRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class KeyResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.KeyResponse) */ { + public: + inline KeyResponse() : KeyResponse(nullptr) {} + ~KeyResponse() override; + explicit constexpr KeyResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + KeyResponse(const KeyResponse& from); + KeyResponse(KeyResponse&& from) noexcept + : KeyResponse() { + *this = ::std::move(from); + } + + inline KeyResponse& operator=(const KeyResponse& from) { + CopyFrom(from); + return *this; + } + inline KeyResponse& operator=(KeyResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const KeyResponse& default_instance() { + return *internal_default_instance(); + } + static inline const KeyResponse* internal_default_instance() { + return reinterpret_cast( + &_KeyResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 18; + + friend void swap(KeyResponse& a, KeyResponse& b) { + a.Swap(&b); + } + inline void Swap(KeyResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(KeyResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline KeyResponse* New() const final { + return new KeyResponse(); + } + + KeyResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const KeyResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const KeyResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(KeyResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.KeyResponse"; + } + protected: + explicit KeyResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kKeyFieldNumber = 1, + }; + // string key = 1; + void clear_key(); + const std::string& key() const; + template + void set_key(ArgT0&& arg0, ArgT... args); + std::string* mutable_key(); + PROTOBUF_MUST_USE_RESULT std::string* release_key(); + void set_allocated_key(std::string* key); + private: + const std::string& _internal_key() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_key(const std::string& value); + std::string* _internal_mutable_key(); + public: + + // @@protoc_insertion_point(class_scope:crypto.KeyResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr key_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class UserKeyPermissions final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.UserKeyPermissions) */ { + public: + inline UserKeyPermissions() : UserKeyPermissions(nullptr) {} + ~UserKeyPermissions() override; + explicit constexpr UserKeyPermissions(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + UserKeyPermissions(const UserKeyPermissions& from); + UserKeyPermissions(UserKeyPermissions&& from) noexcept + : UserKeyPermissions() { + *this = ::std::move(from); + } + + inline UserKeyPermissions& operator=(const UserKeyPermissions& from) { + CopyFrom(from); + return *this; + } + inline UserKeyPermissions& operator=(UserKeyPermissions&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const UserKeyPermissions& default_instance() { + return *internal_default_instance(); + } + static inline const UserKeyPermissions* internal_default_instance() { + return reinterpret_cast( + &_UserKeyPermissions_default_instance_); + } + static constexpr int kIndexInFileMessages = + 19; + + friend void swap(UserKeyPermissions& a, UserKeyPermissions& b) { + a.Swap(&b); + } + inline void Swap(UserKeyPermissions* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(UserKeyPermissions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline UserKeyPermissions* New() const final { + return new UserKeyPermissions(); + } + + UserKeyPermissions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const UserKeyPermissions& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const UserKeyPermissions& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(UserKeyPermissions* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.UserKeyPermissions"; + } + protected: + explicit UserKeyPermissions(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPermissionsFieldNumber = 2, + kUserIdFieldNumber = 1, + }; + // repeated .crypto.KeyPermission permissions = 2; + int permissions_size() const; + private: + int _internal_permissions_size() const; + public: + void clear_permissions(); + private: + ::crypto::KeyPermission _internal_permissions(int index) const; + void _internal_add_permissions(::crypto::KeyPermission value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_permissions(); + public: + ::crypto::KeyPermission permissions(int index) const; + void set_permissions(int index, ::crypto::KeyPermission value); + void add_permissions(::crypto::KeyPermission value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& permissions() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_permissions(); + + // int32 userId = 1; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.UserKeyPermissions) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField permissions_; + mutable std::atomic _permissions_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class BootSystemRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.BootSystemRequest) */ { + public: + inline BootSystemRequest() : BootSystemRequest(nullptr) {} + ~BootSystemRequest() override; + explicit constexpr BootSystemRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + BootSystemRequest(const BootSystemRequest& from); + BootSystemRequest(BootSystemRequest&& from) noexcept + : BootSystemRequest() { + *this = ::std::move(from); + } + + inline BootSystemRequest& operator=(const BootSystemRequest& from) { + CopyFrom(from); + return *this; + } + inline BootSystemRequest& operator=(BootSystemRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const BootSystemRequest& default_instance() { + return *internal_default_instance(); + } + static inline const BootSystemRequest* internal_default_instance() { + return reinterpret_cast( + &_BootSystemRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 20; + + friend void swap(BootSystemRequest& a, BootSystemRequest& b) { + a.Swap(&b); + } + inline void Swap(BootSystemRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BootSystemRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BootSystemRequest* New() const final { + return new BootSystemRequest(); + } + + BootSystemRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const BootSystemRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const BootSystemRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BootSystemRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.BootSystemRequest"; + } + protected: + explicit BootSystemRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kUsersIdsPermissionsFieldNumber = 1, + kMessageIdFieldNumber = 5, + }; + // repeated .crypto.UserKeyPermissions usersIdsPermissions = 1; + int usersidspermissions_size() const; + private: + int _internal_usersidspermissions_size() const; + public: + void clear_usersidspermissions(); + ::crypto::UserKeyPermissions* mutable_usersidspermissions(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::crypto::UserKeyPermissions >* + mutable_usersidspermissions(); + private: + const ::crypto::UserKeyPermissions& _internal_usersidspermissions(int index) const; + ::crypto::UserKeyPermissions* _internal_add_usersidspermissions(); + public: + const ::crypto::UserKeyPermissions& usersidspermissions(int index) const; + ::crypto::UserKeyPermissions* add_usersidspermissions(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::crypto::UserKeyPermissions >& + usersidspermissions() const; + + // string messageId = 5; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // @@protoc_insertion_point(class_scope:crypto.BootSystemRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::crypto::UserKeyPermissions > usersidspermissions_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class Empty final : + public ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase /* @@protoc_insertion_point(class_definition:crypto.Empty) */ { + public: + inline Empty() : Empty(nullptr) {} + explicit constexpr Empty(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Empty(const Empty& from); + Empty(Empty&& from) noexcept + : Empty() { + *this = ::std::move(from); + } + + inline Empty& operator=(const Empty& from) { + CopyFrom(from); + return *this; + } + inline Empty& operator=(Empty&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Empty& default_instance() { + return *internal_default_instance(); + } + static inline const Empty* internal_default_instance() { + return reinterpret_cast( + &_Empty_default_instance_); + } + static constexpr int kIndexInFileMessages = + 21; + + friend void swap(Empty& a, Empty& b) { + a.Swap(&b); + } + inline void Swap(Empty* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Empty* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Empty* New() const final { + return new Empty(); + } + + Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom; + inline void CopyFrom(const Empty& from) { + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl(this, from); + } + using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeFrom; + void MergeFrom(const Empty& from) { + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from); + } + public: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.Empty"; + } + protected: + explicit Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:crypto.Empty) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class CryptoConfig final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.CryptoConfig) */ { + public: + inline CryptoConfig() : CryptoConfig(nullptr) {} + ~CryptoConfig() override; + explicit constexpr CryptoConfig(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + CryptoConfig(const CryptoConfig& from); + CryptoConfig(CryptoConfig&& from) noexcept + : CryptoConfig() { + *this = ::std::move(from); + } + + inline CryptoConfig& operator=(const CryptoConfig& from) { + CopyFrom(from); + return *this; + } + inline CryptoConfig& operator=(CryptoConfig&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const CryptoConfig& default_instance() { + return *internal_default_instance(); + } + static inline const CryptoConfig* internal_default_instance() { + return reinterpret_cast( + &_CryptoConfig_default_instance_); + } + static constexpr int kIndexInFileMessages = + 22; + + friend void swap(CryptoConfig& a, CryptoConfig& b) { + a.Swap(&b); + } + inline void Swap(CryptoConfig* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CryptoConfig* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline CryptoConfig* New() const final { + return new CryptoConfig(); + } + + CryptoConfig* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const CryptoConfig& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const CryptoConfig& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(CryptoConfig* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.CryptoConfig"; + } + protected: + explicit CryptoConfig(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 5, + kHashFunctionFieldNumber = 1, + kAesKeyLengthFieldNumber = 2, + kAesChainingModeFieldNumber = 3, + kAsymmetricFunctionFieldNumber = 4, + }; + // string messageId = 5; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // .crypto.SHAAlgorithm hashFunction = 1; + void clear_hashfunction(); + ::crypto::SHAAlgorithm hashfunction() const; + void set_hashfunction(::crypto::SHAAlgorithm value); + private: + ::crypto::SHAAlgorithm _internal_hashfunction() const; + void _internal_set_hashfunction(::crypto::SHAAlgorithm value); + public: + + // .crypto.AESKeyLength aesKeyLength = 2; + void clear_aeskeylength(); + ::crypto::AESKeyLength aeskeylength() const; + void set_aeskeylength(::crypto::AESKeyLength value); + private: + ::crypto::AESKeyLength _internal_aeskeylength() const; + void _internal_set_aeskeylength(::crypto::AESKeyLength value); + public: + + // .crypto.AESChainingMode aesChainingMode = 3; + void clear_aeschainingmode(); + ::crypto::AESChainingMode aeschainingmode() const; + void set_aeschainingmode(::crypto::AESChainingMode value); + private: + ::crypto::AESChainingMode _internal_aeschainingmode() const; + void _internal_set_aeschainingmode(::crypto::AESChainingMode value); + public: + + // .crypto.AsymmetricFunction asymmetricFunction = 4; + void clear_asymmetricfunction(); + ::crypto::AsymmetricFunction asymmetricfunction() const; + void set_asymmetricfunction(::crypto::AsymmetricFunction value); + private: + ::crypto::AsymmetricFunction _internal_asymmetricfunction() const; + void _internal_set_asymmetricfunction(::crypto::AsymmetricFunction value); + public: + + // @@protoc_insertion_point(class_scope:crypto.CryptoConfig) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + int hashfunction_; + int aeskeylength_; + int aeschainingmode_; + int asymmetricfunction_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class ConfigureRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.ConfigureRequest) */ { + public: + inline ConfigureRequest() : ConfigureRequest(nullptr) {} + ~ConfigureRequest() override; + explicit constexpr ConfigureRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ConfigureRequest(const ConfigureRequest& from); + ConfigureRequest(ConfigureRequest&& from) noexcept + : ConfigureRequest() { + *this = ::std::move(from); + } + + inline ConfigureRequest& operator=(const ConfigureRequest& from) { + CopyFrom(from); + return *this; + } + inline ConfigureRequest& operator=(ConfigureRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ConfigureRequest& default_instance() { + return *internal_default_instance(); + } + static inline const ConfigureRequest* internal_default_instance() { + return reinterpret_cast( + &_ConfigureRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 23; + + friend void swap(ConfigureRequest& a, ConfigureRequest& b) { + a.Swap(&b); + } + inline void Swap(ConfigureRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConfigureRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ConfigureRequest* New() const final { + return new ConfigureRequest(); + } + + ConfigureRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const ConfigureRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const ConfigureRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ConfigureRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.ConfigureRequest"; + } + protected: + explicit ConfigureRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageIdFieldNumber = 3, + kConfigFieldNumber = 2, + kUserIdFieldNumber = 1, + }; + // string messageId = 3; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // .crypto.CryptoConfig config = 2; + bool has_config() const; + private: + bool _internal_has_config() const; + public: + void clear_config(); + const ::crypto::CryptoConfig& config() const; + PROTOBUF_MUST_USE_RESULT ::crypto::CryptoConfig* release_config(); + ::crypto::CryptoConfig* mutable_config(); + void set_allocated_config(::crypto::CryptoConfig* config); + private: + const ::crypto::CryptoConfig& _internal_config() const; + ::crypto::CryptoConfig* _internal_mutable_config(); + public: + void unsafe_arena_set_allocated_config( + ::crypto::CryptoConfig* config); + ::crypto::CryptoConfig* unsafe_arena_release_config(); + + // int32 userId = 1; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.ConfigureRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::crypto::CryptoConfig* config_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AddProcessRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AddProcessRequest) */ { + public: + inline AddProcessRequest() : AddProcessRequest(nullptr) {} + ~AddProcessRequest() override; + explicit constexpr AddProcessRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AddProcessRequest(const AddProcessRequest& from); + AddProcessRequest(AddProcessRequest&& from) noexcept + : AddProcessRequest() { + *this = ::std::move(from); + } + + inline AddProcessRequest& operator=(const AddProcessRequest& from) { + CopyFrom(from); + return *this; + } + inline AddProcessRequest& operator=(AddProcessRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AddProcessRequest& default_instance() { + return *internal_default_instance(); + } + static inline const AddProcessRequest* internal_default_instance() { + return reinterpret_cast( + &_AddProcessRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 24; + + friend void swap(AddProcessRequest& a, AddProcessRequest& b) { + a.Swap(&b); + } + inline void Swap(AddProcessRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AddProcessRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AddProcessRequest* New() const final { + return new AddProcessRequest(); + } + + AddProcessRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AddProcessRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AddProcessRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AddProcessRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AddProcessRequest"; + } + protected: + explicit AddProcessRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPermissionsFieldNumber = 2, + kMessageIdFieldNumber = 4, + kUserIdFieldNumber = 1, + }; + // repeated .crypto.KeyPermission permissions = 2; + int permissions_size() const; + private: + int _internal_permissions_size() const; + public: + void clear_permissions(); + private: + ::crypto::KeyPermission _internal_permissions(int index) const; + void _internal_add_permissions(::crypto::KeyPermission value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_permissions(); + public: + ::crypto::KeyPermission permissions(int index) const; + void set_permissions(int index, ::crypto::KeyPermission value); + void add_permissions(::crypto::KeyPermission value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& permissions() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_permissions(); + + // string messageId = 4; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 userId = 1; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.AddProcessRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField permissions_; + mutable std::atomic _permissions_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class EncryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.EncryptRequest) */ { + public: + inline EncryptRequest() : EncryptRequest(nullptr) {} + ~EncryptRequest() override; + explicit constexpr EncryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + EncryptRequest(const EncryptRequest& from); + EncryptRequest(EncryptRequest&& from) noexcept + : EncryptRequest() { + *this = ::std::move(from); + } + + inline EncryptRequest& operator=(const EncryptRequest& from) { + CopyFrom(from); + return *this; + } + inline EncryptRequest& operator=(EncryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const EncryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const EncryptRequest* internal_default_instance() { + return reinterpret_cast( + &_EncryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 25; + + friend void swap(EncryptRequest& a, EncryptRequest& b) { + a.Swap(&b); + } + inline void Swap(EncryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(EncryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline EncryptRequest* New() const final { + return new EncryptRequest(); + } + + EncryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const EncryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const EncryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(EncryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.EncryptRequest"; + } + protected: + explicit EncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 3, + kMessageIdFieldNumber = 6, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + kCounterFieldNumber = 4, + kIsFirstFieldNumber = 5, + }; + // bytes data = 3; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // string messageId = 6; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int64 counter = 4; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int64 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // bool isFirst = 5; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // @@protoc_insertion_point(class_scope:crypto.EncryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + ::PROTOBUF_NAMESPACE_ID::int64 counter_; + bool isfirst_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class EncryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.EncryptResponse) */ { + public: + inline EncryptResponse() : EncryptResponse(nullptr) {} + ~EncryptResponse() override; + explicit constexpr EncryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + EncryptResponse(const EncryptResponse& from); + EncryptResponse(EncryptResponse&& from) noexcept + : EncryptResponse() { + *this = ::std::move(from); + } + + inline EncryptResponse& operator=(const EncryptResponse& from) { + CopyFrom(from); + return *this; + } + inline EncryptResponse& operator=(EncryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const EncryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const EncryptResponse* internal_default_instance() { + return reinterpret_cast( + &_EncryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 26; + + friend void swap(EncryptResponse& a, EncryptResponse& b) { + a.Swap(&b); + } + inline void Swap(EncryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(EncryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline EncryptResponse* New() const final { + return new EncryptResponse(); + } + + EncryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const EncryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const EncryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(EncryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.EncryptResponse"; + } + protected: + explicit EncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEncryptedDataFieldNumber = 1, + kSignatureFieldNumber = 2, + }; + // bytes encryptedData = 1; + void clear_encrypteddata(); + const std::string& encrypteddata() const; + template + void set_encrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_encrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_encrypteddata(); + void set_allocated_encrypteddata(std::string* encrypteddata); + private: + const std::string& _internal_encrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_encrypteddata(const std::string& value); + std::string* _internal_mutable_encrypteddata(); + public: + + // bytes signature = 2; + void clear_signature(); + const std::string& signature() const; + template + void set_signature(ArgT0&& arg0, ArgT... args); + std::string* mutable_signature(); + PROTOBUF_MUST_USE_RESULT std::string* release_signature(); + void set_allocated_signature(std::string* signature); + private: + const std::string& _internal_signature() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_signature(const std::string& value); + std::string* _internal_mutable_signature(); + public: + + // @@protoc_insertion_point(class_scope:crypto.EncryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr encrypteddata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr signature_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class DecryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.DecryptRequest) */ { + public: + inline DecryptRequest() : DecryptRequest(nullptr) {} + ~DecryptRequest() override; + explicit constexpr DecryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + DecryptRequest(const DecryptRequest& from); + DecryptRequest(DecryptRequest&& from) noexcept + : DecryptRequest() { + *this = ::std::move(from); + } + + inline DecryptRequest& operator=(const DecryptRequest& from) { + CopyFrom(from); + return *this; + } + inline DecryptRequest& operator=(DecryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const DecryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const DecryptRequest* internal_default_instance() { + return reinterpret_cast( + &_DecryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 27; + + friend void swap(DecryptRequest& a, DecryptRequest& b) { + a.Swap(&b); + } + inline void Swap(DecryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DecryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DecryptRequest* New() const final { + return new DecryptRequest(); + } + + DecryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const DecryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const DecryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DecryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.DecryptRequest"; + } + protected: + explicit DecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEncryptedDataFieldNumber = 3, + kSignatureFieldNumber = 5, + kMessageIdFieldNumber = 7, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + kCounterFieldNumber = 4, + kIsFirstFieldNumber = 6, + }; + // bytes encryptedData = 3; + void clear_encrypteddata(); + const std::string& encrypteddata() const; + template + void set_encrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_encrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_encrypteddata(); + void set_allocated_encrypteddata(std::string* encrypteddata); + private: + const std::string& _internal_encrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_encrypteddata(const std::string& value); + std::string* _internal_mutable_encrypteddata(); + public: + + // bytes signature = 5; + void clear_signature(); + const std::string& signature() const; + template + void set_signature(ArgT0&& arg0, ArgT... args); + std::string* mutable_signature(); + PROTOBUF_MUST_USE_RESULT std::string* release_signature(); + void set_allocated_signature(std::string* signature); + private: + const std::string& _internal_signature() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_signature(const std::string& value); + std::string* _internal_mutable_signature(); + public: + + // string messageId = 7; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int64 counter = 4; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int64 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // bool isFirst = 6; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // @@protoc_insertion_point(class_scope:crypto.DecryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr encrypteddata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr signature_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + ::PROTOBUF_NAMESPACE_ID::int64 counter_; + bool isfirst_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class DecryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.DecryptResponse) */ { + public: + inline DecryptResponse() : DecryptResponse(nullptr) {} + ~DecryptResponse() override; + explicit constexpr DecryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + DecryptResponse(const DecryptResponse& from); + DecryptResponse(DecryptResponse&& from) noexcept + : DecryptResponse() { + *this = ::std::move(from); + } + + inline DecryptResponse& operator=(const DecryptResponse& from) { + CopyFrom(from); + return *this; + } + inline DecryptResponse& operator=(DecryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const DecryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const DecryptResponse* internal_default_instance() { + return reinterpret_cast( + &_DecryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 28; + + friend void swap(DecryptResponse& a, DecryptResponse& b) { + a.Swap(&b); + } + inline void Swap(DecryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DecryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DecryptResponse* New() const final { + return new DecryptResponse(); + } + + DecryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const DecryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const DecryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DecryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.DecryptResponse"; + } + protected: + explicit DecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDecryptedDataFieldNumber = 1, + }; + // bytes decryptedData = 1; + void clear_decrypteddata(); + const std::string& decrypteddata() const; + template + void set_decrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_decrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_decrypteddata(); + void set_allocated_decrypteddata(std::string* decrypteddata); + private: + const std::string& _internal_decrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_decrypteddata(const std::string& value); + std::string* _internal_mutable_decrypteddata(); + public: + + // @@protoc_insertion_point(class_scope:crypto.DecryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr decrypteddata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AESEncryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AESEncryptRequest) */ { + public: + inline AESEncryptRequest() : AESEncryptRequest(nullptr) {} + ~AESEncryptRequest() override; + explicit constexpr AESEncryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AESEncryptRequest(const AESEncryptRequest& from); + AESEncryptRequest(AESEncryptRequest&& from) noexcept + : AESEncryptRequest() { + *this = ::std::move(from); + } + + inline AESEncryptRequest& operator=(const AESEncryptRequest& from) { + CopyFrom(from); + return *this; + } + inline AESEncryptRequest& operator=(AESEncryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AESEncryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const AESEncryptRequest* internal_default_instance() { + return reinterpret_cast( + &_AESEncryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 29; + + friend void swap(AESEncryptRequest& a, AESEncryptRequest& b) { + a.Swap(&b); + } + inline void Swap(AESEncryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AESEncryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AESEncryptRequest* New() const final { + return new AESEncryptRequest(); + } + + AESEncryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AESEncryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AESEncryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AESEncryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AESEncryptRequest"; + } + protected: + explicit AESEncryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 3, + kKeyIdFieldNumber = 6, + kMessageIdFieldNumber = 10, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + kCounterFieldNumber = 5, + kFuncFieldNumber = 4, + kKeyLengthFieldNumber = 7, + kChainingModeFieldNumber = 8, + kIsFirstFieldNumber = 9, + }; + // bytes data = 3; + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_MUST_USE_RESULT std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // string keyId = 6; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // string messageId = 10; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int64 counter = 5; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int64 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // .crypto.AsymmetricFunction func = 4; + void clear_func(); + ::crypto::AsymmetricFunction func() const; + void set_func(::crypto::AsymmetricFunction value); + private: + ::crypto::AsymmetricFunction _internal_func() const; + void _internal_set_func(::crypto::AsymmetricFunction value); + public: + + // .crypto.AESKeyLength keyLength = 7; + void clear_keylength(); + ::crypto::AESKeyLength keylength() const; + void set_keylength(::crypto::AESKeyLength value); + private: + ::crypto::AESKeyLength _internal_keylength() const; + void _internal_set_keylength(::crypto::AESKeyLength value); + public: + + // .crypto.AESChainingMode chainingMode = 8; + void clear_chainingmode(); + ::crypto::AESChainingMode chainingmode() const; + void set_chainingmode(::crypto::AESChainingMode value); + private: + ::crypto::AESChainingMode _internal_chainingmode() const; + void _internal_set_chainingmode(::crypto::AESChainingMode value); + public: + + // bool isFirst = 9; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // @@protoc_insertion_point(class_scope:crypto.AESEncryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + ::PROTOBUF_NAMESPACE_ID::int64 counter_; + int func_; + int keylength_; + int chainingmode_; + bool isfirst_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AESEncryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AESEncryptResponse) */ { + public: + inline AESEncryptResponse() : AESEncryptResponse(nullptr) {} + ~AESEncryptResponse() override; + explicit constexpr AESEncryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AESEncryptResponse(const AESEncryptResponse& from); + AESEncryptResponse(AESEncryptResponse&& from) noexcept + : AESEncryptResponse() { + *this = ::std::move(from); + } + + inline AESEncryptResponse& operator=(const AESEncryptResponse& from) { + CopyFrom(from); + return *this; + } + inline AESEncryptResponse& operator=(AESEncryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AESEncryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const AESEncryptResponse* internal_default_instance() { + return reinterpret_cast( + &_AESEncryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 30; + + friend void swap(AESEncryptResponse& a, AESEncryptResponse& b) { + a.Swap(&b); + } + inline void Swap(AESEncryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AESEncryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AESEncryptResponse* New() const final { + return new AESEncryptResponse(); + } + + AESEncryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AESEncryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AESEncryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AESEncryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AESEncryptResponse"; + } + protected: + explicit AESEncryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEncryptedDataFieldNumber = 1, + }; + // bytes encryptedData = 1; + void clear_encrypteddata(); + const std::string& encrypteddata() const; + template + void set_encrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_encrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_encrypteddata(); + void set_allocated_encrypteddata(std::string* encrypteddata); + private: + const std::string& _internal_encrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_encrypteddata(const std::string& value); + std::string* _internal_mutable_encrypteddata(); + public: + + // @@protoc_insertion_point(class_scope:crypto.AESEncryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr encrypteddata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AESDecryptRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AESDecryptRequest) */ { + public: + inline AESDecryptRequest() : AESDecryptRequest(nullptr) {} + ~AESDecryptRequest() override; + explicit constexpr AESDecryptRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AESDecryptRequest(const AESDecryptRequest& from); + AESDecryptRequest(AESDecryptRequest&& from) noexcept + : AESDecryptRequest() { + *this = ::std::move(from); + } + + inline AESDecryptRequest& operator=(const AESDecryptRequest& from) { + CopyFrom(from); + return *this; + } + inline AESDecryptRequest& operator=(AESDecryptRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AESDecryptRequest& default_instance() { + return *internal_default_instance(); + } + static inline const AESDecryptRequest* internal_default_instance() { + return reinterpret_cast( + &_AESDecryptRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 31; + + friend void swap(AESDecryptRequest& a, AESDecryptRequest& b) { + a.Swap(&b); + } + inline void Swap(AESDecryptRequest* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AESDecryptRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AESDecryptRequest* New() const final { + return new AESDecryptRequest(); + } + + AESDecryptRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AESDecryptRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AESDecryptRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AESDecryptRequest* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AESDecryptRequest"; + } + protected: + explicit AESDecryptRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataInFieldNumber = 3, + kDataOutFieldNumber = 5, + kKeyIdFieldNumber = 10, + kMessageIdFieldNumber = 12, + kSenderIdFieldNumber = 1, + kReceiverIdFieldNumber = 2, + kInLenFieldNumber = 4, + kFuncFieldNumber = 6, + kKeyLengthFieldNumber = 7, + kChainingModeFieldNumber = 8, + kCounterFieldNumber = 9, + kIsFirstFieldNumber = 11, + kUserIdFieldNumber = 13, + }; + // bytes dataIn = 3; + void clear_datain(); + const std::string& datain() const; + template + void set_datain(ArgT0&& arg0, ArgT... args); + std::string* mutable_datain(); + PROTOBUF_MUST_USE_RESULT std::string* release_datain(); + void set_allocated_datain(std::string* datain); + private: + const std::string& _internal_datain() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_datain(const std::string& value); + std::string* _internal_mutable_datain(); + public: + + // bytes dataOut = 5; + void clear_dataout(); + const std::string& dataout() const; + template + void set_dataout(ArgT0&& arg0, ArgT... args); + std::string* mutable_dataout(); + PROTOBUF_MUST_USE_RESULT std::string* release_dataout(); + void set_allocated_dataout(std::string* dataout); + private: + const std::string& _internal_dataout() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_dataout(const std::string& value); + std::string* _internal_mutable_dataout(); + public: + + // string keyId = 10; + void clear_keyid(); + const std::string& keyid() const; + template + void set_keyid(ArgT0&& arg0, ArgT... args); + std::string* mutable_keyid(); + PROTOBUF_MUST_USE_RESULT std::string* release_keyid(); + void set_allocated_keyid(std::string* keyid); + private: + const std::string& _internal_keyid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_keyid(const std::string& value); + std::string* _internal_mutable_keyid(); + public: + + // string messageId = 12; + void clear_messageid(); + const std::string& messageid() const; + template + void set_messageid(ArgT0&& arg0, ArgT... args); + std::string* mutable_messageid(); + PROTOBUF_MUST_USE_RESULT std::string* release_messageid(); + void set_allocated_messageid(std::string* messageid); + private: + const std::string& _internal_messageid() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_messageid(const std::string& value); + std::string* _internal_mutable_messageid(); + public: + + // int32 senderId = 1; + void clear_senderid(); + ::PROTOBUF_NAMESPACE_ID::int32 senderid() const; + void set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_senderid() const; + void _internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 receiverId = 2; + void clear_receiverid(); + ::PROTOBUF_NAMESPACE_ID::int32 receiverid() const; + void set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_receiverid() const; + void _internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 inLen = 4; + void clear_inlen(); + ::PROTOBUF_NAMESPACE_ID::int32 inlen() const; + void set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_inlen() const; + void _internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // .crypto.AsymmetricFunction func = 6; + void clear_func(); + ::crypto::AsymmetricFunction func() const; + void set_func(::crypto::AsymmetricFunction value); + private: + ::crypto::AsymmetricFunction _internal_func() const; + void _internal_set_func(::crypto::AsymmetricFunction value); + public: + + // .crypto.AESKeyLength keyLength = 7; + void clear_keylength(); + ::crypto::AESKeyLength keylength() const; + void set_keylength(::crypto::AESKeyLength value); + private: + ::crypto::AESKeyLength _internal_keylength() const; + void _internal_set_keylength(::crypto::AESKeyLength value); + public: + + // .crypto.AESChainingMode chainingMode = 8; + void clear_chainingmode(); + ::crypto::AESChainingMode chainingmode() const; + void set_chainingmode(::crypto::AESChainingMode value); + private: + ::crypto::AESChainingMode _internal_chainingmode() const; + void _internal_set_chainingmode(::crypto::AESChainingMode value); + public: + + // int64 counter = 9; + void clear_counter(); + ::PROTOBUF_NAMESPACE_ID::int64 counter() const; + void set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_counter() const; + void _internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // bool isFirst = 11; + void clear_isfirst(); + bool isfirst() const; + void set_isfirst(bool value); + private: + bool _internal_isfirst() const; + void _internal_set_isfirst(bool value); + public: + + // int32 userId = 13; + void clear_userid(); + ::PROTOBUF_NAMESPACE_ID::int32 userid() const; + void set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_userid() const; + void _internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:crypto.AESDecryptRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr datain_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr dataout_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr keyid_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr messageid_; + ::PROTOBUF_NAMESPACE_ID::int32 senderid_; + ::PROTOBUF_NAMESPACE_ID::int32 receiverid_; + ::PROTOBUF_NAMESPACE_ID::int32 inlen_; + int func_; + int keylength_; + int chainingmode_; + ::PROTOBUF_NAMESPACE_ID::int64 counter_; + bool isfirst_; + ::PROTOBUF_NAMESPACE_ID::int32 userid_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// ------------------------------------------------------------------- + +class AESDecryptResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:crypto.AESDecryptResponse) */ { + public: + inline AESDecryptResponse() : AESDecryptResponse(nullptr) {} + ~AESDecryptResponse() override; + explicit constexpr AESDecryptResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AESDecryptResponse(const AESDecryptResponse& from); + AESDecryptResponse(AESDecryptResponse&& from) noexcept + : AESDecryptResponse() { + *this = ::std::move(from); + } + + inline AESDecryptResponse& operator=(const AESDecryptResponse& from) { + CopyFrom(from); + return *this; + } + inline AESDecryptResponse& operator=(AESDecryptResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AESDecryptResponse& default_instance() { + return *internal_default_instance(); + } + static inline const AESDecryptResponse* internal_default_instance() { + return reinterpret_cast( + &_AESDecryptResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 32; + + friend void swap(AESDecryptResponse& a, AESDecryptResponse& b) { + a.Swap(&b); + } + inline void Swap(AESDecryptResponse* other) { + if (other == this) return; + if (GetOwningArena() == other->GetOwningArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AESDecryptResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AESDecryptResponse* New() const final { + return new AESDecryptResponse(); + } + + AESDecryptResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AESDecryptResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const AESDecryptResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AESDecryptResponse* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "crypto.AESDecryptResponse"; + } + protected: + explicit AESDecryptResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDecrypteddataFieldNumber = 1, + }; + // bytes decrypteddata = 1; + void clear_decrypteddata(); + const std::string& decrypteddata() const; + template + void set_decrypteddata(ArgT0&& arg0, ArgT... args); + std::string* mutable_decrypteddata(); + PROTOBUF_MUST_USE_RESULT std::string* release_decrypteddata(); + void set_allocated_decrypteddata(std::string* decrypteddata); + private: + const std::string& _internal_decrypteddata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_decrypteddata(const std::string& value); + std::string* _internal_mutable_decrypteddata(); + public: + + // @@protoc_insertion_point(class_scope:crypto.AESDecryptResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr decrypteddata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fencryption_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// AsymetricEncryptRequest + +// int32 senderId = 1; +inline void AsymetricEncryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricEncryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricEncryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricEncryptRequest.senderId) + return _internal_senderid(); +} +inline void AsymetricEncryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void AsymetricEncryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.AsymetricEncryptRequest.senderId) +} + +// string keyId = 2; +inline void AsymetricEncryptRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& AsymetricEncryptRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricEncryptRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricEncryptRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricEncryptRequest.keyId) +} +inline std::string* AsymetricEncryptRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricEncryptRequest.keyId) + return _s; +} +inline const std::string& AsymetricEncryptRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void AsymetricEncryptRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.AsymetricEncryptRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricEncryptRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricEncryptRequest.keyId) +} + +// bytes data = 3; +inline void AsymetricEncryptRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& AsymetricEncryptRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricEncryptRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricEncryptRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricEncryptRequest.data) +} +inline std::string* AsymetricEncryptRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricEncryptRequest.data) + return _s; +} +inline const std::string& AsymetricEncryptRequest::_internal_data() const { + return data_.Get(); +} +inline void AsymetricEncryptRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.AsymetricEncryptRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricEncryptRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricEncryptRequest.data) +} + +// string messageId = 4; +inline void AsymetricEncryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& AsymetricEncryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricEncryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricEncryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricEncryptRequest.messageId) +} +inline std::string* AsymetricEncryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricEncryptRequest.messageId) + return _s; +} +inline const std::string& AsymetricEncryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void AsymetricEncryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.AsymetricEncryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricEncryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricEncryptRequest.messageId) +} + +// ------------------------------------------------------------------- + +// AsymetricEncryptResponse + +// bytes encryptedData = 1; +inline void AsymetricEncryptResponse::clear_encrypteddata() { + encrypteddata_.ClearToEmpty(); +} +inline const std::string& AsymetricEncryptResponse::encrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricEncryptResponse.encryptedData) + return _internal_encrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricEncryptResponse::set_encrypteddata(ArgT0&& arg0, ArgT... args) { + + encrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricEncryptResponse.encryptedData) +} +inline std::string* AsymetricEncryptResponse::mutable_encrypteddata() { + std::string* _s = _internal_mutable_encrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricEncryptResponse.encryptedData) + return _s; +} +inline const std::string& AsymetricEncryptResponse::_internal_encrypteddata() const { + return encrypteddata_.Get(); +} +inline void AsymetricEncryptResponse::_internal_set_encrypteddata(const std::string& value) { + + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptResponse::_internal_mutable_encrypteddata() { + + return encrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricEncryptResponse::release_encrypteddata() { + // @@protoc_insertion_point(field_release:crypto.AsymetricEncryptResponse.encryptedData) + return encrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricEncryptResponse::set_allocated_encrypteddata(std::string* encrypteddata) { + if (encrypteddata != nullptr) { + + } else { + + } + encrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), encrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricEncryptResponse.encryptedData) +} + +// ------------------------------------------------------------------- + +// AsymetricDecryptRequest + +// int32 senderId = 1; +inline void AsymetricDecryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricDecryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricDecryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptRequest.senderId) + return _internal_senderid(); +} +inline void AsymetricDecryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void AsymetricDecryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptRequest.senderId) +} + +// int32 receiverId = 2; +inline void AsymetricDecryptRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricDecryptRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AsymetricDecryptRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptRequest.receiverId) + return _internal_receiverid(); +} +inline void AsymetricDecryptRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void AsymetricDecryptRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptRequest.receiverId) +} + +// string keyId = 3; +inline void AsymetricDecryptRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& AsymetricDecryptRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricDecryptRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptRequest.keyId) +} +inline std::string* AsymetricDecryptRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricDecryptRequest.keyId) + return _s; +} +inline const std::string& AsymetricDecryptRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void AsymetricDecryptRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.AsymetricDecryptRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricDecryptRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricDecryptRequest.keyId) +} + +// bytes data = 4; +inline void AsymetricDecryptRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& AsymetricDecryptRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricDecryptRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptRequest.data) +} +inline std::string* AsymetricDecryptRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricDecryptRequest.data) + return _s; +} +inline const std::string& AsymetricDecryptRequest::_internal_data() const { + return data_.Get(); +} +inline void AsymetricDecryptRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.AsymetricDecryptRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricDecryptRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricDecryptRequest.data) +} + +// string messageId = 5; +inline void AsymetricDecryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& AsymetricDecryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricDecryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptRequest.messageId) +} +inline std::string* AsymetricDecryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricDecryptRequest.messageId) + return _s; +} +inline const std::string& AsymetricDecryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void AsymetricDecryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.AsymetricDecryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricDecryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricDecryptRequest.messageId) +} + +// ------------------------------------------------------------------- + +// GetHashLengthRequest + +// int32 senderId = 1; +inline void GetHashLengthRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetHashLengthRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetHashLengthRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.GetHashLengthRequest.senderId) + return _internal_senderid(); +} +inline void GetHashLengthRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void GetHashLengthRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.GetHashLengthRequest.senderId) +} + +// .crypto.SHAAlgorithm func = 2; +inline void GetHashLengthRequest::clear_func() { + func_ = 0; +} +inline ::crypto::SHAAlgorithm GetHashLengthRequest::_internal_func() const { + return static_cast< ::crypto::SHAAlgorithm >(func_); +} +inline ::crypto::SHAAlgorithm GetHashLengthRequest::func() const { + // @@protoc_insertion_point(field_get:crypto.GetHashLengthRequest.func) + return _internal_func(); +} +inline void GetHashLengthRequest::_internal_set_func(::crypto::SHAAlgorithm value) { + + func_ = value; +} +inline void GetHashLengthRequest::set_func(::crypto::SHAAlgorithm value) { + _internal_set_func(value); + // @@protoc_insertion_point(field_set:crypto.GetHashLengthRequest.func) +} + +// int32 dataLen = 3; +inline void GetHashLengthRequest::clear_datalen() { + datalen_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetHashLengthRequest::_internal_datalen() const { + return datalen_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetHashLengthRequest::datalen() const { + // @@protoc_insertion_point(field_get:crypto.GetHashLengthRequest.dataLen) + return _internal_datalen(); +} +inline void GetHashLengthRequest::_internal_set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value) { + + datalen_ = value; +} +inline void GetHashLengthRequest::set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_datalen(value); + // @@protoc_insertion_point(field_set:crypto.GetHashLengthRequest.dataLen) +} + +// string messageId = 4; +inline void GetHashLengthRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GetHashLengthRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GetHashLengthRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GetHashLengthRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GetHashLengthRequest.messageId) +} +inline std::string* GetHashLengthRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GetHashLengthRequest.messageId) + return _s; +} +inline const std::string& GetHashLengthRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void GetHashLengthRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GetHashLengthRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GetHashLengthRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GetHashLengthRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GetHashLengthRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GetHashLengthRequest.messageId) +} + +// ------------------------------------------------------------------- + +// GetAESLengthRequest + +// int32 senderId = 1; +inline void GetAESLengthRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetAESLengthRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetAESLengthRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.GetAESLengthRequest.senderId) + return _internal_senderid(); +} +inline void GetAESLengthRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void GetAESLengthRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.GetAESLengthRequest.senderId) +} + +// int32 dataLen = 2; +inline void GetAESLengthRequest::clear_datalen() { + datalen_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetAESLengthRequest::_internal_datalen() const { + return datalen_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetAESLengthRequest::datalen() const { + // @@protoc_insertion_point(field_get:crypto.GetAESLengthRequest.dataLen) + return _internal_datalen(); +} +inline void GetAESLengthRequest::_internal_set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value) { + + datalen_ = value; +} +inline void GetAESLengthRequest::set_datalen(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_datalen(value); + // @@protoc_insertion_point(field_set:crypto.GetAESLengthRequest.dataLen) +} + +// bool isFirst = 3; +inline void GetAESLengthRequest::clear_isfirst() { + isfirst_ = false; +} +inline bool GetAESLengthRequest::_internal_isfirst() const { + return isfirst_; +} +inline bool GetAESLengthRequest::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.GetAESLengthRequest.isFirst) + return _internal_isfirst(); +} +inline void GetAESLengthRequest::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void GetAESLengthRequest::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.GetAESLengthRequest.isFirst) +} + +// .crypto.AESChainingMode chainingMode = 4; +inline void GetAESLengthRequest::clear_chainingmode() { + chainingmode_ = 0; +} +inline ::crypto::AESChainingMode GetAESLengthRequest::_internal_chainingmode() const { + return static_cast< ::crypto::AESChainingMode >(chainingmode_); +} +inline ::crypto::AESChainingMode GetAESLengthRequest::chainingmode() const { + // @@protoc_insertion_point(field_get:crypto.GetAESLengthRequest.chainingMode) + return _internal_chainingmode(); +} +inline void GetAESLengthRequest::_internal_set_chainingmode(::crypto::AESChainingMode value) { + + chainingmode_ = value; +} +inline void GetAESLengthRequest::set_chainingmode(::crypto::AESChainingMode value) { + _internal_set_chainingmode(value); + // @@protoc_insertion_point(field_set:crypto.GetAESLengthRequest.chainingMode) +} + +// string messageId = 5; +inline void GetAESLengthRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GetAESLengthRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GetAESLengthRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GetAESLengthRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GetAESLengthRequest.messageId) +} +inline std::string* GetAESLengthRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GetAESLengthRequest.messageId) + return _s; +} +inline const std::string& GetAESLengthRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void GetAESLengthRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GetAESLengthRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GetAESLengthRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GetAESLengthRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GetAESLengthRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GetAESLengthRequest.messageId) +} + +// ------------------------------------------------------------------- + +// AsymetricDecryptResponse + +// bytes decryptedData = 1; +inline void AsymetricDecryptResponse::clear_decrypteddata() { + decrypteddata_.ClearToEmpty(); +} +inline const std::string& AsymetricDecryptResponse::decrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.AsymetricDecryptResponse.decryptedData) + return _internal_decrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AsymetricDecryptResponse::set_decrypteddata(ArgT0&& arg0, ArgT... args) { + + decrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AsymetricDecryptResponse.decryptedData) +} +inline std::string* AsymetricDecryptResponse::mutable_decrypteddata() { + std::string* _s = _internal_mutable_decrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.AsymetricDecryptResponse.decryptedData) + return _s; +} +inline const std::string& AsymetricDecryptResponse::_internal_decrypteddata() const { + return decrypteddata_.Get(); +} +inline void AsymetricDecryptResponse::_internal_set_decrypteddata(const std::string& value) { + + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptResponse::_internal_mutable_decrypteddata() { + + return decrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AsymetricDecryptResponse::release_decrypteddata() { + // @@protoc_insertion_point(field_release:crypto.AsymetricDecryptResponse.decryptedData) + return decrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AsymetricDecryptResponse::set_allocated_decrypteddata(std::string* decrypteddata) { + if (decrypteddata != nullptr) { + + } else { + + } + decrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), decrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AsymetricDecryptResponse.decryptedData) +} + +// ------------------------------------------------------------------- + +// GetLengthRequest + +// int32 senderId = 1; +inline void GetLengthRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.GetLengthRequest.senderId) + return _internal_senderid(); +} +inline void GetLengthRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void GetLengthRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.GetLengthRequest.senderId) +} + +// int32 inLen = 2; +inline void GetLengthRequest::clear_inlen() { + inlen_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthRequest::_internal_inlen() const { + return inlen_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthRequest::inlen() const { + // @@protoc_insertion_point(field_get:crypto.GetLengthRequest.inLen) + return _internal_inlen(); +} +inline void GetLengthRequest::_internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + + inlen_ = value; +} +inline void GetLengthRequest::set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_inlen(value); + // @@protoc_insertion_point(field_set:crypto.GetLengthRequest.inLen) +} + +// string messageId = 3; +inline void GetLengthRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GetLengthRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GetLengthRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GetLengthRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GetLengthRequest.messageId) +} +inline std::string* GetLengthRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GetLengthRequest.messageId) + return _s; +} +inline const std::string& GetLengthRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void GetLengthRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GetLengthRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GetLengthRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GetLengthRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GetLengthRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GetLengthRequest.messageId) +} + +// ------------------------------------------------------------------- + +// GetLengthResponse + +// int32 len = 1; +inline void GetLengthResponse::clear_len() { + len_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthResponse::_internal_len() const { + return len_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetLengthResponse::len() const { + // @@protoc_insertion_point(field_get:crypto.GetLengthResponse.len) + return _internal_len(); +} +inline void GetLengthResponse::_internal_set_len(::PROTOBUF_NAMESPACE_ID::int32 value) { + + len_ = value; +} +inline void GetLengthResponse::set_len(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_len(value); + // @@protoc_insertion_point(field_set:crypto.GetLengthResponse.len) +} + +// ------------------------------------------------------------------- + +// GetWholeLength + +// int32 senderId = 1; +inline void GetWholeLength::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::senderid() const { + // @@protoc_insertion_point(field_get:crypto.GetWholeLength.senderId) + return _internal_senderid(); +} +inline void GetWholeLength::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void GetWholeLength::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.GetWholeLength.senderId) +} + +// int32 inLen = 2; +inline void GetWholeLength::clear_inlen() { + inlen_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::_internal_inlen() const { + return inlen_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::inlen() const { + // @@protoc_insertion_point(field_get:crypto.GetWholeLength.inLen) + return _internal_inlen(); +} +inline void GetWholeLength::_internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + + inlen_ = value; +} +inline void GetWholeLength::set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_inlen(value); + // @@protoc_insertion_point(field_set:crypto.GetWholeLength.inLen) +} + +// bool isFirst = 3; +inline void GetWholeLength::clear_isfirst() { + isfirst_ = false; +} +inline bool GetWholeLength::_internal_isfirst() const { + return isfirst_; +} +inline bool GetWholeLength::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.GetWholeLength.isFirst) + return _internal_isfirst(); +} +inline void GetWholeLength::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void GetWholeLength::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.GetWholeLength.isFirst) +} + +// string messageId = 4; +inline void GetWholeLength::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GetWholeLength::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GetWholeLength.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GetWholeLength::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GetWholeLength.messageId) +} +inline std::string* GetWholeLength::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GetWholeLength.messageId) + return _s; +} +inline const std::string& GetWholeLength::_internal_messageid() const { + return messageid_.Get(); +} +inline void GetWholeLength::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GetWholeLength::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GetWholeLength::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GetWholeLength.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GetWholeLength::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GetWholeLength.messageId) +} + +// int32 userId = 5; +inline void GetWholeLength::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GetWholeLength::userid() const { + // @@protoc_insertion_point(field_get:crypto.GetWholeLength.userId) + return _internal_userid(); +} +inline void GetWholeLength::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void GetWholeLength::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.GetWholeLength.userId) +} + +// ------------------------------------------------------------------- + +// GenerateAESKeyRequest + +// int32 userId = 1; +inline void GenerateAESKeyRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateAESKeyRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateAESKeyRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyRequest.userId) + return _internal_userid(); +} +inline void GenerateAESKeyRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void GenerateAESKeyRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyRequest.userId) +} + +// repeated .crypto.KeyPermission permissions = 2; +inline int GenerateAESKeyRequest::_internal_permissions_size() const { + return permissions_.size(); +} +inline int GenerateAESKeyRequest::permissions_size() const { + return _internal_permissions_size(); +} +inline void GenerateAESKeyRequest::clear_permissions() { + permissions_.Clear(); +} +inline ::crypto::KeyPermission GenerateAESKeyRequest::_internal_permissions(int index) const { + return static_cast< ::crypto::KeyPermission >(permissions_.Get(index)); +} +inline ::crypto::KeyPermission GenerateAESKeyRequest::permissions(int index) const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyRequest.permissions) + return _internal_permissions(index); +} +inline void GenerateAESKeyRequest::set_permissions(int index, ::crypto::KeyPermission value) { + permissions_.Set(index, value); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyRequest.permissions) +} +inline void GenerateAESKeyRequest::_internal_add_permissions(::crypto::KeyPermission value) { + permissions_.Add(value); +} +inline void GenerateAESKeyRequest::add_permissions(::crypto::KeyPermission value) { + _internal_add_permissions(value); + // @@protoc_insertion_point(field_add:crypto.GenerateAESKeyRequest.permissions) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +GenerateAESKeyRequest::permissions() const { + // @@protoc_insertion_point(field_list:crypto.GenerateAESKeyRequest.permissions) + return permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +GenerateAESKeyRequest::_internal_mutable_permissions() { + return &permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +GenerateAESKeyRequest::mutable_permissions() { + // @@protoc_insertion_point(field_mutable_list:crypto.GenerateAESKeyRequest.permissions) + return _internal_mutable_permissions(); +} + +// .crypto.AESKeyLength keyLength = 3; +inline void GenerateAESKeyRequest::clear_keylength() { + keylength_ = 0; +} +inline ::crypto::AESKeyLength GenerateAESKeyRequest::_internal_keylength() const { + return static_cast< ::crypto::AESKeyLength >(keylength_); +} +inline ::crypto::AESKeyLength GenerateAESKeyRequest::keylength() const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyRequest.keyLength) + return _internal_keylength(); +} +inline void GenerateAESKeyRequest::_internal_set_keylength(::crypto::AESKeyLength value) { + + keylength_ = value; +} +inline void GenerateAESKeyRequest::set_keylength(::crypto::AESKeyLength value) { + _internal_set_keylength(value); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyRequest.keyLength) +} + +// int32 destUserId = 4; +inline void GenerateAESKeyRequest::clear_destuserid() { + destuserid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateAESKeyRequest::_internal_destuserid() const { + return destuserid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateAESKeyRequest::destuserid() const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyRequest.destUserId) + return _internal_destuserid(); +} +inline void GenerateAESKeyRequest::_internal_set_destuserid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + destuserid_ = value; +} +inline void GenerateAESKeyRequest::set_destuserid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_destuserid(value); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyRequest.destUserId) +} + +// string messageId = 5; +inline void GenerateAESKeyRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GenerateAESKeyRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GenerateAESKeyRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyRequest.messageId) +} +inline std::string* GenerateAESKeyRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GenerateAESKeyRequest.messageId) + return _s; +} +inline const std::string& GenerateAESKeyRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void GenerateAESKeyRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GenerateAESKeyRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GenerateAESKeyRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GenerateAESKeyRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GenerateAESKeyRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GenerateAESKeyRequest.messageId) +} + +// ------------------------------------------------------------------- + +// GenerateAESKeyResponse + +// string aesKey = 1; +inline void GenerateAESKeyResponse::clear_aeskey() { + aeskey_.ClearToEmpty(); +} +inline const std::string& GenerateAESKeyResponse::aeskey() const { + // @@protoc_insertion_point(field_get:crypto.GenerateAESKeyResponse.aesKey) + return _internal_aeskey(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GenerateAESKeyResponse::set_aeskey(ArgT0&& arg0, ArgT... args) { + + aeskey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GenerateAESKeyResponse.aesKey) +} +inline std::string* GenerateAESKeyResponse::mutable_aeskey() { + std::string* _s = _internal_mutable_aeskey(); + // @@protoc_insertion_point(field_mutable:crypto.GenerateAESKeyResponse.aesKey) + return _s; +} +inline const std::string& GenerateAESKeyResponse::_internal_aeskey() const { + return aeskey_.Get(); +} +inline void GenerateAESKeyResponse::_internal_set_aeskey(const std::string& value) { + + aeskey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GenerateAESKeyResponse::_internal_mutable_aeskey() { + + return aeskey_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GenerateAESKeyResponse::release_aeskey() { + // @@protoc_insertion_point(field_release:crypto.GenerateAESKeyResponse.aesKey) + return aeskey_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GenerateAESKeyResponse::set_allocated_aeskey(std::string* aeskey) { + if (aeskey != nullptr) { + + } else { + + } + aeskey_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), aeskey, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GenerateAESKeyResponse.aesKey) +} + +// ------------------------------------------------------------------- + +// GenerateKeyPairRequest + +// int32 userId = 1; +inline void GenerateKeyPairRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateKeyPairRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 GenerateKeyPairRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.GenerateKeyPairRequest.userId) + return _internal_userid(); +} +inline void GenerateKeyPairRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void GenerateKeyPairRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.GenerateKeyPairRequest.userId) +} + +// repeated .crypto.KeyPermission permissions = 2; +inline int GenerateKeyPairRequest::_internal_permissions_size() const { + return permissions_.size(); +} +inline int GenerateKeyPairRequest::permissions_size() const { + return _internal_permissions_size(); +} +inline void GenerateKeyPairRequest::clear_permissions() { + permissions_.Clear(); +} +inline ::crypto::KeyPermission GenerateKeyPairRequest::_internal_permissions(int index) const { + return static_cast< ::crypto::KeyPermission >(permissions_.Get(index)); +} +inline ::crypto::KeyPermission GenerateKeyPairRequest::permissions(int index) const { + // @@protoc_insertion_point(field_get:crypto.GenerateKeyPairRequest.permissions) + return _internal_permissions(index); +} +inline void GenerateKeyPairRequest::set_permissions(int index, ::crypto::KeyPermission value) { + permissions_.Set(index, value); + // @@protoc_insertion_point(field_set:crypto.GenerateKeyPairRequest.permissions) +} +inline void GenerateKeyPairRequest::_internal_add_permissions(::crypto::KeyPermission value) { + permissions_.Add(value); +} +inline void GenerateKeyPairRequest::add_permissions(::crypto::KeyPermission value) { + _internal_add_permissions(value); + // @@protoc_insertion_point(field_add:crypto.GenerateKeyPairRequest.permissions) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +GenerateKeyPairRequest::permissions() const { + // @@protoc_insertion_point(field_list:crypto.GenerateKeyPairRequest.permissions) + return permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +GenerateKeyPairRequest::_internal_mutable_permissions() { + return &permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +GenerateKeyPairRequest::mutable_permissions() { + // @@protoc_insertion_point(field_mutable_list:crypto.GenerateKeyPairRequest.permissions) + return _internal_mutable_permissions(); +} + +// string messageId = 3; +inline void GenerateKeyPairRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& GenerateKeyPairRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.GenerateKeyPairRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GenerateKeyPairRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GenerateKeyPairRequest.messageId) +} +inline std::string* GenerateKeyPairRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.GenerateKeyPairRequest.messageId) + return _s; +} +inline const std::string& GenerateKeyPairRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void GenerateKeyPairRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.GenerateKeyPairRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GenerateKeyPairRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GenerateKeyPairRequest.messageId) +} + +// ------------------------------------------------------------------- + +// GenerateKeyPairResponse + +// string publicKey = 1; +inline void GenerateKeyPairResponse::clear_publickey() { + publickey_.ClearToEmpty(); +} +inline const std::string& GenerateKeyPairResponse::publickey() const { + // @@protoc_insertion_point(field_get:crypto.GenerateKeyPairResponse.publicKey) + return _internal_publickey(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GenerateKeyPairResponse::set_publickey(ArgT0&& arg0, ArgT... args) { + + publickey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GenerateKeyPairResponse.publicKey) +} +inline std::string* GenerateKeyPairResponse::mutable_publickey() { + std::string* _s = _internal_mutable_publickey(); + // @@protoc_insertion_point(field_mutable:crypto.GenerateKeyPairResponse.publicKey) + return _s; +} +inline const std::string& GenerateKeyPairResponse::_internal_publickey() const { + return publickey_.Get(); +} +inline void GenerateKeyPairResponse::_internal_set_publickey(const std::string& value) { + + publickey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairResponse::_internal_mutable_publickey() { + + return publickey_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairResponse::release_publickey() { + // @@protoc_insertion_point(field_release:crypto.GenerateKeyPairResponse.publicKey) + return publickey_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GenerateKeyPairResponse::set_allocated_publickey(std::string* publickey) { + if (publickey != nullptr) { + + } else { + + } + publickey_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), publickey, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GenerateKeyPairResponse.publicKey) +} + +// string privateKey = 2; +inline void GenerateKeyPairResponse::clear_privatekey() { + privatekey_.ClearToEmpty(); +} +inline const std::string& GenerateKeyPairResponse::privatekey() const { + // @@protoc_insertion_point(field_get:crypto.GenerateKeyPairResponse.privateKey) + return _internal_privatekey(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void GenerateKeyPairResponse::set_privatekey(ArgT0&& arg0, ArgT... args) { + + privatekey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.GenerateKeyPairResponse.privateKey) +} +inline std::string* GenerateKeyPairResponse::mutable_privatekey() { + std::string* _s = _internal_mutable_privatekey(); + // @@protoc_insertion_point(field_mutable:crypto.GenerateKeyPairResponse.privateKey) + return _s; +} +inline const std::string& GenerateKeyPairResponse::_internal_privatekey() const { + return privatekey_.Get(); +} +inline void GenerateKeyPairResponse::_internal_set_privatekey(const std::string& value) { + + privatekey_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairResponse::_internal_mutable_privatekey() { + + return privatekey_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* GenerateKeyPairResponse::release_privatekey() { + // @@protoc_insertion_point(field_release:crypto.GenerateKeyPairResponse.privateKey) + return privatekey_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void GenerateKeyPairResponse::set_allocated_privatekey(std::string* privatekey) { + if (privatekey != nullptr) { + + } else { + + } + privatekey_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), privatekey, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.GenerateKeyPairResponse.privateKey) +} + +// ------------------------------------------------------------------- + +// SignRequest + +// int32 senderId = 1; +inline void SignRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SignRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SignRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.senderId) + return _internal_senderid(); +} +inline void SignRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void SignRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.SignRequest.senderId) +} + +// bytes data = 2; +inline void SignRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& SignRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SignRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.SignRequest.data) +} +inline std::string* SignRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.SignRequest.data) + return _s; +} +inline const std::string& SignRequest::_internal_data() const { + return data_.Get(); +} +inline void SignRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SignRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SignRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.SignRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void SignRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.SignRequest.data) +} + +// .crypto.SHAAlgorithm hashFunc = 3; +inline void SignRequest::clear_hashfunc() { + hashfunc_ = 0; +} +inline ::crypto::SHAAlgorithm SignRequest::_internal_hashfunc() const { + return static_cast< ::crypto::SHAAlgorithm >(hashfunc_); +} +inline ::crypto::SHAAlgorithm SignRequest::hashfunc() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.hashFunc) + return _internal_hashfunc(); +} +inline void SignRequest::_internal_set_hashfunc(::crypto::SHAAlgorithm value) { + + hashfunc_ = value; +} +inline void SignRequest::set_hashfunc(::crypto::SHAAlgorithm value) { + _internal_set_hashfunc(value); + // @@protoc_insertion_point(field_set:crypto.SignRequest.hashFunc) +} + +// int64 counter = 5; +inline void SignRequest::clear_counter() { + counter_ = int64_t{0}; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 SignRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 SignRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.counter) + return _internal_counter(); +} +inline void SignRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + + counter_ = value; +} +inline void SignRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.SignRequest.counter) +} + +// string keyId = 6; +inline void SignRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& SignRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SignRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.SignRequest.keyId) +} +inline std::string* SignRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.SignRequest.keyId) + return _s; +} +inline const std::string& SignRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void SignRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SignRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SignRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.SignRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void SignRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.SignRequest.keyId) +} + +// string messageId = 7; +inline void SignRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& SignRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.SignRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SignRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.SignRequest.messageId) +} +inline std::string* SignRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.SignRequest.messageId) + return _s; +} +inline const std::string& SignRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void SignRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SignRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SignRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.SignRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void SignRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.SignRequest.messageId) +} + +// ------------------------------------------------------------------- + +// SignResponse + +// bytes signature = 1; +inline void SignResponse::clear_signature() { + signature_.ClearToEmpty(); +} +inline const std::string& SignResponse::signature() const { + // @@protoc_insertion_point(field_get:crypto.SignResponse.signature) + return _internal_signature(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SignResponse::set_signature(ArgT0&& arg0, ArgT... args) { + + signature_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.SignResponse.signature) +} +inline std::string* SignResponse::mutable_signature() { + std::string* _s = _internal_mutable_signature(); + // @@protoc_insertion_point(field_mutable:crypto.SignResponse.signature) + return _s; +} +inline const std::string& SignResponse::_internal_signature() const { + return signature_.Get(); +} +inline void SignResponse::_internal_set_signature(const std::string& value) { + + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SignResponse::_internal_mutable_signature() { + + return signature_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SignResponse::release_signature() { + // @@protoc_insertion_point(field_release:crypto.SignResponse.signature) + return signature_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void SignResponse::set_allocated_signature(std::string* signature) { + if (signature != nullptr) { + + } else { + + } + signature_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), signature, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.SignResponse.signature) +} + +// ------------------------------------------------------------------- + +// VerifyRequest + +// int32 senderId = 1; +inline void VerifyRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.senderId) + return _internal_senderid(); +} +inline void VerifyRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void VerifyRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.senderId) +} + +// int32 receiverId = 2; +inline void VerifyRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.receiverId) + return _internal_receiverid(); +} +inline void VerifyRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void VerifyRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.receiverId) +} + +// bytes data = 3; +inline void VerifyRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& VerifyRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VerifyRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.data) +} +inline std::string* VerifyRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.VerifyRequest.data) + return _s; +} +inline const std::string& VerifyRequest::_internal_data() const { + return data_.Get(); +} +inline void VerifyRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.VerifyRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void VerifyRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.VerifyRequest.data) +} + +// bytes signature = 4; +inline void VerifyRequest::clear_signature() { + signature_.ClearToEmpty(); +} +inline const std::string& VerifyRequest::signature() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.signature) + return _internal_signature(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VerifyRequest::set_signature(ArgT0&& arg0, ArgT... args) { + + signature_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.signature) +} +inline std::string* VerifyRequest::mutable_signature() { + std::string* _s = _internal_mutable_signature(); + // @@protoc_insertion_point(field_mutable:crypto.VerifyRequest.signature) + return _s; +} +inline const std::string& VerifyRequest::_internal_signature() const { + return signature_.Get(); +} +inline void VerifyRequest::_internal_set_signature(const std::string& value) { + + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::_internal_mutable_signature() { + + return signature_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::release_signature() { + // @@protoc_insertion_point(field_release:crypto.VerifyRequest.signature) + return signature_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void VerifyRequest::set_allocated_signature(std::string* signature) { + if (signature != nullptr) { + + } else { + + } + signature_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), signature, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.VerifyRequest.signature) +} + +// .crypto.SHAAlgorithm hashFunc = 5; +inline void VerifyRequest::clear_hashfunc() { + hashfunc_ = 0; +} +inline ::crypto::SHAAlgorithm VerifyRequest::_internal_hashfunc() const { + return static_cast< ::crypto::SHAAlgorithm >(hashfunc_); +} +inline ::crypto::SHAAlgorithm VerifyRequest::hashfunc() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.hashFunc) + return _internal_hashfunc(); +} +inline void VerifyRequest::_internal_set_hashfunc(::crypto::SHAAlgorithm value) { + + hashfunc_ = value; +} +inline void VerifyRequest::set_hashfunc(::crypto::SHAAlgorithm value) { + _internal_set_hashfunc(value); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.hashFunc) +} + +// string keyId = 6; +inline void VerifyRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& VerifyRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VerifyRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.keyId) +} +inline std::string* VerifyRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.VerifyRequest.keyId) + return _s; +} +inline const std::string& VerifyRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void VerifyRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.VerifyRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void VerifyRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.VerifyRequest.keyId) +} + +// int32 counter = 7; +inline void VerifyRequest::clear_counter() { + counter_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 VerifyRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.counter) + return _internal_counter(); +} +inline void VerifyRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int32 value) { + + counter_ = value; +} +inline void VerifyRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.counter) +} + +// string messageId = 8; +inline void VerifyRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& VerifyRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.VerifyRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VerifyRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.VerifyRequest.messageId) +} +inline std::string* VerifyRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.VerifyRequest.messageId) + return _s; +} +inline const std::string& VerifyRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void VerifyRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* VerifyRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.VerifyRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void VerifyRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.VerifyRequest.messageId) +} + +// ------------------------------------------------------------------- + +// VerifyResponse + +// bool valid = 1; +inline void VerifyResponse::clear_valid() { + valid_ = false; +} +inline bool VerifyResponse::_internal_valid() const { + return valid_; +} +inline bool VerifyResponse::valid() const { + // @@protoc_insertion_point(field_get:crypto.VerifyResponse.valid) + return _internal_valid(); +} +inline void VerifyResponse::_internal_set_valid(bool value) { + + valid_ = value; +} +inline void VerifyResponse::set_valid(bool value) { + _internal_set_valid(value); + // @@protoc_insertion_point(field_set:crypto.VerifyResponse.valid) +} + +// bytes out = 2; +inline void VerifyResponse::clear_out() { + out_.ClearToEmpty(); +} +inline const std::string& VerifyResponse::out() const { + // @@protoc_insertion_point(field_get:crypto.VerifyResponse.out) + return _internal_out(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VerifyResponse::set_out(ArgT0&& arg0, ArgT... args) { + + out_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.VerifyResponse.out) +} +inline std::string* VerifyResponse::mutable_out() { + std::string* _s = _internal_mutable_out(); + // @@protoc_insertion_point(field_mutable:crypto.VerifyResponse.out) + return _s; +} +inline const std::string& VerifyResponse::_internal_out() const { + return out_.Get(); +} +inline void VerifyResponse::_internal_set_out(const std::string& value) { + + out_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* VerifyResponse::_internal_mutable_out() { + + return out_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* VerifyResponse::release_out() { + // @@protoc_insertion_point(field_release:crypto.VerifyResponse.out) + return out_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void VerifyResponse::set_allocated_out(std::string* out) { + if (out != nullptr) { + + } else { + + } + out_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), out, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.VerifyResponse.out) +} + +// ------------------------------------------------------------------- + +// KeyRequest + +// int32 senderId = 1; +inline void KeyRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 KeyRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 KeyRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.KeyRequest.senderId) + return _internal_senderid(); +} +inline void KeyRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void KeyRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.KeyRequest.senderId) +} + +// int32 userId = 2; +inline void KeyRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 KeyRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 KeyRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.KeyRequest.userId) + return _internal_userid(); +} +inline void KeyRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void KeyRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.KeyRequest.userId) +} + +// string messageId = 3; +inline void KeyRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& KeyRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.KeyRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void KeyRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.KeyRequest.messageId) +} +inline std::string* KeyRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.KeyRequest.messageId) + return _s; +} +inline const std::string& KeyRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void KeyRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* KeyRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* KeyRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.KeyRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void KeyRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.KeyRequest.messageId) +} + +// ------------------------------------------------------------------- + +// KeyResponse + +// string key = 1; +inline void KeyResponse::clear_key() { + key_.ClearToEmpty(); +} +inline const std::string& KeyResponse::key() const { + // @@protoc_insertion_point(field_get:crypto.KeyResponse.key) + return _internal_key(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void KeyResponse::set_key(ArgT0&& arg0, ArgT... args) { + + key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.KeyResponse.key) +} +inline std::string* KeyResponse::mutable_key() { + std::string* _s = _internal_mutable_key(); + // @@protoc_insertion_point(field_mutable:crypto.KeyResponse.key) + return _s; +} +inline const std::string& KeyResponse::_internal_key() const { + return key_.Get(); +} +inline void KeyResponse::_internal_set_key(const std::string& value) { + + key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* KeyResponse::_internal_mutable_key() { + + return key_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* KeyResponse::release_key() { + // @@protoc_insertion_point(field_release:crypto.KeyResponse.key) + return key_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void KeyResponse::set_allocated_key(std::string* key) { + if (key != nullptr) { + + } else { + + } + key_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), key, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.KeyResponse.key) +} + +// ------------------------------------------------------------------- + +// UserKeyPermissions + +// int32 userId = 1; +inline void UserKeyPermissions::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 UserKeyPermissions::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 UserKeyPermissions::userid() const { + // @@protoc_insertion_point(field_get:crypto.UserKeyPermissions.userId) + return _internal_userid(); +} +inline void UserKeyPermissions::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void UserKeyPermissions::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.UserKeyPermissions.userId) +} + +// repeated .crypto.KeyPermission permissions = 2; +inline int UserKeyPermissions::_internal_permissions_size() const { + return permissions_.size(); +} +inline int UserKeyPermissions::permissions_size() const { + return _internal_permissions_size(); +} +inline void UserKeyPermissions::clear_permissions() { + permissions_.Clear(); +} +inline ::crypto::KeyPermission UserKeyPermissions::_internal_permissions(int index) const { + return static_cast< ::crypto::KeyPermission >(permissions_.Get(index)); +} +inline ::crypto::KeyPermission UserKeyPermissions::permissions(int index) const { + // @@protoc_insertion_point(field_get:crypto.UserKeyPermissions.permissions) + return _internal_permissions(index); +} +inline void UserKeyPermissions::set_permissions(int index, ::crypto::KeyPermission value) { + permissions_.Set(index, value); + // @@protoc_insertion_point(field_set:crypto.UserKeyPermissions.permissions) +} +inline void UserKeyPermissions::_internal_add_permissions(::crypto::KeyPermission value) { + permissions_.Add(value); +} +inline void UserKeyPermissions::add_permissions(::crypto::KeyPermission value) { + _internal_add_permissions(value); + // @@protoc_insertion_point(field_add:crypto.UserKeyPermissions.permissions) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +UserKeyPermissions::permissions() const { + // @@protoc_insertion_point(field_list:crypto.UserKeyPermissions.permissions) + return permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +UserKeyPermissions::_internal_mutable_permissions() { + return &permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +UserKeyPermissions::mutable_permissions() { + // @@protoc_insertion_point(field_mutable_list:crypto.UserKeyPermissions.permissions) + return _internal_mutable_permissions(); +} + +// ------------------------------------------------------------------- + +// BootSystemRequest + +// repeated .crypto.UserKeyPermissions usersIdsPermissions = 1; +inline int BootSystemRequest::_internal_usersidspermissions_size() const { + return usersidspermissions_.size(); +} +inline int BootSystemRequest::usersidspermissions_size() const { + return _internal_usersidspermissions_size(); +} +inline void BootSystemRequest::clear_usersidspermissions() { + usersidspermissions_.Clear(); +} +inline ::crypto::UserKeyPermissions* BootSystemRequest::mutable_usersidspermissions(int index) { + // @@protoc_insertion_point(field_mutable:crypto.BootSystemRequest.usersIdsPermissions) + return usersidspermissions_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::crypto::UserKeyPermissions >* +BootSystemRequest::mutable_usersidspermissions() { + // @@protoc_insertion_point(field_mutable_list:crypto.BootSystemRequest.usersIdsPermissions) + return &usersidspermissions_; +} +inline const ::crypto::UserKeyPermissions& BootSystemRequest::_internal_usersidspermissions(int index) const { + return usersidspermissions_.Get(index); +} +inline const ::crypto::UserKeyPermissions& BootSystemRequest::usersidspermissions(int index) const { + // @@protoc_insertion_point(field_get:crypto.BootSystemRequest.usersIdsPermissions) + return _internal_usersidspermissions(index); +} +inline ::crypto::UserKeyPermissions* BootSystemRequest::_internal_add_usersidspermissions() { + return usersidspermissions_.Add(); +} +inline ::crypto::UserKeyPermissions* BootSystemRequest::add_usersidspermissions() { + ::crypto::UserKeyPermissions* _add = _internal_add_usersidspermissions(); + // @@protoc_insertion_point(field_add:crypto.BootSystemRequest.usersIdsPermissions) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::crypto::UserKeyPermissions >& +BootSystemRequest::usersidspermissions() const { + // @@protoc_insertion_point(field_list:crypto.BootSystemRequest.usersIdsPermissions) + return usersidspermissions_; +} + +// string messageId = 5; +inline void BootSystemRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& BootSystemRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.BootSystemRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void BootSystemRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.BootSystemRequest.messageId) +} +inline std::string* BootSystemRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.BootSystemRequest.messageId) + return _s; +} +inline const std::string& BootSystemRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void BootSystemRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* BootSystemRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* BootSystemRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.BootSystemRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void BootSystemRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.BootSystemRequest.messageId) +} + +// ------------------------------------------------------------------- + +// Empty + +// ------------------------------------------------------------------- + +// CryptoConfig + +// .crypto.SHAAlgorithm hashFunction = 1; +inline void CryptoConfig::clear_hashfunction() { + hashfunction_ = 0; +} +inline ::crypto::SHAAlgorithm CryptoConfig::_internal_hashfunction() const { + return static_cast< ::crypto::SHAAlgorithm >(hashfunction_); +} +inline ::crypto::SHAAlgorithm CryptoConfig::hashfunction() const { + // @@protoc_insertion_point(field_get:crypto.CryptoConfig.hashFunction) + return _internal_hashfunction(); +} +inline void CryptoConfig::_internal_set_hashfunction(::crypto::SHAAlgorithm value) { + + hashfunction_ = value; +} +inline void CryptoConfig::set_hashfunction(::crypto::SHAAlgorithm value) { + _internal_set_hashfunction(value); + // @@protoc_insertion_point(field_set:crypto.CryptoConfig.hashFunction) +} + +// .crypto.AESKeyLength aesKeyLength = 2; +inline void CryptoConfig::clear_aeskeylength() { + aeskeylength_ = 0; +} +inline ::crypto::AESKeyLength CryptoConfig::_internal_aeskeylength() const { + return static_cast< ::crypto::AESKeyLength >(aeskeylength_); +} +inline ::crypto::AESKeyLength CryptoConfig::aeskeylength() const { + // @@protoc_insertion_point(field_get:crypto.CryptoConfig.aesKeyLength) + return _internal_aeskeylength(); +} +inline void CryptoConfig::_internal_set_aeskeylength(::crypto::AESKeyLength value) { + + aeskeylength_ = value; +} +inline void CryptoConfig::set_aeskeylength(::crypto::AESKeyLength value) { + _internal_set_aeskeylength(value); + // @@protoc_insertion_point(field_set:crypto.CryptoConfig.aesKeyLength) +} + +// .crypto.AESChainingMode aesChainingMode = 3; +inline void CryptoConfig::clear_aeschainingmode() { + aeschainingmode_ = 0; +} +inline ::crypto::AESChainingMode CryptoConfig::_internal_aeschainingmode() const { + return static_cast< ::crypto::AESChainingMode >(aeschainingmode_); +} +inline ::crypto::AESChainingMode CryptoConfig::aeschainingmode() const { + // @@protoc_insertion_point(field_get:crypto.CryptoConfig.aesChainingMode) + return _internal_aeschainingmode(); +} +inline void CryptoConfig::_internal_set_aeschainingmode(::crypto::AESChainingMode value) { + + aeschainingmode_ = value; +} +inline void CryptoConfig::set_aeschainingmode(::crypto::AESChainingMode value) { + _internal_set_aeschainingmode(value); + // @@protoc_insertion_point(field_set:crypto.CryptoConfig.aesChainingMode) +} + +// .crypto.AsymmetricFunction asymmetricFunction = 4; +inline void CryptoConfig::clear_asymmetricfunction() { + asymmetricfunction_ = 0; +} +inline ::crypto::AsymmetricFunction CryptoConfig::_internal_asymmetricfunction() const { + return static_cast< ::crypto::AsymmetricFunction >(asymmetricfunction_); +} +inline ::crypto::AsymmetricFunction CryptoConfig::asymmetricfunction() const { + // @@protoc_insertion_point(field_get:crypto.CryptoConfig.asymmetricFunction) + return _internal_asymmetricfunction(); +} +inline void CryptoConfig::_internal_set_asymmetricfunction(::crypto::AsymmetricFunction value) { + + asymmetricfunction_ = value; +} +inline void CryptoConfig::set_asymmetricfunction(::crypto::AsymmetricFunction value) { + _internal_set_asymmetricfunction(value); + // @@protoc_insertion_point(field_set:crypto.CryptoConfig.asymmetricFunction) +} + +// string messageId = 5; +inline void CryptoConfig::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& CryptoConfig::messageid() const { + // @@protoc_insertion_point(field_get:crypto.CryptoConfig.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void CryptoConfig::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.CryptoConfig.messageId) +} +inline std::string* CryptoConfig::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.CryptoConfig.messageId) + return _s; +} +inline const std::string& CryptoConfig::_internal_messageid() const { + return messageid_.Get(); +} +inline void CryptoConfig::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* CryptoConfig::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* CryptoConfig::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.CryptoConfig.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void CryptoConfig::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.CryptoConfig.messageId) +} + +// ------------------------------------------------------------------- + +// ConfigureRequest + +// int32 userId = 1; +inline void ConfigureRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConfigureRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConfigureRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.ConfigureRequest.userId) + return _internal_userid(); +} +inline void ConfigureRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void ConfigureRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.ConfigureRequest.userId) +} + +// .crypto.CryptoConfig config = 2; +inline bool ConfigureRequest::_internal_has_config() const { + return this != internal_default_instance() && config_ != nullptr; +} +inline bool ConfigureRequest::has_config() const { + return _internal_has_config(); +} +inline void ConfigureRequest::clear_config() { + if (GetArenaForAllocation() == nullptr && config_ != nullptr) { + delete config_; + } + config_ = nullptr; +} +inline const ::crypto::CryptoConfig& ConfigureRequest::_internal_config() const { + const ::crypto::CryptoConfig* p = config_; + return p != nullptr ? *p : reinterpret_cast( + ::crypto::_CryptoConfig_default_instance_); +} +inline const ::crypto::CryptoConfig& ConfigureRequest::config() const { + // @@protoc_insertion_point(field_get:crypto.ConfigureRequest.config) + return _internal_config(); +} +inline void ConfigureRequest::unsafe_arena_set_allocated_config( + ::crypto::CryptoConfig* config) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(config_); + } + config_ = config; + if (config) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:crypto.ConfigureRequest.config) +} +inline ::crypto::CryptoConfig* ConfigureRequest::release_config() { + + ::crypto::CryptoConfig* temp = config_; + config_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::crypto::CryptoConfig* ConfigureRequest::unsafe_arena_release_config() { + // @@protoc_insertion_point(field_release:crypto.ConfigureRequest.config) + + ::crypto::CryptoConfig* temp = config_; + config_ = nullptr; + return temp; +} +inline ::crypto::CryptoConfig* ConfigureRequest::_internal_mutable_config() { + + if (config_ == nullptr) { + auto* p = CreateMaybeMessage<::crypto::CryptoConfig>(GetArenaForAllocation()); + config_ = p; + } + return config_; +} +inline ::crypto::CryptoConfig* ConfigureRequest::mutable_config() { + ::crypto::CryptoConfig* _msg = _internal_mutable_config(); + // @@protoc_insertion_point(field_mutable:crypto.ConfigureRequest.config) + return _msg; +} +inline void ConfigureRequest::set_allocated_config(::crypto::CryptoConfig* config) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete config_; + } + if (config) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::crypto::CryptoConfig>::GetOwningArena(config); + if (message_arena != submessage_arena) { + config = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, config, submessage_arena); + } + + } else { + + } + config_ = config; + // @@protoc_insertion_point(field_set_allocated:crypto.ConfigureRequest.config) +} + +// string messageId = 3; +inline void ConfigureRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& ConfigureRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.ConfigureRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ConfigureRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.ConfigureRequest.messageId) +} +inline std::string* ConfigureRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.ConfigureRequest.messageId) + return _s; +} +inline const std::string& ConfigureRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void ConfigureRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* ConfigureRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* ConfigureRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.ConfigureRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void ConfigureRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.ConfigureRequest.messageId) +} + +// ------------------------------------------------------------------- + +// AddProcessRequest + +// int32 userId = 1; +inline void AddProcessRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AddProcessRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AddProcessRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.AddProcessRequest.userId) + return _internal_userid(); +} +inline void AddProcessRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void AddProcessRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.AddProcessRequest.userId) +} + +// repeated .crypto.KeyPermission permissions = 2; +inline int AddProcessRequest::_internal_permissions_size() const { + return permissions_.size(); +} +inline int AddProcessRequest::permissions_size() const { + return _internal_permissions_size(); +} +inline void AddProcessRequest::clear_permissions() { + permissions_.Clear(); +} +inline ::crypto::KeyPermission AddProcessRequest::_internal_permissions(int index) const { + return static_cast< ::crypto::KeyPermission >(permissions_.Get(index)); +} +inline ::crypto::KeyPermission AddProcessRequest::permissions(int index) const { + // @@protoc_insertion_point(field_get:crypto.AddProcessRequest.permissions) + return _internal_permissions(index); +} +inline void AddProcessRequest::set_permissions(int index, ::crypto::KeyPermission value) { + permissions_.Set(index, value); + // @@protoc_insertion_point(field_set:crypto.AddProcessRequest.permissions) +} +inline void AddProcessRequest::_internal_add_permissions(::crypto::KeyPermission value) { + permissions_.Add(value); +} +inline void AddProcessRequest::add_permissions(::crypto::KeyPermission value) { + _internal_add_permissions(value); + // @@protoc_insertion_point(field_add:crypto.AddProcessRequest.permissions) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +AddProcessRequest::permissions() const { + // @@protoc_insertion_point(field_list:crypto.AddProcessRequest.permissions) + return permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +AddProcessRequest::_internal_mutable_permissions() { + return &permissions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +AddProcessRequest::mutable_permissions() { + // @@protoc_insertion_point(field_mutable_list:crypto.AddProcessRequest.permissions) + return _internal_mutable_permissions(); +} + +// string messageId = 4; +inline void AddProcessRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& AddProcessRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.AddProcessRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AddProcessRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AddProcessRequest.messageId) +} +inline std::string* AddProcessRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.AddProcessRequest.messageId) + return _s; +} +inline const std::string& AddProcessRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void AddProcessRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AddProcessRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AddProcessRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.AddProcessRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AddProcessRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AddProcessRequest.messageId) +} + +// ------------------------------------------------------------------- + +// EncryptRequest + +// int32 senderId = 1; +inline void EncryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 EncryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 EncryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.senderId) + return _internal_senderid(); +} +inline void EncryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void EncryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.senderId) +} + +// int32 receiverId = 2; +inline void EncryptRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 EncryptRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 EncryptRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.receiverId) + return _internal_receiverid(); +} +inline void EncryptRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void EncryptRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.receiverId) +} + +// bytes data = 3; +inline void EncryptRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& EncryptRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void EncryptRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.data) +} +inline std::string* EncryptRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.EncryptRequest.data) + return _s; +} +inline const std::string& EncryptRequest::_internal_data() const { + return data_.Get(); +} +inline void EncryptRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* EncryptRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* EncryptRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.EncryptRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void EncryptRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.EncryptRequest.data) +} + +// int64 counter = 4; +inline void EncryptRequest::clear_counter() { + counter_ = int64_t{0}; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 EncryptRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 EncryptRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.counter) + return _internal_counter(); +} +inline void EncryptRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + + counter_ = value; +} +inline void EncryptRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.counter) +} + +// bool isFirst = 5; +inline void EncryptRequest::clear_isfirst() { + isfirst_ = false; +} +inline bool EncryptRequest::_internal_isfirst() const { + return isfirst_; +} +inline bool EncryptRequest::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.isFirst) + return _internal_isfirst(); +} +inline void EncryptRequest::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void EncryptRequest::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.isFirst) +} + +// string messageId = 6; +inline void EncryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& EncryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.EncryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void EncryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.EncryptRequest.messageId) +} +inline std::string* EncryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.EncryptRequest.messageId) + return _s; +} +inline const std::string& EncryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void EncryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* EncryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* EncryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.EncryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void EncryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.EncryptRequest.messageId) +} + +// ------------------------------------------------------------------- + +// EncryptResponse + +// bytes encryptedData = 1; +inline void EncryptResponse::clear_encrypteddata() { + encrypteddata_.ClearToEmpty(); +} +inline const std::string& EncryptResponse::encrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.EncryptResponse.encryptedData) + return _internal_encrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void EncryptResponse::set_encrypteddata(ArgT0&& arg0, ArgT... args) { + + encrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.EncryptResponse.encryptedData) +} +inline std::string* EncryptResponse::mutable_encrypteddata() { + std::string* _s = _internal_mutable_encrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.EncryptResponse.encryptedData) + return _s; +} +inline const std::string& EncryptResponse::_internal_encrypteddata() const { + return encrypteddata_.Get(); +} +inline void EncryptResponse::_internal_set_encrypteddata(const std::string& value) { + + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* EncryptResponse::_internal_mutable_encrypteddata() { + + return encrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* EncryptResponse::release_encrypteddata() { + // @@protoc_insertion_point(field_release:crypto.EncryptResponse.encryptedData) + return encrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void EncryptResponse::set_allocated_encrypteddata(std::string* encrypteddata) { + if (encrypteddata != nullptr) { + + } else { + + } + encrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), encrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.EncryptResponse.encryptedData) +} + +// bytes signature = 2; +inline void EncryptResponse::clear_signature() { + signature_.ClearToEmpty(); +} +inline const std::string& EncryptResponse::signature() const { + // @@protoc_insertion_point(field_get:crypto.EncryptResponse.signature) + return _internal_signature(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void EncryptResponse::set_signature(ArgT0&& arg0, ArgT... args) { + + signature_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.EncryptResponse.signature) +} +inline std::string* EncryptResponse::mutable_signature() { + std::string* _s = _internal_mutable_signature(); + // @@protoc_insertion_point(field_mutable:crypto.EncryptResponse.signature) + return _s; +} +inline const std::string& EncryptResponse::_internal_signature() const { + return signature_.Get(); +} +inline void EncryptResponse::_internal_set_signature(const std::string& value) { + + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* EncryptResponse::_internal_mutable_signature() { + + return signature_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* EncryptResponse::release_signature() { + // @@protoc_insertion_point(field_release:crypto.EncryptResponse.signature) + return signature_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void EncryptResponse::set_allocated_signature(std::string* signature) { + if (signature != nullptr) { + + } else { + + } + signature_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), signature, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.EncryptResponse.signature) +} + +// ------------------------------------------------------------------- + +// DecryptRequest + +// int32 senderId = 1; +inline void DecryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 DecryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 DecryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.senderId) + return _internal_senderid(); +} +inline void DecryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void DecryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.senderId) +} + +// int32 receiverId = 2; +inline void DecryptRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 DecryptRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 DecryptRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.receiverId) + return _internal_receiverid(); +} +inline void DecryptRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void DecryptRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.receiverId) +} + +// bytes encryptedData = 3; +inline void DecryptRequest::clear_encrypteddata() { + encrypteddata_.ClearToEmpty(); +} +inline const std::string& DecryptRequest::encrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.encryptedData) + return _internal_encrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void DecryptRequest::set_encrypteddata(ArgT0&& arg0, ArgT... args) { + + encrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.encryptedData) +} +inline std::string* DecryptRequest::mutable_encrypteddata() { + std::string* _s = _internal_mutable_encrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.DecryptRequest.encryptedData) + return _s; +} +inline const std::string& DecryptRequest::_internal_encrypteddata() const { + return encrypteddata_.Get(); +} +inline void DecryptRequest::_internal_set_encrypteddata(const std::string& value) { + + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::_internal_mutable_encrypteddata() { + + return encrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::release_encrypteddata() { + // @@protoc_insertion_point(field_release:crypto.DecryptRequest.encryptedData) + return encrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void DecryptRequest::set_allocated_encrypteddata(std::string* encrypteddata) { + if (encrypteddata != nullptr) { + + } else { + + } + encrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), encrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.DecryptRequest.encryptedData) +} + +// int64 counter = 4; +inline void DecryptRequest::clear_counter() { + counter_ = int64_t{0}; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 DecryptRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 DecryptRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.counter) + return _internal_counter(); +} +inline void DecryptRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + + counter_ = value; +} +inline void DecryptRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.counter) +} + +// bytes signature = 5; +inline void DecryptRequest::clear_signature() { + signature_.ClearToEmpty(); +} +inline const std::string& DecryptRequest::signature() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.signature) + return _internal_signature(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void DecryptRequest::set_signature(ArgT0&& arg0, ArgT... args) { + + signature_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.signature) +} +inline std::string* DecryptRequest::mutable_signature() { + std::string* _s = _internal_mutable_signature(); + // @@protoc_insertion_point(field_mutable:crypto.DecryptRequest.signature) + return _s; +} +inline const std::string& DecryptRequest::_internal_signature() const { + return signature_.Get(); +} +inline void DecryptRequest::_internal_set_signature(const std::string& value) { + + signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::_internal_mutable_signature() { + + return signature_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::release_signature() { + // @@protoc_insertion_point(field_release:crypto.DecryptRequest.signature) + return signature_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void DecryptRequest::set_allocated_signature(std::string* signature) { + if (signature != nullptr) { + + } else { + + } + signature_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), signature, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.DecryptRequest.signature) +} + +// bool isFirst = 6; +inline void DecryptRequest::clear_isfirst() { + isfirst_ = false; +} +inline bool DecryptRequest::_internal_isfirst() const { + return isfirst_; +} +inline bool DecryptRequest::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.isFirst) + return _internal_isfirst(); +} +inline void DecryptRequest::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void DecryptRequest::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.isFirst) +} + +// string messageId = 7; +inline void DecryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& DecryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.DecryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void DecryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.DecryptRequest.messageId) +} +inline std::string* DecryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.DecryptRequest.messageId) + return _s; +} +inline const std::string& DecryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void DecryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* DecryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.DecryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void DecryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.DecryptRequest.messageId) +} + +// ------------------------------------------------------------------- + +// DecryptResponse + +// bytes decryptedData = 1; +inline void DecryptResponse::clear_decrypteddata() { + decrypteddata_.ClearToEmpty(); +} +inline const std::string& DecryptResponse::decrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.DecryptResponse.decryptedData) + return _internal_decrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void DecryptResponse::set_decrypteddata(ArgT0&& arg0, ArgT... args) { + + decrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.DecryptResponse.decryptedData) +} +inline std::string* DecryptResponse::mutable_decrypteddata() { + std::string* _s = _internal_mutable_decrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.DecryptResponse.decryptedData) + return _s; +} +inline const std::string& DecryptResponse::_internal_decrypteddata() const { + return decrypteddata_.Get(); +} +inline void DecryptResponse::_internal_set_decrypteddata(const std::string& value) { + + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* DecryptResponse::_internal_mutable_decrypteddata() { + + return decrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* DecryptResponse::release_decrypteddata() { + // @@protoc_insertion_point(field_release:crypto.DecryptResponse.decryptedData) + return decrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void DecryptResponse::set_allocated_decrypteddata(std::string* decrypteddata) { + if (decrypteddata != nullptr) { + + } else { + + } + decrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), decrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.DecryptResponse.decryptedData) +} + +// ------------------------------------------------------------------- + +// AESEncryptRequest + +// int32 senderId = 1; +inline void AESEncryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESEncryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESEncryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.senderId) + return _internal_senderid(); +} +inline void AESEncryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void AESEncryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.senderId) +} + +// int32 receiverId = 2; +inline void AESEncryptRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESEncryptRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESEncryptRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.receiverId) + return _internal_receiverid(); +} +inline void AESEncryptRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void AESEncryptRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.receiverId) +} + +// bytes data = 3; +inline void AESEncryptRequest::clear_data() { + data_.ClearToEmpty(); +} +inline const std::string& AESEncryptRequest::data() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESEncryptRequest::set_data(ArgT0&& arg0, ArgT... args) { + + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.data) +} +inline std::string* AESEncryptRequest::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:crypto.AESEncryptRequest.data) + return _s; +} +inline const std::string& AESEncryptRequest::_internal_data() const { + return data_.Get(); +} +inline void AESEncryptRequest::_internal_set_data(const std::string& value) { + + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::_internal_mutable_data() { + + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::release_data() { + // @@protoc_insertion_point(field_release:crypto.AESEncryptRequest.data) + return data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESEncryptRequest::set_allocated_data(std::string* data) { + if (data != nullptr) { + + } else { + + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESEncryptRequest.data) +} + +// .crypto.AsymmetricFunction func = 4; +inline void AESEncryptRequest::clear_func() { + func_ = 0; +} +inline ::crypto::AsymmetricFunction AESEncryptRequest::_internal_func() const { + return static_cast< ::crypto::AsymmetricFunction >(func_); +} +inline ::crypto::AsymmetricFunction AESEncryptRequest::func() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.func) + return _internal_func(); +} +inline void AESEncryptRequest::_internal_set_func(::crypto::AsymmetricFunction value) { + + func_ = value; +} +inline void AESEncryptRequest::set_func(::crypto::AsymmetricFunction value) { + _internal_set_func(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.func) +} + +// int64 counter = 5; +inline void AESEncryptRequest::clear_counter() { + counter_ = int64_t{0}; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 AESEncryptRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 AESEncryptRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.counter) + return _internal_counter(); +} +inline void AESEncryptRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + + counter_ = value; +} +inline void AESEncryptRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.counter) +} + +// string keyId = 6; +inline void AESEncryptRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& AESEncryptRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESEncryptRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.keyId) +} +inline std::string* AESEncryptRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.AESEncryptRequest.keyId) + return _s; +} +inline const std::string& AESEncryptRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void AESEncryptRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.AESEncryptRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESEncryptRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESEncryptRequest.keyId) +} + +// .crypto.AESKeyLength keyLength = 7; +inline void AESEncryptRequest::clear_keylength() { + keylength_ = 0; +} +inline ::crypto::AESKeyLength AESEncryptRequest::_internal_keylength() const { + return static_cast< ::crypto::AESKeyLength >(keylength_); +} +inline ::crypto::AESKeyLength AESEncryptRequest::keylength() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.keyLength) + return _internal_keylength(); +} +inline void AESEncryptRequest::_internal_set_keylength(::crypto::AESKeyLength value) { + + keylength_ = value; +} +inline void AESEncryptRequest::set_keylength(::crypto::AESKeyLength value) { + _internal_set_keylength(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.keyLength) +} + +// .crypto.AESChainingMode chainingMode = 8; +inline void AESEncryptRequest::clear_chainingmode() { + chainingmode_ = 0; +} +inline ::crypto::AESChainingMode AESEncryptRequest::_internal_chainingmode() const { + return static_cast< ::crypto::AESChainingMode >(chainingmode_); +} +inline ::crypto::AESChainingMode AESEncryptRequest::chainingmode() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.chainingMode) + return _internal_chainingmode(); +} +inline void AESEncryptRequest::_internal_set_chainingmode(::crypto::AESChainingMode value) { + + chainingmode_ = value; +} +inline void AESEncryptRequest::set_chainingmode(::crypto::AESChainingMode value) { + _internal_set_chainingmode(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.chainingMode) +} + +// bool isFirst = 9; +inline void AESEncryptRequest::clear_isfirst() { + isfirst_ = false; +} +inline bool AESEncryptRequest::_internal_isfirst() const { + return isfirst_; +} +inline bool AESEncryptRequest::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.isFirst) + return _internal_isfirst(); +} +inline void AESEncryptRequest::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void AESEncryptRequest::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.isFirst) +} + +// string messageId = 10; +inline void AESEncryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& AESEncryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESEncryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESEncryptRequest.messageId) +} +inline std::string* AESEncryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.AESEncryptRequest.messageId) + return _s; +} +inline const std::string& AESEncryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void AESEncryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESEncryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.AESEncryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESEncryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESEncryptRequest.messageId) +} + +// ------------------------------------------------------------------- + +// AESEncryptResponse + +// bytes encryptedData = 1; +inline void AESEncryptResponse::clear_encrypteddata() { + encrypteddata_.ClearToEmpty(); +} +inline const std::string& AESEncryptResponse::encrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.AESEncryptResponse.encryptedData) + return _internal_encrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESEncryptResponse::set_encrypteddata(ArgT0&& arg0, ArgT... args) { + + encrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESEncryptResponse.encryptedData) +} +inline std::string* AESEncryptResponse::mutable_encrypteddata() { + std::string* _s = _internal_mutable_encrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.AESEncryptResponse.encryptedData) + return _s; +} +inline const std::string& AESEncryptResponse::_internal_encrypteddata() const { + return encrypteddata_.Get(); +} +inline void AESEncryptResponse::_internal_set_encrypteddata(const std::string& value) { + + encrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESEncryptResponse::_internal_mutable_encrypteddata() { + + return encrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESEncryptResponse::release_encrypteddata() { + // @@protoc_insertion_point(field_release:crypto.AESEncryptResponse.encryptedData) + return encrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESEncryptResponse::set_allocated_encrypteddata(std::string* encrypteddata) { + if (encrypteddata != nullptr) { + + } else { + + } + encrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), encrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESEncryptResponse.encryptedData) +} + +// ------------------------------------------------------------------- + +// AESDecryptRequest + +// int32 senderId = 1; +inline void AESDecryptRequest::clear_senderid() { + senderid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::_internal_senderid() const { + return senderid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::senderid() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.senderId) + return _internal_senderid(); +} +inline void AESDecryptRequest::_internal_set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + senderid_ = value; +} +inline void AESDecryptRequest::set_senderid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_senderid(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.senderId) +} + +// int32 receiverId = 2; +inline void AESDecryptRequest::clear_receiverid() { + receiverid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::_internal_receiverid() const { + return receiverid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::receiverid() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.receiverId) + return _internal_receiverid(); +} +inline void AESDecryptRequest::_internal_set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + receiverid_ = value; +} +inline void AESDecryptRequest::set_receiverid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_receiverid(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.receiverId) +} + +// bytes dataIn = 3; +inline void AESDecryptRequest::clear_datain() { + datain_.ClearToEmpty(); +} +inline const std::string& AESDecryptRequest::datain() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.dataIn) + return _internal_datain(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESDecryptRequest::set_datain(ArgT0&& arg0, ArgT... args) { + + datain_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.dataIn) +} +inline std::string* AESDecryptRequest::mutable_datain() { + std::string* _s = _internal_mutable_datain(); + // @@protoc_insertion_point(field_mutable:crypto.AESDecryptRequest.dataIn) + return _s; +} +inline const std::string& AESDecryptRequest::_internal_datain() const { + return datain_.Get(); +} +inline void AESDecryptRequest::_internal_set_datain(const std::string& value) { + + datain_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::_internal_mutable_datain() { + + return datain_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::release_datain() { + // @@protoc_insertion_point(field_release:crypto.AESDecryptRequest.dataIn) + return datain_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESDecryptRequest::set_allocated_datain(std::string* datain) { + if (datain != nullptr) { + + } else { + + } + datain_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), datain, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESDecryptRequest.dataIn) +} + +// int32 inLen = 4; +inline void AESDecryptRequest::clear_inlen() { + inlen_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::_internal_inlen() const { + return inlen_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::inlen() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.inLen) + return _internal_inlen(); +} +inline void AESDecryptRequest::_internal_set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + + inlen_ = value; +} +inline void AESDecryptRequest::set_inlen(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_inlen(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.inLen) +} + +// bytes dataOut = 5; +inline void AESDecryptRequest::clear_dataout() { + dataout_.ClearToEmpty(); +} +inline const std::string& AESDecryptRequest::dataout() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.dataOut) + return _internal_dataout(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESDecryptRequest::set_dataout(ArgT0&& arg0, ArgT... args) { + + dataout_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.dataOut) +} +inline std::string* AESDecryptRequest::mutable_dataout() { + std::string* _s = _internal_mutable_dataout(); + // @@protoc_insertion_point(field_mutable:crypto.AESDecryptRequest.dataOut) + return _s; +} +inline const std::string& AESDecryptRequest::_internal_dataout() const { + return dataout_.Get(); +} +inline void AESDecryptRequest::_internal_set_dataout(const std::string& value) { + + dataout_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::_internal_mutable_dataout() { + + return dataout_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::release_dataout() { + // @@protoc_insertion_point(field_release:crypto.AESDecryptRequest.dataOut) + return dataout_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESDecryptRequest::set_allocated_dataout(std::string* dataout) { + if (dataout != nullptr) { + + } else { + + } + dataout_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), dataout, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESDecryptRequest.dataOut) +} + +// .crypto.AsymmetricFunction func = 6; +inline void AESDecryptRequest::clear_func() { + func_ = 0; +} +inline ::crypto::AsymmetricFunction AESDecryptRequest::_internal_func() const { + return static_cast< ::crypto::AsymmetricFunction >(func_); +} +inline ::crypto::AsymmetricFunction AESDecryptRequest::func() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.func) + return _internal_func(); +} +inline void AESDecryptRequest::_internal_set_func(::crypto::AsymmetricFunction value) { + + func_ = value; +} +inline void AESDecryptRequest::set_func(::crypto::AsymmetricFunction value) { + _internal_set_func(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.func) +} + +// .crypto.AESKeyLength keyLength = 7; +inline void AESDecryptRequest::clear_keylength() { + keylength_ = 0; +} +inline ::crypto::AESKeyLength AESDecryptRequest::_internal_keylength() const { + return static_cast< ::crypto::AESKeyLength >(keylength_); +} +inline ::crypto::AESKeyLength AESDecryptRequest::keylength() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.keyLength) + return _internal_keylength(); +} +inline void AESDecryptRequest::_internal_set_keylength(::crypto::AESKeyLength value) { + + keylength_ = value; +} +inline void AESDecryptRequest::set_keylength(::crypto::AESKeyLength value) { + _internal_set_keylength(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.keyLength) +} + +// .crypto.AESChainingMode chainingMode = 8; +inline void AESDecryptRequest::clear_chainingmode() { + chainingmode_ = 0; +} +inline ::crypto::AESChainingMode AESDecryptRequest::_internal_chainingmode() const { + return static_cast< ::crypto::AESChainingMode >(chainingmode_); +} +inline ::crypto::AESChainingMode AESDecryptRequest::chainingmode() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.chainingMode) + return _internal_chainingmode(); +} +inline void AESDecryptRequest::_internal_set_chainingmode(::crypto::AESChainingMode value) { + + chainingmode_ = value; +} +inline void AESDecryptRequest::set_chainingmode(::crypto::AESChainingMode value) { + _internal_set_chainingmode(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.chainingMode) +} + +// int64 counter = 9; +inline void AESDecryptRequest::clear_counter() { + counter_ = int64_t{0}; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 AESDecryptRequest::_internal_counter() const { + return counter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 AESDecryptRequest::counter() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.counter) + return _internal_counter(); +} +inline void AESDecryptRequest::_internal_set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + + counter_ = value; +} +inline void AESDecryptRequest::set_counter(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_counter(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.counter) +} + +// string keyId = 10; +inline void AESDecryptRequest::clear_keyid() { + keyid_.ClearToEmpty(); +} +inline const std::string& AESDecryptRequest::keyid() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.keyId) + return _internal_keyid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESDecryptRequest::set_keyid(ArgT0&& arg0, ArgT... args) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.keyId) +} +inline std::string* AESDecryptRequest::mutable_keyid() { + std::string* _s = _internal_mutable_keyid(); + // @@protoc_insertion_point(field_mutable:crypto.AESDecryptRequest.keyId) + return _s; +} +inline const std::string& AESDecryptRequest::_internal_keyid() const { + return keyid_.Get(); +} +inline void AESDecryptRequest::_internal_set_keyid(const std::string& value) { + + keyid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::_internal_mutable_keyid() { + + return keyid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::release_keyid() { + // @@protoc_insertion_point(field_release:crypto.AESDecryptRequest.keyId) + return keyid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESDecryptRequest::set_allocated_keyid(std::string* keyid) { + if (keyid != nullptr) { + + } else { + + } + keyid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), keyid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESDecryptRequest.keyId) +} + +// bool isFirst = 11; +inline void AESDecryptRequest::clear_isfirst() { + isfirst_ = false; +} +inline bool AESDecryptRequest::_internal_isfirst() const { + return isfirst_; +} +inline bool AESDecryptRequest::isfirst() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.isFirst) + return _internal_isfirst(); +} +inline void AESDecryptRequest::_internal_set_isfirst(bool value) { + + isfirst_ = value; +} +inline void AESDecryptRequest::set_isfirst(bool value) { + _internal_set_isfirst(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.isFirst) +} + +// string messageId = 12; +inline void AESDecryptRequest::clear_messageid() { + messageid_.ClearToEmpty(); +} +inline const std::string& AESDecryptRequest::messageid() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.messageId) + return _internal_messageid(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESDecryptRequest::set_messageid(ArgT0&& arg0, ArgT... args) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.messageId) +} +inline std::string* AESDecryptRequest::mutable_messageid() { + std::string* _s = _internal_mutable_messageid(); + // @@protoc_insertion_point(field_mutable:crypto.AESDecryptRequest.messageId) + return _s; +} +inline const std::string& AESDecryptRequest::_internal_messageid() const { + return messageid_.Get(); +} +inline void AESDecryptRequest::_internal_set_messageid(const std::string& value) { + + messageid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::_internal_mutable_messageid() { + + return messageid_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESDecryptRequest::release_messageid() { + // @@protoc_insertion_point(field_release:crypto.AESDecryptRequest.messageId) + return messageid_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESDecryptRequest::set_allocated_messageid(std::string* messageid) { + if (messageid != nullptr) { + + } else { + + } + messageid_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), messageid, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESDecryptRequest.messageId) +} + +// int32 userId = 13; +inline void AESDecryptRequest::clear_userid() { + userid_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::_internal_userid() const { + return userid_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AESDecryptRequest::userid() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptRequest.userId) + return _internal_userid(); +} +inline void AESDecryptRequest::_internal_set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + + userid_ = value; +} +inline void AESDecryptRequest::set_userid(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_userid(value); + // @@protoc_insertion_point(field_set:crypto.AESDecryptRequest.userId) +} + +// ------------------------------------------------------------------- + +// AESDecryptResponse + +// bytes decrypteddata = 1; +inline void AESDecryptResponse::clear_decrypteddata() { + decrypteddata_.ClearToEmpty(); +} +inline const std::string& AESDecryptResponse::decrypteddata() const { + // @@protoc_insertion_point(field_get:crypto.AESDecryptResponse.decrypteddata) + return _internal_decrypteddata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AESDecryptResponse::set_decrypteddata(ArgT0&& arg0, ArgT... args) { + + decrypteddata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:crypto.AESDecryptResponse.decrypteddata) +} +inline std::string* AESDecryptResponse::mutable_decrypteddata() { + std::string* _s = _internal_mutable_decrypteddata(); + // @@protoc_insertion_point(field_mutable:crypto.AESDecryptResponse.decrypteddata) + return _s; +} +inline const std::string& AESDecryptResponse::_internal_decrypteddata() const { + return decrypteddata_.Get(); +} +inline void AESDecryptResponse::_internal_set_decrypteddata(const std::string& value) { + + decrypteddata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AESDecryptResponse::_internal_mutable_decrypteddata() { + + return decrypteddata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AESDecryptResponse::release_decrypteddata() { + // @@protoc_insertion_point(field_release:crypto.AESDecryptResponse.decrypteddata) + return decrypteddata_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void AESDecryptResponse::set_allocated_decrypteddata(std::string* decrypteddata) { + if (decrypteddata != nullptr) { + + } else { + + } + decrypteddata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), decrypteddata, + GetArenaForAllocation()); + // @@protoc_insertion_point(field_set_allocated:crypto.AESDecryptResponse.decrypteddata) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace crypto + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::crypto::KeyPermission> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::crypto::KeyPermission>() { + return ::crypto::KeyPermission_descriptor(); +} +template <> struct is_proto_enum< ::crypto::AESChainingMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::crypto::AESChainingMode>() { + return ::crypto::AESChainingMode_descriptor(); +} +template <> struct is_proto_enum< ::crypto::AsymmetricFunction> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::crypto::AsymmetricFunction>() { + return ::crypto::AsymmetricFunction_descriptor(); +} +template <> struct is_proto_enum< ::crypto::SHAAlgorithm> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::crypto::SHAAlgorithm>() { + return ::crypto::SHAAlgorithm_descriptor(); +} +template <> struct is_proto_enum< ::crypto::AESKeyLength> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::crypto::AESKeyLength>() { + return ::crypto::AESKeyLength_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_proto_2fencryption_2eproto diff --git a/hsm-server/proto/encryption.pb.h:Zone.Identifier b/hsm-server/proto/encryption.pb.h:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/proto/encryption.proto b/hsm-server/proto/encryption.proto new file mode 100644 index 00000000..c44cb551 --- /dev/null +++ b/hsm-server/proto/encryption.proto @@ -0,0 +1,248 @@ +syntax = "proto3"; +package crypto; +service CryptoService { + rpc bootSystem(BootSystemRequest) returns (Empty); + rpc addProccess(AddProcessRequest) returns (Empty); + rpc configure(ConfigureRequest) returns (Empty); + rpc generateAESKey(GenerateAESKeyRequest) returns (GenerateAESKeyResponse); + rpc generateRSAKeyPair(GenerateKeyPairRequest) returns (GenerateKeyPairResponse); + rpc generateECCKeyPair(GenerateKeyPairRequest) returns (GenerateKeyPairResponse); + rpc getSignedDataLength(GetHashLengthRequest) returns (GetLengthResponse); + rpc getECCencryptedLength(GetLengthRequest) returns (GetLengthResponse); + rpc getECCDecryptedLength(GetLengthRequest) returns (GetLengthResponse); + rpc getRSAencryptedLength(GetLengthRequest) returns (GetLengthResponse); + rpc getRSAdecryptedLength(GetLengthRequest) returns (GetLengthResponse); + rpc getAESencryptedLength(GetAESLengthRequest) returns (GetLengthResponse); + rpc getAESdecryptedLength(GetAESLengthRequest) returns (GetLengthResponse); + rpc getEncryptedLen(GetWholeLength) returns (GetLengthResponse); + rpc getDecryptedLen(GetWholeLength) returns (GetLengthResponse); + rpc sign(SignRequest) returns (SignResponse); + rpc verify(VerifyRequest) returns (VerifyResponse); + rpc getPublicECCKeyByUserId(KeyRequest) returns (KeyResponse); + rpc getPublicRSAKeyByUserId(KeyRequest) returns (KeyResponse); + rpc ECCencrypt(AsymetricEncryptRequest) returns (AsymetricEncryptResponse); + rpc ECCdecrypt(AsymetricDecryptRequest) returns (AsymetricDecryptResponse); + rpc RSAencrypt(AsymetricEncryptRequest) returns (AsymetricEncryptResponse); + rpc RSAdecrypt(AsymetricDecryptRequest) returns (AsymetricDecryptResponse); + rpc AESencrypt(AESEncryptRequest) returns (AESEncryptResponse); + rpc AESdecrypt(AESDecryptRequest) returns (AESDecryptResponse); + rpc encrypt(EncryptRequest) returns (EncryptResponse); + rpc decrypt(DecryptRequest) returns (DecryptResponse); + rpc signUpdate(SignRequest) returns (SignResponse); + rpc signFinalize(SignRequest) returns (SignResponse); + rpc verifyUpdate(VerifyRequest) returns (VerifyResponse); + rpc verifyFinalize(VerifyRequest) returns (VerifyResponse); +} +message AsymetricEncryptRequest{ + int32 senderId = 1; + string keyId = 2; + bytes data = 3; + string messageId = 4; + +} +message AsymetricEncryptResponse{ + bytes encryptedData = 1; +} +message AsymetricDecryptRequest{ + int32 senderId = 1; + int32 receiverId = 2; + string keyId = 3; + bytes data = 4; + string messageId = 5; +} +message GetHashLengthRequest{ + int32 senderId = 1; + SHAAlgorithm func = 2; + int32 dataLen = 3; + string messageId = 4; +} +message GetAESLengthRequest{ + int32 senderId = 1; + int32 dataLen = 2; + bool isFirst = 3; + AESChainingMode chainingMode = 4; + string messageId = 5; +} +message AsymetricDecryptResponse{ + bytes decryptedData = 1; +} +message GetLengthRequest { + int32 senderId = 1; + int32 inLen = 2; + string messageId = 3; +} +message GetLengthResponse { + int32 len = 1; +} +message GetWholeLength{ + int32 senderId = 1; + int32 inLen = 2; + bool isFirst = 3; + string messageId = 4; + int32 userId = 5; +} +message GenerateAESKeyRequest { + int32 userId = 1; + repeated KeyPermission permissions = 2; + AESKeyLength keyLength = 3; + int32 destUserId = 4; + string messageId = 5; +} +message GenerateAESKeyResponse { + string aesKey = 1; +} +message GenerateKeyPairRequest { + int32 userId = 1; + repeated KeyPermission permissions = 2; + string messageId = 3; +} +message GenerateKeyPairResponse { + string publicKey = 1; + string privateKey = 2; +} +message SignRequest { + int32 senderId = 1; + bytes data = 2; + SHAAlgorithm hashFunc = 3; + int64 counter = 5; + string keyId = 6; + string messageId = 7; +} +message SignResponse { + bytes signature = 1; +} +message VerifyRequest { + int32 senderId = 1; + int32 receiverId = 2; + bytes data = 3; + bytes signature = 4; + SHAAlgorithm hashFunc = 5; + string keyId = 6; + int32 counter = 7; + string messageId = 8; +} +message VerifyResponse { + bool valid = 1; + bytes out = 2; +} +message KeyRequest { + int32 senderId = 1; + int32 userId = 2; + string messageId = 3; +} +message KeyResponse { + string key = 1; +} +message UserKeyPermissions { + int32 userId = 1; + repeated KeyPermission permissions = 2; +} +message BootSystemRequest { + repeated UserKeyPermissions usersIdsPermissions = 1; + string messageId = 5; +} +message Empty{ +} + +message CryptoConfig { + SHAAlgorithm hashFunction = 1; + AESKeyLength aesKeyLength = 2; + AESChainingMode aesChainingMode = 3; + AsymmetricFunction asymmetricFunction = 4; + string messageId = 5; +} +message ConfigureRequest { + int32 userId = 1; + CryptoConfig config = 2; + string messageId = 3; + +} +message AddProcessRequest{ + int32 userId = 1; + repeated KeyPermission permissions = 2; + string messageId = 4; +} +message EncryptRequest { + int32 senderId = 1; + int32 receiverId = 2; + bytes data = 3; + int64 counter = 4; + bool isFirst = 5; + string messageId = 6; +} +message EncryptResponse { + bytes encryptedData = 1; + bytes signature = 2; +} +message DecryptRequest { + int32 senderId = 1; + int32 receiverId = 2; + bytes encryptedData = 3; + int64 counter = 4; + bytes signature = 5; + bool isFirst = 6; + string messageId = 7; +} +message DecryptResponse { + bytes decryptedData = 1; +} +message AESEncryptRequest { + int32 senderId = 1; + int32 receiverId = 2; + bytes data = 3; + AsymmetricFunction func = 4; + int64 counter = 5; + string keyId = 6; + AESKeyLength keyLength = 7; + AESChainingMode chainingMode = 8; + bool isFirst = 9; + string messageId = 10; +} +message AESEncryptResponse { + bytes encryptedData = 1; +} +message AESDecryptRequest { + int32 senderId = 1; + int32 receiverId = 2; + bytes dataIn = 3; + int32 inLen=4; + bytes dataOut = 5; + AsymmetricFunction func = 6; + AESKeyLength keyLength = 7; + AESChainingMode chainingMode=8; + int64 counter = 9; + string keyId = 10; + bool isFirst = 11; + string messageId = 12; + int32 userId = 13; +} +message AESDecryptResponse { + bytes decrypteddata = 1; +} +enum KeyPermission { + VERIFY = 0; + SIGN = 1; + ENCRYPT = 2; + DECRYPT = 3; + EXPORTABLE = 4; +} +enum AESChainingMode { + ECB = 0; + CBC = 1; + CFB = 2; + OFB = 3; + CTR = 4; +} +enum AsymmetricFunction { + RSA = 0; + ECC = 1; +} +enum SHAAlgorithm { + SHA256 = 0; + SHA3_512 = 1; +} +enum AESKeyLength { + AES_128 = 0; + AES_192 = 1; + AES_256 = 2; +} diff --git a/hsm-server/proto/encryption.proto:Zone.Identifier b/hsm-server/proto/encryption.proto:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/src/SHA3-512.cpp b/hsm-server/src/SHA3-512.cpp new file mode 100644 index 00000000..73ee8a4c --- /dev/null +++ b/hsm-server/src/SHA3-512.cpp @@ -0,0 +1,390 @@ +#include "../include/SHA3-512.h" +#include "../logger/logger.h" +#include +#include +#include +#include + +#define BLOCK_SIZE 72 +// Macro for circular left shift (rotation) of x by y bits +#define ROT(x, y) (((x) << (y)) | ((x) >> ((64) - (y)))) + +// constants representing the rotation values for the Keccak-f permutation based +// on the (x, y) position +const uint64_t r[5][5] = {{0, 36, 3, 41, 18}, + {1, 44, 10, 45, 2}, + {62, 6, 43, 15, 61}, + {28, 55, 25, 21, 56}, + {27, 20, 39, 8, 14}}; + +// Round constants used in the Keccak-f permutation +static const uint64_t RC[24] = { + 0x0000000000000001, 0x0000000000008082, 0x800000000000808A, + 0x8000000080008000, 0x000000000000808B, 0x0000000080000001, + 0x8000000080008081, 0x8000000000008009, 0x000000000000008A, + 0x0000000000000088, 0x0000000080008009, 0x000000008000000A, + 0x000000008000808B, 0x800000000000008B, 0x8000000000008089, + 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, + 0x000000000000800A, 0x800000008000000A, 0x8000000080008081, + 0x8000000000008080, 0x0000000080000001, 0x8000000080008008}; + +/** + * @brief Constructor to initialize the SHA3_512 object. + * + * This constructor initializes the internal state and buffer of the SHA3-512 + * object to zero. It also logs the initialization process. + * + * @note The logger is initialized to log messages related to the SHA3-512 + * algorithm. + */ +SHA3_512::SHA3_512() +{ + log(logger::LogLevel::INFO, "SHA3-512: Initializing..."); + std::memset(S, 0, sizeof(S)); // Clear state + std::memset(buffer, 0, sizeof(buffer)); // Clear buffer + buffer_length = 0; // Reset buffer length +} + +/** + * @brief Perform one round of the Keccak-f permutation. + * + * This function executes a single round of the Keccak-f permutation, which + * includes the θ, ρ, π, χ, and ι steps. The state matrix is updated with + * new values based on these transformations, and the round constant is applied. + * + * @param A The state matrix to be updated. + * @param RC The round constant for the current round. + * + * @note This function logs the start and completion of the round operation. + */ +void SHA3_512::round(uint64_t A[5][5], uint64_t RC) +{ + uint64_t C[5]; + for (int x = 0; x < 5; x++) + C[x] = A[x][0] ^ A[x][1] ^ A[x][2] ^ A[x][3] ^ A[x][4]; + + uint64_t D[5]; + for (int x = 0; x < 5; x++) + D[x] = C[(x + 4) % 5] ^ ROT(C[(x + 1) % 5], 1); + + // Update state matrix A with D values + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + A[x][y] = A[x][y] ^ D[x]; + + // ρ & π steps: Perform rotation and permutation + uint64_t B[5][5]; + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + B[y][(2 * x + 3 * y) % 5] = ROT(A[x][y], r[x][y]); + + // χ step: Apply the χ transformation + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + A[x][y] = B[x][y] ^ ((~(B[(x + 1) % 5][y])) & B[(x + 2) % 5][y]); + + // ι step: Apply the round constant + A[0][0] = A[0][0] ^ RC; +} + +/** + * @brief Perform the Keccak-f permutation for 24 rounds. + * + * This function applies the Keccak-f permutation to the state matrix `A` for a + * total of 24 rounds. It iteratively calls the `round` function with the + * appropriate round constant from the `RC` array. + * + * @param A The state matrix to be permuted. This 5x5 matrix undergoes multiple + * transformations as defined by the Keccak-f permutation. + * + * @note This function logs the start and completion of the permutation process. + */ +void SHA3_512::f_function(uint64_t A[5][5]) +{ + log(logger::LogLevel::DEBUG, "SHA3-512: Starting f_function."); + + for (int i = 0; i < 24; i++) + round(A, RC[i]); + + log(logger::LogLevel::DEBUG, "SHA3-512: Done f_function."); +} + +/** + * @brief Apply padding to the input data for the SHA3-512 algorithm. + * + * This function pads the input data to ensure it aligns with the block size + * required by the SHA3-512 algorithm. Padding is done according to the SHA3-512 + * padding scheme, which involves appending specific bytes to the end of the + * data to make its length a multiple of the block size. + * + * @param input A pointer to the input data array that will be padded. + * @param in_len A reference to the size of the input data. This value will be + * updated to reflect the length of the padded data. + * @param absorb_times An integer reference that will be set to the number of + * full blocks (including the padded block) after padding is applied. + * + * @throws std::runtime_error If padding fails due to an unexpected error. + * + * @note If the input data length modulo the block size is 1, a special padding + * byte (0x86) is used. Otherwise, the general padding scheme is applied, which + * involves adding a 0x06 byte followed by zeroes, and ending with a 0x80 byte. + * The function logs various stages of padding and any errors encountered. + */ +void SHA3_512::padding(uint8_t input[], std::size_t &in_len, int &absorb_times) +{ + absorb_times = in_len / BLOCK_SIZE; // Number of full blocks + std::size_t add_last = in_len % BLOCK_SIZE; // Remaining bytes + log(logger::LogLevel::DEBUG, + "SHA3-512: Remaining bytes: " + std::to_string(add_last)); + + if (BLOCK_SIZE - add_last == 1) { + log(logger::LogLevel::DEBUG, + "SHA3-512: Padding byte for the case where only one byte is left"); + input[in_len] = + 0x86; // Padding byte for the case where only one byte is left + } + else if (BLOCK_SIZE - add_last > 1) { + log(logger::LogLevel::DEBUG, "SHA3-512: Applying general padding"); + input[in_len] = 0x06; // Padding byte for general case + for (int i = 1; i < (BLOCK_SIZE - 1 - add_last); i++) + input[in_len + i] = 0x00; // Fill with zeroes + input[in_len + (BLOCK_SIZE - 1 - add_last)] = + 0x80; // Final padding byte + in_len += (BLOCK_SIZE - add_last); // Update length + } + else { + log(logger::LogLevel::ERROR, "SHA3-512: Unexpected padding error"); + throw std::runtime_error( + "Padding failed due to unexpected error. Remaining bytes: " + + std::to_string(add_last)); + } + + absorb_times += 1; // Include the final padding block +} + +/** + * @brief XOR the state matrix S with the block p. + * + * This function performs an XOR operation between the state matrix `S` and the + * given block `p`. It updates the state matrix in-place with the result of the + * XOR operation. Additionally, it logs the block data before and after the XOR + * operation for debugging purposes. + * + * @param S A 5x5 matrix of 64-bit integers representing the state matrix. This + * matrix will be updated with the XOR result. + * @param p A pointer to an array of 64-bit integers representing the block of + * data to XOR with the state matrix. The array is expected to have at least 25 + * elements. + * + * @note The function assumes that the size of the block `p` is 25 elements. It + * logs the block data and state matrix before and after the XOR operation. + */ +void SHA3_512::assign_S_xor_p(uint64_t S[5][5], uint64_t *p) +{ + // Perform XOR of the block with the state matrix + for (int x = 0; x < 5; x++) { + for (int y = 0; y < 5; y++) { + int index = x + 5 * y; + if (index < 25) { + S[x][y] ^= p[index]; + } + } + } +} + +/** + * @brief Swap byte order (endianess) for a 64-bit integer. + * + * This function swaps the byte order of a 64-bit integer from little-endian to + * big-endian or vice versa. It modifies the integer in place and logs its value + * before and after the swap operation. + * + * @param x A reference to a 64-bit integer whose byte order is to be swapped. + * The value will be updated to its byte-swapped equivalent. + * + * @note The function logs the value of `x` before and after performing the + * endian swap for debugging purposes. Ensure that the integer is appropriately + * sized (64-bit) for this operation. + */ +void SHA3_512::endianSwap(uint64_t &x) +{ + // Perform endian swap + x = (x >> 56) | ((x << 40) & 0x00FF000000000000) | + ((x << 24) & 0x0000FF0000000000) | ((x << 8) & 0x000000FF00000000) | + ((x >> 8) & 0x00000000FF000000) | ((x >> 24) & 0x0000000000FF0000) | + ((x >> 40) & 0x000000000000FF00) | (x << 56); +} + +/** + * @brief Convert the state matrix to a hexadecimal string. + * + * This function converts the state matrix `S` of the SHA3-512 algorithm into a + * hexadecimal string representation. It serializes the matrix values in a + * specific order, ensuring that each 64-bit integer is represented as a + * 16-digit hexadecimal number with leading zeros if necessary. + * + * @param S A 5x5 matrix of 64-bit integers representing the state of the + * SHA3-512 algorithm. + * + * @return A `std::string` containing the hexadecimal representation of the + * state matrix. The string concatenates the values in a specified order: the + * first column of each row, followed by the next rows. + * + * @note The function uses `std::ostringstream` to format the output and + * `std::setw` to ensure each 64-bit integer is represented as a 16-character + * wide hexadecimal string. + */ +std::vector SHA3_512::hashPartToHexVector(uint64_t S[5][5]) +{ + std::ostringstream oss; + oss << std::hex << std::setfill('0'); + // Append values in the specified order + oss << std::setw(16) << S[0][0] << std::setw(16) << S[1][0] << std::setw(16) + << S[2][0] << std::setw(16) << S[3][0] << std::setw(16) << S[4][0] + << std::setw(16) << S[0][1] << std::setw(16) << S[1][1] << std::setw(16) + << S[2][1]; + std::string res = oss.str(); + std::vector vec; + vec.reserve(res.size()); // Optional: reserve space for performance + for (char c : res) + vec.push_back(static_cast(c)); + return vec; +} + +/** + * @brief Update the hash with additional data. + * + * This function absorbs additional data into the SHA3-512 hash computation. It + * processes the input data in chunks and updates the internal state + * accordingly. The data is absorbed into a buffer and, once the buffer is full, + * the data is processed by XORing it with the current state and applying the + * Keccak-f permutation. + * + * @param input A pointer to the data to be absorbed into the hash. + * @param length The length of the data to be absorbed, in bytes. + * + * @return CK_RV Returns `CKR_OK` on success or `CKR_FUNCTION_FAILED` if an + * error occurs. + * + * @note The buffer size used for absorption is fixed at 72 bytes. If the buffer + * length exceeds its size, an error will be logged, and the function will + * return `CKR_FUNCTION_FAILED`. + */ +CK_RV SHA3_512::update(const std::vector &data) +{ + log(logger::LogLevel::INFO, "SHA3-512: Starting update with length: " + + std::to_string(data.size())); + + // Define the input size and starting pointer + std::size_t length = data.size(); + std::size_t data_index = 0; + + // Absorb input into the buffer and process in 72-byte chunks (576 bits) + while (length > 0) { + if (buffer_length > sizeof(buffer)) { + log(logger::LogLevel::ERROR, + "SHA3-512: Buffer length is bigger then buffer size"); + return CKR_FUNCTION_FAILED; + } + // Calculate the number of bytes we can copy into the buffer + std::size_t to_copy = std::min(length, sizeof(buffer) - buffer_length); + + // Copy input data into the buffer + std::memcpy(buffer + buffer_length, data.data(), to_copy); + + // Update buffer length and input pointers + buffer_length += to_copy; + data_index += to_copy; + length -= to_copy; + + log(logger::LogLevel::DEBUG, + "SHA3-512: Copied " + std::to_string(to_copy) + + " bytes, remaining: " + std::to_string(length)); + + // If the buffer is full, process the absorbed data + if (buffer_length == sizeof(buffer)) { + // Convert the buffer into a block and XOR with state + uint64_t *block = reinterpret_cast(buffer); + assign_S_xor_p(S, block); + + // Apply the Keccak-f function to update the state + f_function(S); + + // Reset buffer length for the next block of data + buffer_length = 0; + log(logger::LogLevel::DEBUG, "SHA3-512: Processed a full block."); + } + } + + log(logger::LogLevel::INFO, "SHA3-512: Update completed successfully."); + + return CKR_OK; +} + +/** + * @brief Finalize the hash computation and produce the final hash value. + * + * This function finalizes the SHA3-512 hashing process. It handles any + * remaining data in the buffer by applying padding, processes the data + * including the padding, and performs necessary transformations to produce the + * final hash value. The result is then converted to a hexadecimal string. + * + * @param[out] output A reference to a `std::string` that will be set to the + * resulting hexadecimal representation of the hash value. + * + * @return CK_RV Returns `CKR_OK` on success or `CKR_FUNCTION_FAILED` if an + * error occurs. + * + * @note The buffer is padded and processed as necessary to ensure that all + * input data is correctly absorbed and hashed. The function also performs an + * endian swap on the state matrix elements before converting the hash value to + * a hexadecimal string. + */ + +CK_RV SHA3_512::finalize(std::vector &output) +{ + log(logger::LogLevel::INFO, "SHA3-512: Finalizing"); + + // Handle remaining data in the buffer with padding + std::size_t remaining_length = buffer_length; + log(logger::LogLevel::DEBUG, + "SHA3-512: Length of remaining unprocessed data: " + + std::to_string(remaining_length)); + + // Apply padding to the buffer + int absorb_times = 0; + + try { + padding(buffer, remaining_length, + absorb_times); // Call padding in try block + log(logger::LogLevel::DEBUG, + "SHA3-512: Number of blocks to be processed after padding: " + + std::to_string(absorb_times)); + } + catch (const std::exception &e) { + // Log the exception error message + log(logger::LogLevel::ERROR, + "SHA3-512: Padding error: " + std::string(e.what())); + return CKR_FUNCTION_FAILED; + } + + // Process any remaining data including padding + for (int i = 0; i < absorb_times; i++) { + // Convert the buffer into a block and XOR with state + uint64_t *block = reinterpret_cast(buffer + i * BLOCK_SIZE); + assign_S_xor_p(S, block); + + // Apply the Keccak-f function to update the state + f_function(S); + } + + // Perform endianess swap for each element of the state matrix + for (int i = 0; i < 5; i++) + for (int j = 0; j < 5; j++) + endianSwap(S[i][j]); + + // Convert the state to a hex string + output = hashPartToHexVector(S); + log(logger::LogLevel::INFO, "SHA3-512: Finalize completed successfully."); + return CKR_OK; +} \ No newline at end of file diff --git a/hsm-server/src/aes.cpp b/hsm-server/src/aes.cpp new file mode 100644 index 00000000..715a3587 --- /dev/null +++ b/hsm-server/src/aes.cpp @@ -0,0 +1,918 @@ +#include "../include/aes.h" +#include +#include +#include +#ifdef USE_SYCL +#include +#include +#include +#include +#include +#include +using namespace cl::sycl; +#endif + +/** + @brief Generates a random Initialization Vector (IV) for cryptographic purposes. + This function generates a BLOCK_BYTES_LEN-byte random IV, which is commonly used in cryptographic algorithms + such as AES (Advanced Encryption Standard) in CBC (Cipher Block Chaining) mode. + The IV ensures that the same plaintext block will result in a different ciphertext block + when encrypted with the same key. + @param iv Pointer to an array of BLOCK_BYTES_LEN unsigned char (bytes) where the generated IV will be stored. + @note The function uses the C++ standard library's random number generator to produce + a uniformly distributed sequence of bytes. + */ +void generateRandomIV(unsigned char *iv) +{ + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dis(0, 255); + for (unsigned int i = 0; i < BLOCK_BYTES_LEN; i++) + iv[i] = static_cast(dis(gen)); + //TODO delete this! + std::memset(iv, 01, BLOCK_BYTES_LEN); +} + +unsigned int getPaddedLength(unsigned int originalLength) +{ + unsigned int paddedLength = + ((originalLength + BLOCK_BYTES_LEN - 1) / BLOCK_BYTES_LEN) * + BLOCK_BYTES_LEN; + if (paddedLength == originalLength) { + paddedLength += BLOCK_BYTES_LEN; + } + + return paddedLength; +} + +/** + @brief Pads the input message to ensure it is a multiple of the block size. + @param message The message to be padded. + @param originalLength The original length of the message. + */ +void padMessage(unsigned char *originalMessage, unsigned int originalLength, + unsigned char *paddedMessage) +{ + size_t paddedLength = getPaddedLength(originalLength); + unsigned char paddingValue = + static_cast(paddedLength - originalLength); + memcpy(paddedMessage, originalMessage, originalLength); + for (size_t i = originalLength; i < paddedLength; i++) + paddedMessage[i] = paddingValue; +} + +/** + @brief Removes padding from the message. + @param message The padded message. + @param paddedLength The length of the padded message + */ +unsigned int getUnpadMessageLength(unsigned char *message, + unsigned int paddedLength) +{ + unsigned char paddingValue = message[paddedLength - 1]; + return paddedLength - paddingValue; +} + +/** + @brief Generates a random AES key of the specified length. + @param keyLength The length of the key (128, 192, or 256 bits). + @return A pointer to the generated key. + */ +void generateKey(unsigned char *key, AESKeyLength keyLength) +{ + // Allocate memory for the key + + // Initialize a random device and a random number generator + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution dis(0, 255); + + // Fill the key with random bytes + for (int i = 0; i < aesKeyLengthData[keyLength].keySize; i++) + key[i] = dis(gen); + memset(key, 0, aesKeyLengthData[keyLength].keySize); +} + +/** + @brief Checks if the input length is a multiple of the block length. + @param len The length of the input data. + @throws std::length_error if the length is not a multiple of the block length. + */ +void checkLength(unsigned int len) +{ + if (len % BLOCK_BYTES_LEN != 0) + throw std::length_error("Plaintext length must be divisible by " + + std::to_string(BLOCK_BYTES_LEN)); +} + +#ifdef USE_SYCL + +/** + @brief Encrypts a single block of data using SYCL. + @param in The input block to be encrypted. + @param out The output block to store the encrypted data. + @param roundKeys The expanded key for encryption. + */ +void encryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength) +{ + queue queue; + // State array initialization + unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]; + + // Buffers for SYCL + buffer in_buf(in, range<1>(AES_STATE_ROWS * NUM_BLOCKS)); + buffer state_buf(reinterpret_cast(state), + range<1>(AES_STATE_ROWS * NUM_BLOCKS)); + buffer roundKeys_buf( + roundKeys, + range<1>(AES_STATE_ROWS * (aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS)); + buffer out_buf(out, + range<1>(AES_STATE_ROWS * NUM_BLOCKS)); + + // Initialize state array with input block + queue + .submit([&](handler &handler) { + auto in_acc = in_buf.get_access(handler); + auto state_acc = state_buf.get_access(handler); + handler.parallel_for(range<1>(AES_STATE_ROWS * NUM_BLOCKS), + [=](id<1> idx) { + // Row + unsigned int i = idx % AES_STATE_ROWS; + // Column + unsigned int j = idx / AES_STATE_ROWS; + state_acc[i * NUM_BLOCKS + j] = + in_acc[i + AES_STATE_ROWS * j]; + }); + }) + .wait(); + + // Initial round key addition + addRoundKey(state, roundKeys); + + // Main rounds + for (unsigned int round = 1; round < aesKeyLengthData[keyLength].numRound; + round++) { + subBytes(state); + shiftRows(state); + mixColumns(state); + addRoundKey(state, roundKeys + round * AES_STATE_ROWS * NUM_BLOCKS); + } + + // Final round + subBytes(state); + shiftRows(state); + addRoundKey(state, roundKeys + aesKeyLengthData[keyLength].numRound * + AES_STATE_ROWS * NUM_BLOCKS); + + // Copy state array to output block + queue + .submit([&](handler &handler) { + auto state_acc = state_buf.get_access(handler); + auto out_acc = out_buf.get_access(handler); + handler.parallel_for( + range<1>(AES_STATE_ROWS * NUM_BLOCKS), [=](id<1> idx) { + unsigned int i = idx % AES_STATE_ROWS; // Row + unsigned int j = idx / AES_STATE_ROWS; // Column + out_acc[i + AES_STATE_ROWS * j] = + state_acc[i * NUM_BLOCKS + j]; + }); + }) + .wait(); +} + +/** + @brief Decrypts a single block of data using SYCL. + Uses SYCL to perform AES decryption on the input block and stores the result in the output block. + @param in Input block to be decrypted. + @param[out] out Output block to store the decrypted data. + @param roundKeys Expanded key for decryption. + */ +void decryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength) +{ + unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]; + unsigned int i, j, round; + + // Initialize state array with input block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + state[i][j] = in[i + AES_STATE_ROWS * j]; + + // Initial round key addition + addRoundKey(state, roundKeys + aesKeyLengthData[keyLength].numRound * + AES_STATE_ROWS * NUM_BLOCKS); + + // Main rounds + for (round = aesKeyLengthData[keyLength].numRound - 1; round >= 1; + round--) { + invSubBytes(state); + invShiftRows(state); + addRoundKey(state, roundKeys + round * AES_STATE_ROWS * NUM_BLOCKS); + invMixColumns(state); + } + + // Final round + invSubBytes(state); + invShiftRows(state); + addRoundKey(state, roundKeys); + + // Copy state array to output block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + out[i + AES_STATE_ROWS * j] = state[i][j]; +} + +/** + @brief Multiplies a byte by x in GF(2^8). + Multiplies the input byte by 2 in GF(2^8) and applies the irreducible polynomial if necessary. + @param b Input byte. + @return Result of the multiplication. + */ +unsigned char xtime(unsigned char b) +{ + return (b << 1) ^ (((b >> 7) & 1) * 0x1b); +} + +/** + @brief Multiplies two bytes in GF(2^8). + Multiplies two bytes using the Galois field (GF) arithmetic. + @param x First byte. + @param y Second byte. + @return Result of the multiplication. + */ +unsigned char multiply(unsigned char x, unsigned char y) +{ + unsigned char result = 0; + unsigned char temp = y; + for (int i = 0; i < 8; i++) { + if (x & 1) + result ^= temp; + bool carry = temp & 0x80; + temp <<= 1; + if (carry) + temp ^= 0x1b; + x >>= 1; + } + + return result; +} + +/** + @brief Applies the SubBytes transformation using SYCL. + Substitutes bytes in the state array using the S-box. + @param state 2D array representing the state of the AES block. + */ +void subBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + buffer stateBuffer(state[0], + range<2>(AES_STATE_ROWS, NUM_BLOCKS)); + buffer sBoxBuffer( + sBox[0], range<2>(BLOCK_BYTES_LEN, BLOCK_BYTES_LEN)); + queue + .submit([&](handler &handler) { + auto stateAcc = + stateBuffer.get_access(handler); + auto sBoxAcc = sBoxBuffer.get_access(handler); + handler.parallel_for( + range<2>(AES_STATE_ROWS, NUM_BLOCKS), [=](id<2> id) { + size_t i = id[0]; + size_t j = id[1]; + stateAcc[i][j] = sBoxAcc[state[i][j] / BLOCK_BYTES_LEN] + [state[i][j] % BLOCK_BYTES_LEN]; + }); + }) + .wait(); +} + +/** + @brief Applies the ShiftRows transformation using SYCL. + Shifts the rows of the state array in the AES block. + @param state 2D array representing the state of the AES block. + */ +void shiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + queue + .submit([&](handler &handler) { + handler.parallel_for(range<1>(AES_STATE_ROWS), [=](id<1> i) { + unsigned char tmp[NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + tmp[k] = state[i][(k + i) % NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + state[i][k] = tmp[k]; + }); + }) + .wait(); +} + +/** + @brief Applies the MixColumns transformation using SYCL. + Mixes the columns of the state array in the AES block. + @param state 2D array representing the state of the AES block. + */ +void mixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + + queue + .parallel_for(range<1>(AES_STATE_ROWS), + [=](id<1> idx) { + size_t i = idx[0]; + unsigned char a[AES_STATE_ROWS]; + unsigned char b[AES_STATE_ROWS]; + + for (size_t j = 0; j < AES_STATE_ROWS; j++) { + a[j] = state[j][i]; + b[j] = xtime(state[j][i]); + } + + state[0][i] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; + state[1][i] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; + state[2][i] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; + state[3][i] = b[0] ^ a[0] ^ a[1] ^ a[2] ^ b[3]; + }) + .wait(); +} + +/** + @brief Applies the AddRoundKey transformation using SYCL. + XORs the state array with the round key in the AES block. + @param state 2D array representing the state of the AES block. + @param roundKey Round key to be XORed with the state array. + */ +void addRoundKey(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS], + unsigned char *roundKey) +{ + queue queue; + buffer stateBuffer(state[0], + range<2>(AES_STATE_ROWS, NUM_BLOCKS)); + buffer roundKeyBuffer( + roundKey, range<1>(AES_STATE_ROWS * NUM_BLOCKS)); + + queue + .submit([&](handler &handler) { + auto stateAcc = + stateBuffer.get_access(handler); + auto roundKeyAcc = + roundKeyBuffer.get_access(handler); + + handler.parallel_for( + range<2>(AES_STATE_ROWS, NUM_BLOCKS), [=](id<2> id) { + size_t i = id[0]; + size_t j = id[1]; + stateAcc[i][j] ^= roundKeyAcc[i + AES_STATE_ROWS * j]; + }); + }) + .wait(); +} + +/** + @brief Applies the SubWord transformation using SYCL. + Substitutes bytes in a word using the S-box. + @param a Array representing the word to be transformed. + */ +void subWord(unsigned char a[AES_STATE_ROWS]) +{ + queue queue; + buffer aBuffer(a, range<1>(AES_STATE_ROWS)); + buffer sBoxBuffer( + sBox[0], range<2>(BLOCK_BYTES_LEN, BLOCK_BYTES_LEN)); + + queue + .submit([&](handler &handler) { + auto aAcc = aBuffer.get_access(handler); + auto sBoxAcc = sBoxBuffer.get_access(handler); + + handler.parallel_for( + range<1>(AES_STATE_ROWS), [=](id<1> id) { + size_t i = id[0]; + aAcc[i] = sBoxAcc[aAcc[i] / BLOCK_BYTES_LEN] + [aAcc[i] % BLOCK_BYTES_LEN]; + }); + }) + .wait(); +} + +/** + @brief Rotates a word (4 bytes) using SYCL. + Performs a circular rotation of a word. + @param word Pointer to the word to be rotated. + */ +void rotWord(unsigned char *word) +{ + queue queue; + buffer wordBuffer(word, range<1>(AES_STATE_ROWS)); + + queue + .submit([&](handler &handler) { + auto wordAcc = + wordBuffer.get_access(handler); + + handler.single_task([=]() { + unsigned char temp = wordAcc[0]; + wordAcc[0] = wordAcc[1]; + wordAcc[1] = wordAcc[2]; + wordAcc[2] = wordAcc[3]; + wordAcc[3] = temp; + }); + }) + .wait(); +} + +/** + @brief Applies the Rcon transformation using SYCL. + Generates the Rcon value for key expansion based on the round number. + @param a Array to store the Rcon value. + @param n Round number. + */ +void rconWord(unsigned char a[AES_STATE_ROWS], unsigned int n) +{ + queue queue; + unsigned char strong = 1; + for (size_t i = 0; i < n - 1; i++) + strong = xtime(strong); + + queue + .parallel_for(range<1>(AES_STATE_ROWS), + [=](id<1> idx) { + size_t i = idx[0]; + if (i == 0) { + a[i] = strong; + } + else { + a[i] = 0; + } + }) + .wait(); +} + +/** + @brief Expands the AES key for encryption/decryption using SYCL. + Generates the round keys from the original key. + @param key Original AES key. + @param w Output array to store the expanded key. + */ +void keyExpansion(const unsigned char *key, unsigned char w[], + AESKeyLength keyLength) +{ + queue queue; + unsigned int numWordLocal = aesKeyLengthData[keyLength].numWord; + + unsigned int NUM_BLOCKSLocal = NUM_BLOCKS; + unsigned int numRoundLocal = aesKeyLengthData[keyLength].numRound; + // Copy the initial key to the output array + queue + .submit([&](handler &handler) { + handler.parallel_for(range<1>(AES_STATE_ROWS * numWordLocal), + [=](id<1> idx) { w[idx] = key[idx]; }); + }) + .wait(); + + unsigned int i = AES_STATE_ROWS * numWordLocal; + + while (i < AES_STATE_ROWS * NUM_BLOCKSLocal * (numRoundLocal + 1)) { + unsigned char temp[AES_STATE_ROWS]; + buffer temp_buf(temp, range<1>(AES_STATE_ROWS)); + + queue + .submit([&](handler &handler) { + auto temp_acc = + temp_buf.get_access(handler); + handler.parallel_for(range<1>(AES_STATE_ROWS), [=](id<1> idx) { + temp_acc[idx] = w[i - AES_STATE_ROWS + idx]; + }); + }) + .wait(); + + if (i / AES_STATE_ROWS % numWordLocal == 0) { + // Use SYCL to execute rotWord and subWord + rotWord(temp); + subWord(temp); + unsigned char rcon[AES_STATE_ROWS]; + rconWord(rcon, i / (numWordLocal * AES_STATE_ROWS)); + + for (int k = 0; k < AES_STATE_ROWS; k++) + temp[k] ^= rcon[k]; + } + else if (numWordLocal > 6 && i / AES_STATE_ROWS % numWordLocal == 4) + subWord(temp); + + queue + .submit([&](handler &handler) { + auto temp_acc = + temp_buf.get_access(handler); + handler.parallel_for(range<1>(AES_STATE_ROWS), [=](id<1> idx) { + w[i + idx] = w[i + idx - AES_STATE_ROWS * numWordLocal] ^ + temp_acc[idx]; + }); + }) + .wait(); + + i += 4; + } +} + +/** + Applies the InvSubBytes transformation using the inverse S-box. + This function replaces each byte in the state matrix with its + corresponding byte from the inverse S-box. + @param state 4xN matrix of state bytes to be transformed. + */ +void invSubBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + buffer stateBuffer(state[0], + range<2>(AES_STATE_ROWS, NUM_BLOCKS)); + buffer invSBoxBuffer( + invSBox[0], range<2>(BLOCK_BYTES_LEN, BLOCK_BYTES_LEN)); + + queue + .submit([&](handler &handler) { + auto stateAcc = + stateBuffer.get_access(handler); + auto invSBoxAcc = + invSBoxBuffer.get_access(handler); + + handler.parallel_for( + range<2>(AES_STATE_ROWS, NUM_BLOCKS), [=](id<2> id) { + size_t i = id[0]; + size_t j = id[1]; + stateAcc[i][j] = invSBoxAcc[state[i][j] / BLOCK_BYTES_LEN] + [state[i][j] % BLOCK_BYTES_LEN]; + }); + }) + .wait(); +} + +/*Applies the InvMixColumns transformation*/ +void invMixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + queue + .parallel_for( + range<1>(NUM_BLOCKS), + [=](id<1> idx) { + size_t i = idx[0]; + unsigned char a[AES_STATE_ROWS]; + unsigned char b[AES_STATE_ROWS]; + + for (size_t j = 0; j < AES_STATE_ROWS; j++) { + a[j] = state[j][i]; + b[j] = xtime(a[j]); + } + + state[0][i] = multiply(0x0e, a[0]) ^ multiply(0x0b, a[1]) ^ + multiply(0x0d, a[2]) ^ multiply(0x09, a[3]); + state[1][i] = multiply(0x09, a[0]) ^ multiply(0x0e, a[1]) ^ + multiply(0x0b, a[2]) ^ multiply(0x0d, a[3]); + state[2][i] = multiply(0x0d, a[0]) ^ multiply(0x09, a[1]) ^ + multiply(0x0e, a[2]) ^ multiply(0x0b, a[3]); + state[3][i] = multiply(0x0b, a[0]) ^ multiply(0x0d, a[1]) ^ + multiply(0x09, a[2]) ^ multiply(0x0e, a[3]); + }) + .wait(); +} + +/** + Applies the InvShiftRows transformation. + This function performs a cyclic shift of the rows in the state matrix + in the reverse direction for decryption. + @param state 4xN matrix of state bytes to be transformed. + */ +void invShiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + queue queue; + queue + .submit([&](handler &handler) { + handler.parallel_for(range<1>(AES_STATE_ROWS), [=](id<1> i) { + unsigned char tmp[NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + tmp[k] = state[i][(k - i + NUM_BLOCKS) % NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + state[i][k] = tmp[k]; + }); + }) + .wait(); +} + +/** XORs two blocks of bytes a and b of length len, storing the result in c. */ +void xorBlocks(const unsigned char *a, const unsigned char *b, unsigned char *c, + unsigned int len) +{ + queue queue; + + buffer bufA(a, range<1>(len)); + buffer bufB(b, range<1>(len)); + buffer bufC(c, range<1>(len)); + + queue + .submit([&](handler &handler) { + auto accA = bufA.get_access(handler); + auto accB = bufB.get_access(handler); + auto accC = bufC.get_access(handler); + + handler.parallel_for(range<1>(len), [=](id<1> idx) { + accC[idx] = accA[idx] ^ accB[idx]; + }); + }) + .wait(); +} + +#else + +/* + Encrypts a single block of data. + `in` - input block to be encrypted + `out` - output block to store the encrypted data + `roundKeys` - expanded key for encryption +*/ +void encryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength) +{ + unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]; + unsigned int i, j, round; + + // Initialize state array with input block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + state[i][j] = in[i + AES_STATE_ROWS * j]; + + // Initial round key addition + addRoundKey(state, roundKeys); + + // Main rounds + for (round = 1; round < aesKeyLengthData[keyLength].numRound; round++) { + subBytes(state); + shiftRows(state); + mixColumns(state); + addRoundKey(state, roundKeys + round * AES_STATE_ROWS * NUM_BLOCKS); + } + + // Final round + subBytes(state); + shiftRows(state); + addRoundKey(state, roundKeys + aesKeyLengthData[keyLength].numRound * + AES_STATE_ROWS * NUM_BLOCKS); + + // Copy state array to output block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + out[i + AES_STATE_ROWS * j] = state[i][j]; +} + +/* + Decrypts a single block of data. + `in` - input block to be decrypted + `out` - output block to store the decrypted data + `roundKeys` - expanded key for decryption +*/ +void decryptBlock(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength) +{ + unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]; + unsigned int i, j, round; + + // Initialize state array with input block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + state[i][j] = in[i + AES_STATE_ROWS * j]; + + // Initial round key addition + addRoundKey(state, roundKeys + aesKeyLengthData[keyLength].numRound * + AES_STATE_ROWS * NUM_BLOCKS); + + // Main rounds + for (round = aesKeyLengthData[keyLength].numRound - 1; round >= 1; + round--) { + invSubBytes(state); + invShiftRows(state); + addRoundKey(state, roundKeys + round * AES_STATE_ROWS * NUM_BLOCKS); + invMixColumns(state); + } + + // Final round + invSubBytes(state); + invShiftRows(state); + addRoundKey(state, roundKeys); + + // Copy state array to output block + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + out[i + AES_STATE_ROWS * j] = state[i][j]; +} + +/*Multiplies a byte by x in GF(2^8)*/ +unsigned char xtime(unsigned char b) +{ + return (b << 1) ^ (((b >> 7) & 1) * 0x1b); +} + +/*Multiplies two bytes in GF(2^8)*/ +unsigned char multiply(unsigned char x, unsigned char y) +{ + unsigned char result = 0; + unsigned char temp = y; + for (int i = 0; i < 8; i++) { + if (x & 1) + result ^= temp; + bool carry = temp & 0x80; + temp <<= 1; + if (carry) + temp ^= 0x1b; + x >>= 1; + } + + return result; +} + +/*Apply SubBytes transformation using the S-box*/ +void subBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + for (size_t i = 0; i < AES_STATE_ROWS; i++) + for (size_t j = 0; j < NUM_BLOCKS; j++) + state[i][j] = sBox[state[i][j] / BLOCK_BYTES_LEN] + [state[i][j] % BLOCK_BYTES_LEN]; +} + +/*ShiftRows transformation*/ +void shiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + for (size_t i = 0; i < AES_STATE_ROWS; i++) { + unsigned char tmp[NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + tmp[k] = state[i][(k + i) % NUM_BLOCKS]; + memcpy(state[i], tmp, NUM_BLOCKS * sizeof(unsigned char)); + } +} + +/*MixColumns transformation*/ +void mixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + for (size_t i = 0; i < AES_STATE_ROWS; i++) { + unsigned char a[AES_STATE_ROWS]; + unsigned char b[AES_STATE_ROWS]; + for (size_t j = 0; j < AES_STATE_ROWS; j++) { + a[j] = state[j][i]; + b[j] = xtime(state[j][i]); + } + state[0][i] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; + state[1][i] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; + state[2][i] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; + state[3][i] = b[0] ^ a[0] ^ a[1] ^ a[2] ^ b[3]; + } +} + +/*AddRoundKey transformation*/ +void addRoundKey(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS], + unsigned char *key) +{ + unsigned int i, j; + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) + state[i][j] = state[i][j] ^ key[i + AES_STATE_ROWS * j]; +} + +/*Applies the SubWord transformation using the S-box*/ +void subWord(unsigned char a[AES_STATE_ROWS]) +{ + for (size_t i = 0; i < AES_STATE_ROWS; i++) + a[i] = sBox[a[i] / BLOCK_BYTES_LEN][a[i] % BLOCK_BYTES_LEN]; +} + +/*Rotates a word (4 bytes)*/ +void rotWord(unsigned char a[AES_STATE_ROWS]) +{ + unsigned char first = a[0]; + for (size_t i = 0; i < 3; i++) + a[i] = a[i + 1]; + a[3] = first; +} + +/*Applies the Rcon transformation*/ +void rconWord(unsigned char a[AES_STATE_ROWS], unsigned int n) +{ + unsigned char strong = 1; + for (size_t i = 0; i < n - 1; i++) + strong = xtime(strong); + + a[0] = strong; + a[1] = a[2] = a[3] = 0; +} + +/*Expands the key for AES encryption/decryption*/ +void keyExpansion(const unsigned char *key, unsigned char w[], + AESKeyLength keyLength) +{ + unsigned char temp[AES_STATE_ROWS], rcon[AES_STATE_ROWS]; + unsigned int i = 0; + + //copy key to w array + while (i < AES_STATE_ROWS * aesKeyLengthData[keyLength].numWord) { + w[i] = key[i]; + i++; + } + + i = AES_STATE_ROWS * aesKeyLengthData[keyLength].numWord; + + //main expansion loop + while (i < AES_STATE_ROWS * NUM_BLOCKS * + (aesKeyLengthData[keyLength].numRound + 1)) { + for (size_t k = AES_STATE_ROWS, j = 0; k > 0; --k, ++j) + temp[j] = w[i - k]; + + if (i / AES_STATE_ROWS % aesKeyLengthData[keyLength].numWord == 0) { + rotWord(temp); + subWord(temp); + rconWord(rcon, i / (aesKeyLengthData[keyLength].numWord * + AES_STATE_ROWS)); + for (int i = 0; i < AES_STATE_ROWS; i++) + temp[i] = temp[i] ^ rcon[i]; + } + else if (aesKeyLengthData[keyLength].numWord > 6 && + i / AES_STATE_ROWS % aesKeyLengthData[keyLength].numWord == 4) + subWord(temp); + + for (int k = 0; k < AES_STATE_ROWS; k++) + w[i + k] = w[i + k - + AES_STATE_ROWS * aesKeyLengthData[keyLength].numWord] ^ + temp[k]; + + i += 4; + } +} + +/*Applies the InvSubBytes transformation using the inverse S-box*/ +void invSubBytes(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + unsigned int i, j; + unsigned char t; + for (i = 0; i < AES_STATE_ROWS; i++) + for (j = 0; j < NUM_BLOCKS; j++) { + t = state[i][j]; + state[i][j] = invSBox[t / BLOCK_BYTES_LEN][t % BLOCK_BYTES_LEN]; + } +} + +/*Applies the InvMixColumns transformation*/ +void invMixColumns(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + for (size_t i = 0; i < NUM_BLOCKS; i++) { + unsigned char a[AES_STATE_ROWS]; + unsigned char b[AES_STATE_ROWS]; + for (size_t j = 0; j < AES_STATE_ROWS; j++) { + a[j] = state[j][i]; + b[j] = xtime(a[j]); + } + state[0][i] = multiply(0x0e, a[0]) ^ multiply(0x0b, a[1]) ^ + multiply(0x0d, a[2]) ^ multiply(0x09, a[3]); + state[1][i] = multiply(0x09, a[0]) ^ multiply(0x0e, a[1]) ^ + multiply(0x0b, a[2]) ^ multiply(0x0d, a[3]); + state[2][i] = multiply(0x0d, a[0]) ^ multiply(0x09, a[1]) ^ + multiply(0x0e, a[2]) ^ multiply(0x0b, a[3]); + state[3][i] = multiply(0x0b, a[0]) ^ multiply(0x0d, a[1]) ^ + multiply(0x09, a[2]) ^ multiply(0x0e, a[3]); + } +} + +/*Applies the InvShiftRows transformation*/ +void invShiftRows(unsigned char state[AES_STATE_ROWS][NUM_BLOCKS]) +{ + for (size_t i = 0; i < AES_STATE_ROWS; i++) { + unsigned char tmp[NUM_BLOCKS]; + for (size_t k = 0; k < NUM_BLOCKS; k++) + tmp[k] = state[i][(k - i + NUM_BLOCKS) % NUM_BLOCKS]; + memcpy(state[i], tmp, NUM_BLOCKS * sizeof(unsigned char)); + } +} + +/** XORs two blocks of bytes a and b of length len, storing the result in c. */ +void xorBlocks(const unsigned char *a, const unsigned char *b, unsigned char *c, + unsigned int len) +{ + for (unsigned int i = 0; i < len; i++) { + c[i] = a[i] ^ b[i]; + } +} + +size_t calculatEncryptedLenAES(size_t inLen, bool isFirst, + AESChainingMode chainingMode) +{ + if (inLen % BLOCK_BYTES_LEN == 0) //padding + inLen += BLOCK_BYTES_LEN; + if (isFirst && chainingMode != ECB) //iv + inLen += BLOCK_BYTES_LEN; + return (inLen + 15) & ~15; +} + +size_t calculatDecryptedLenAES(size_t inLen, bool isFirst, + AESChainingMode chainingMode) +{ + if (isFirst && chainingMode != ECB) //iv + inLen -= BLOCK_BYTES_LEN; + return inLen; +} + +#endif \ No newline at end of file diff --git a/hsm-server/src/aes_cbc.cpp b/hsm-server/src/aes_cbc.cpp new file mode 100644 index 00000000..d6fc07d2 --- /dev/null +++ b/hsm-server/src/aes_cbc.cpp @@ -0,0 +1,85 @@ +#include "../include/aes_stream.h" +#include + +void AESCbc::encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) +{ + generateRandomIV(iv); + encrypt(block, inLen, key, out, outLen - BLOCK_BYTES_LEN, iv, nullptr, + keyLength); + memcpy(out + outLen - BLOCK_BYTES_LEN, iv, BLOCK_BYTES_LEN); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN * 2, BLOCK_BYTES_LEN); + this->key = new unsigned char[keyLength]; + memcpy(this->key, key, keyLength); + this->keyLength = keyLength; +} + +void AESCbc::encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen) +{ + encrypt(block, inLen, key, out, outLen, lastBlock, nullptr, keyLength); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCbc::decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + memcpy(this->iv, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); + decrypt(block, inLen - BLOCK_BYTES_LEN, key, out, outLen, + block + inLen - BLOCK_BYTES_LEN, nullptr, keyLength); + memcpy(lastBlock, block + inLen - 2 * BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCbc::decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) +{ + decrypt(block, inLen, key, out, outLen, lastBlock, nullptr, keyLength); + memcpy(lastBlock, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCbc::encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + size_t paddedLength = getPaddedLength(inLen); + unsigned char *paddedIn = new unsigned char[paddedLength]; + padMessage(in, inLen, paddedIn); + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(block, iv, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + xorBlocks(block, paddedIn + i, block, BLOCK_BYTES_LEN); + encryptBlock(block, out + i, roundKeys, keyLength); + memcpy(block, out + i, BLOCK_BYTES_LEN); + } + delete[] paddedIn; + delete[] roundKeys; +} + +void AESCbc::decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + checkLength(inLen); + unsigned char block[BLOCK_BYTES_LEN]; + outLen = inLen; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(block, iv, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < inLen; i += BLOCK_BYTES_LEN) { + decryptBlock(in + i, out + i, roundKeys, keyLength); + xorBlocks(block, out + i, out + i, BLOCK_BYTES_LEN); + memcpy(block, in + i, BLOCK_BYTES_LEN); + } + outLen = getUnpadMessageLength(out, inLen); + delete[] roundKeys; +} \ No newline at end of file diff --git a/hsm-server/src/aes_cfb.cpp b/hsm-server/src/aes_cfb.cpp new file mode 100644 index 00000000..65eef1c4 --- /dev/null +++ b/hsm-server/src/aes_cfb.cpp @@ -0,0 +1,162 @@ +#include "../include/aes_stream.h" + +/** + * @brief Initializes the AES CFB encryption process. + * + * This function generates a random IV, encrypts the input block, + * and stores the last encrypted block for continuation of the encryption process. + * + * @param block The input data block to be encrypted. + * @param inLen The length of the input block. + * @param out The output buffer to store the encrypted data. + * @param outLen The length of the output buffer. + * @param key The AES key used for encryption. + * @param keyLength The length of the AES key (128, 192, or 256 bits). + */ +void AESCfb::encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) +{ + generateRandomIV(iv); + encrypt(block, inLen, key, out, outLen - BLOCK_BYTES_LEN, iv, nullptr, + keyLength); + memcpy(out + outLen - BLOCK_BYTES_LEN, iv, BLOCK_BYTES_LEN); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN * 2, BLOCK_BYTES_LEN); + this->key = new unsigned char[keyLength]; + memcpy(this->key, key, keyLength); + this->keyLength = keyLength; +} + +/** + * @brief Continues the AES CFB encryption process. + * + * This function encrypts additional data blocks, using the last encrypted block as IV for the next block. + * + * @param block The input data block to be encrypted. + * @param inLen The length of the input block. + * @param out The output buffer to store the encrypted data. + * @param outLen The length of the output buffer. + */ +void AESCfb::encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen) +{ + encrypt(block, inLen, key, out, outLen, lastBlock, nullptr, keyLength); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +/** + * @brief Initializes the AES CFB decryption process. + * + * This function retrieves the IV from the input block, performs AES decryption, + * and stores the last block to be used in the continuation of the decryption process. + * + * @param block The input data block to be decrypted. + * @param inLen The length of the input block. + * @param out The output buffer to store the decrypted data. + * @param outLen The length of the output buffer (output parameter). + * @param key The AES key used for decryption. + * @param keyLength The length of the AES key (128, 192, or 256 bits). + */ +void AESCfb::decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + memcpy(this->iv, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); + decrypt(block, inLen - BLOCK_BYTES_LEN, key, out, outLen, + block + inLen - BLOCK_BYTES_LEN, nullptr, keyLength); + memcpy(lastBlock, block + inLen - 2 * BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +/** + * @brief Continues the AES CFB decryption process. + * + * This function decrypts additional data blocks, using the last encrypted block as IV for the next block. + * + * @param block The input data block to be decrypted. + * @param inLen The length of the input block. + * @param out The output buffer to store the decrypted data. + * @param outLen The length of the output buffer (output parameter). + */ +void AESCfb::decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) +{ + decrypt(block, inLen, key, out, outLen, lastBlock, nullptr, keyLength); + memcpy(lastBlock, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +/** + * @brief Encrypts a padded message using AES in CFB mode. + * + * This function performs AES encryption on padded input data in CFB mode. + * It generates the round keys and applies XOR between the input data and the encrypted feedback block. + * + * @param in The input data to be encrypted (padded). + * @param inLen The length of the input data. + * @param key The AES key used for encryption. + * @param out The output buffer to store the encrypted data. + * @param outLen The length of the output buffer. + * @param iv The initialization vector used for the first encryption block. + * @param lastData Optional parameter for chaining blocks (not used in this implementation). + * @param keyLength The length of the AES key (128, 192, or 256 bits). + */ +void AESCfb::encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + size_t paddedLength = getPaddedLength(inLen); + unsigned char *paddedIn = new unsigned char[paddedLength]; + padMessage(in, inLen, paddedIn); + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char feedback[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(feedback, iv, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + encryptBlock(feedback, block, roundKeys, keyLength); + xorBlocks(paddedIn + i, block, out + i, BLOCK_BYTES_LEN); + memcpy(feedback, out + i, BLOCK_BYTES_LEN); + } + delete[] roundKeys; + delete[] paddedIn; +} + +/** + * @brief Decrypts an AES-encrypted message using CFB mode. + * + * This function performs AES decryption on the input data in CFB mode. + * It generates the round keys, decrypts the input, and applies XOR between the input data and the encrypted feedback block. + * + * @param in The input data to be decrypted. + * @param inLen The length of the input data. + * @param key The AES key used for decryption. + * @param out The output buffer to store the decrypted data. + * @param outLen The length of the output buffer (output parameter). + * @param iv The initialization vector used for the first decryption block. + * @param lastData Optional parameter for chaining blocks (not used in this implementation). + * @param keyLength The length of the AES key (128, 192, or 256 bits). + */ +void AESCfb::decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + checkLength(inLen); + unsigned char block[BLOCK_BYTES_LEN]; + outLen = inLen; + unsigned char feedback[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(feedback, iv, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + encryptBlock(feedback, block, roundKeys, keyLength); + xorBlocks(in + i, block, out + i, BLOCK_BYTES_LEN); + memcpy(feedback, in + i, BLOCK_BYTES_LEN); + } + outLen = getUnpadMessageLength(out, inLen); + delete[] roundKeys; +} diff --git a/hsm-server/src/aes_ctr.cpp b/hsm-server/src/aes_ctr.cpp new file mode 100644 index 00000000..6f222f02 --- /dev/null +++ b/hsm-server/src/aes_ctr.cpp @@ -0,0 +1,215 @@ +#include "../include/aes_stream.h" +#include +#include +#include + +/** + Encrypts a single block of data using AES in CTR mode. + This function handles the encryption of a single block in CTR (Counter) mode. + It computes the counter value based on the given initialization vector (IV) and + block index, encrypts the counter, and then XORs the encrypted counter with the + input block to produce the output block. + @param input Pointer to the input block of plaintext data (BLOCK_BYTES_LEN bytes). + @param output Pointer to the output block where the encrypted ciphertext will be stored (BLOCK_BYTES_LEN bytes). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + @param iv Pointer to the initialization vector (IV) used for the counter. + @param blockIndex The index of the current block to be encrypted, used to compute the counter value. + */ +void encryptBlockThreadedCTR(const unsigned char *input, unsigned char *output, + unsigned char *roundKeys, AESKeyLength keyLength, + const unsigned char *lastData, + unsigned int blockIndex) +{ + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char counter[BLOCK_BYTES_LEN]; + + memcpy(counter, lastData, BLOCK_BYTES_LEN); + + for (int j = BLOCK_BYTES_LEN - 1, k = blockIndex; j >= 0; --j) { + counter[j] += (k % 256); + if (counter[j] != 0) + break; + k /= 256; + } + + encryptBlock(counter, block, roundKeys, keyLength); + + xorBlocks(block, input, output, BLOCK_BYTES_LEN); +} + +/** + Encrypts multiple blocks of data using AES in CTR mode with multithreading. + This function divides the input plaintext into blocks and encrypts each block + in parallel using multiple threads in CTR (Counter) mode. The function ensures + that each block is encrypted using AES with a counter value derived from the + initialization vector (IV) and block index, and all threads are joined before completing. + @param plaintext Pointer to the input plaintext data to be encrypted. + @param ciphertext Pointer to the buffer where the encrypted ciphertext will be stored. + @param length The total length of the plaintext data (must be a multiple of BLOCK_BYTES_LEN). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + @param iv Pointer to the initialization vector (IV) used for the counter. + */ +void encryptCTRMultithreaded(const unsigned char *plaintext, + unsigned char *ciphertext, unsigned int length, + unsigned char *roundKeys, AESKeyLength keyLength, + const unsigned char *lastData) +{ + unsigned int numBlocks = length / BLOCK_BYTES_LEN; + std::vector threads; + + for (unsigned int i = 0; i < numBlocks; ++i) { + threads.push_back(std::thread(encryptBlockThreadedCTR, + &plaintext[i * BLOCK_BYTES_LEN], + &ciphertext[i * BLOCK_BYTES_LEN], + roundKeys, keyLength, lastData, i)); + } + + for (auto &th : threads) { + th.join(); + } +} + +/** + Decrypts a single block of data using AES in CTR mode. + This function handles the decryption of a single block in CTR (Counter) mode. + It computes the counter value based on the given initialization vector (IV) and + block index, encrypts the counter, and then XORs the encrypted counter with the + input block to produce the output block. + @param input Pointer to the input block of ciphertext data (BLOCK_BYTES_LEN bytes). + @param output Pointer to the output block where the decrypted plaintext will be stored (BLOCK_BYTES_LEN bytes). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + @param iv Pointer to the initialization vector (IV) used for the counter. + @param blockIndex The index of the current block to be decrypted, used to compute the counter value. + */ +void decryptBlockThreadedCTR(const unsigned char *input, unsigned char *output, + unsigned char *roundKeys, AESKeyLength keyLength, + const unsigned char *lastData, + unsigned int blockIndex) +{ + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char counter[BLOCK_BYTES_LEN]; + + memcpy(counter, lastData, BLOCK_BYTES_LEN); + + for (int j = BLOCK_BYTES_LEN - 1, k = blockIndex; j >= 0; --j) { + counter[j] += (k % 256); + if (counter[j] != 0) + break; + k /= 256; + } + + encryptBlock(counter, block, roundKeys, keyLength); + + xorBlocks(block, input, output, BLOCK_BYTES_LEN); +} + +/** + Decrypts multiple blocks of data using AES in CTR mode with multithreading. + This function divides the input ciphertext into blocks and decrypts each block + in parallel using multiple threads in CTR (Counter) mode. The function ensures + that each block is decrypted using AES with a counter value derived from the + initialization vector (IV) and block index, and all threads are joined before completing. + @param ciphertext Pointer to the input ciphertext data to be decrypted. + @param plaintext Pointer to the buffer where the decrypted plaintext will be stored. + @param length The total length of the ciphertext data (must be a multiple of BLOCK_BYTES_LEN). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + @param iv Pointer to the initialization vector (IV) used for the counter. + */ +void decryptCTRMultithreaded(const unsigned char *ciphertext, + unsigned char *plaintext, unsigned int length, + unsigned char *roundKeys, AESKeyLength keyLength, + const unsigned char *lastData) +{ + unsigned int numBlocks = length / BLOCK_BYTES_LEN; + std::vector threads; + + for (unsigned int i = 0; i < numBlocks; ++i) + threads.push_back(std::thread(decryptBlockThreadedCTR, + &ciphertext[i * BLOCK_BYTES_LEN], + &plaintext[i * BLOCK_BYTES_LEN], + roundKeys, keyLength, lastData, i)); + + for (auto &th : threads) + th.join(); +} + +void AESCtr::encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) +{ + generateRandomIV(iv); + memcpy(lastData, iv, BLOCK_BYTES_LEN); + encrypt(block, inLen, key, out, outLen - BLOCK_BYTES_LEN, iv, lastData, + keyLength); + memcpy(out + outLen - BLOCK_BYTES_LEN, iv, BLOCK_BYTES_LEN); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN * 2, BLOCK_BYTES_LEN); + this->key = new unsigned char[keyLength]; + memcpy(this->key, key, keyLength); + this->keyLength = keyLength; +} + +void AESCtr::encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen) +{ + encrypt(block, inLen, key, out, outLen, lastData, lastData, keyLength); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCtr::decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + memcpy(lastData, iv, BLOCK_BYTES_LEN); + memcpy(iv, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); + decrypt(block, inLen - BLOCK_BYTES_LEN, key, out, outLen, + block + inLen - BLOCK_BYTES_LEN, lastData, keyLength); + memcpy(lastBlock, block + inLen - 2 * BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCtr::decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) +{ + decrypt(block, inLen, key, out, outLen, lastData, lastData, keyLength); + memcpy(lastBlock, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESCtr::encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + size_t paddedLength = getPaddedLength(inLen); + unsigned char *paddedIn = new unsigned char[paddedLength]; + padMessage(in, inLen, paddedIn); + + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * AES_STATE_ROWS]; + keyExpansion(key, roundKeys, keyLength); + + encryptCTRMultithreaded(paddedIn, out, outLen, roundKeys, keyLength, iv); + delete[] paddedIn; + delete[] roundKeys; +} + +void AESCtr::decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + checkLength(inLen); + outLen = inLen; + + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * AES_STATE_ROWS]; + keyExpansion(key, roundKeys, keyLength); + + decryptCTRMultithreaded(in, out, outLen, roundKeys, keyLength, iv); + outLen = getUnpadMessageLength(out, inLen); + delete[] roundKeys; +} \ No newline at end of file diff --git a/hsm-server/src/aes_ecb.cpp b/hsm-server/src/aes_ecb.cpp new file mode 100644 index 00000000..489b7d09 --- /dev/null +++ b/hsm-server/src/aes_ecb.cpp @@ -0,0 +1,162 @@ +#include "../include/aes_stream.h" +#include +#include +#include +#include "../include/debug_utils.h" +#include "../include/aes_stream.h" +/** + Encrypts a single block of data using AES in ECB mode. + This function wraps the `encryptBlock` function to allow it to be used + in a threaded context. It performs AES encryption on a single block of + plaintext using the provided round keys and key length. + @param in Pointer to the input block of plaintext data (BLOCK_BYTES_LEN bytes). + @param out Pointer to the output block where the encrypted ciphertext will be stored (BLOCK_BYTES_LEN bytes). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + */ +void encryptBlockThreadedECB(const unsigned char in[], unsigned char out[], + unsigned char *roundKeys, AESKeyLength keyLength) +{ + encryptBlock(in, out, roundKeys, keyLength); +} + +/** + Encrypts multiple blocks of data using AES in ECB mode with multithreading. + This function divides the input plaintext into blocks and encrypts each block + in parallel using multiple threads. The function ensures that each block is + encrypted using AES in ECB mode, and all threads are joined before completing. + @param plaintext Pointer to the input plaintext data to be encrypted. + @param ciphertext Pointer to the buffer where the encrypted ciphertext will be stored. + @param length The total length of the plaintext data (must be a multiple of BLOCK_BYTES_LEN). + @param roundKeys Pointer to the array of round keys used for AES encryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + */ +void encryptECBMultithreaded(const unsigned char *plaintext, + unsigned char *ciphertext, unsigned int length, + unsigned char *roundKeys, AESKeyLength keyLength) +{ + unsigned int numBlocks = length / BLOCK_BYTES_LEN; + std::vector threads; + + for (unsigned int i = 0; i < numBlocks; ++i) { + threads.push_back(std::thread( + encryptBlockThreadedECB, &plaintext[i * BLOCK_BYTES_LEN], + &ciphertext[i * BLOCK_BYTES_LEN], roundKeys, keyLength)); + } + + for (auto &th : threads) { + th.join(); + } +} + +/** + Decrypts a single block of data using AES in ECB mode. + This function wraps the `decryptBlock` function to allow it to be used + in a threaded context. It performs AES decryption on a single block of + ciphertext using the provided round keys and key length. + @param input Pointer to the input block of ciphertext data (BLOCK_BYTES_LEN bytes). + @param output Pointer to the output block where the decrypted plaintext will be stored (BLOCK_BYTES_LEN bytes). + @param roundKeys Pointer to the array of round keys used for AES decryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + */ +void decryptBlockThreadedECB(const unsigned char *input, unsigned char *output, + unsigned char *roundKeys, AESKeyLength keyLength) +{ + decryptBlock(input, output, roundKeys, keyLength); +} + +/** + Decrypts multiple blocks of data using AES in ECB mode with multithreading. + This function divides the input ciphertext into blocks and decrypts each block + in parallel using multiple threads in ECB (Electronic Codebook) mode. The function + ensures that each block is decrypted using AES with the provided round keys, and + all threads are joined before completing. + @param ciphertext Pointer to the input ciphertext data to be decrypted. + @param plaintext Pointer to the buffer where the decrypted plaintext will be stored. + @param length The total length of the ciphertext data (must be a multiple of BLOCK_BYTES_LEN). + @param roundKeys Pointer to the array of round keys used for AES decryption. + @param keyLength The length of the AES key being used (e.g., AES_KEY_LENGTH_128, AES_KEY_LENGTH_192, AES_KEY_LENGTH_256). + */ +void decryptECBMultithreaded(const unsigned char *ciphertext, + unsigned char *plaintext, unsigned int length, + unsigned char *roundKeys, AESKeyLength keyLength) +{ + unsigned int numBlocks = length / BLOCK_BYTES_LEN; + std::vector threads; + + for (unsigned int i = 0; i < numBlocks; i++) + threads.push_back(std::thread( + decryptBlockThreadedECB, &ciphertext[i * BLOCK_BYTES_LEN], + &plaintext[i * BLOCK_BYTES_LEN], roundKeys, keyLength)); + + for (auto &th : threads) + th.join(); +} + +void AESEcb::encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) +{ + encrypt(block, inLen, key, out, outLen, nullptr, nullptr, keyLength); + this->key = new unsigned char[keyLength]; + memcpy(this->key, key, keyLength); + this->keyLength = keyLength; +} + +void AESEcb::encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen) +{ + encrypt(block, inLen, key, out, outLen, nullptr, nullptr, keyLength); +} + +void AESEcb::decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + decrypt(block, inLen, key, out, outLen, nullptr, nullptr, keyLength); +} + +void AESEcb::decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) +{ + decrypt(block, inLen, key, out, outLen, nullptr, nullptr, keyLength); +} + +void AESEcb::encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + size_t paddedLength = getPaddedLength(inLen); + unsigned char *paddedIn = new unsigned char[paddedLength]; + padMessage(in, inLen, paddedIn); + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + memcpy(block, paddedIn + i, BLOCK_BYTES_LEN); + encryptECBMultithreaded(block, out + i, BLOCK_BYTES_LEN, roundKeys, + keyLength); + } + delete[] paddedIn; + delete[] roundKeys; +} + +void AESEcb::decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + checkLength(inLen); + outLen = inLen; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) + decryptECBMultithreaded(in, out, outLen, roundKeys, keyLength); + outLen = getUnpadMessageLength(out, inLen); + delete[] roundKeys; +} \ No newline at end of file diff --git a/hsm-server/src/aes_ofb.cpp b/hsm-server/src/aes_ofb.cpp new file mode 100644 index 00000000..d084838b --- /dev/null +++ b/hsm-server/src/aes_ofb.cpp @@ -0,0 +1,92 @@ +#include "../include/aes_stream.h" + +void AESOfb::encryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen, + unsigned char *key, AESKeyLength keyLength) +{ + generateRandomIV(iv); + memcpy(lastData, iv, BLOCK_BYTES_LEN); + encrypt(block, inLen, key, out, outLen - BLOCK_BYTES_LEN, iv, lastData, + keyLength); + memcpy(out + outLen - BLOCK_BYTES_LEN, iv, BLOCK_BYTES_LEN); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN * 2, BLOCK_BYTES_LEN); + this->key = new unsigned char[keyLength]; + memcpy(this->key, key, keyLength); + this->keyLength = keyLength; +} + +void AESOfb::encryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int outLen) +{ + encrypt(block, inLen, key, out, outLen, lastBlock, lastData, keyLength); + memcpy(lastBlock, out + outLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESOfb::decryptStart(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + memcpy(lastData, iv, BLOCK_BYTES_LEN); + memcpy(iv, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); + decrypt(block, inLen - BLOCK_BYTES_LEN, key, out, outLen, + block + inLen - BLOCK_BYTES_LEN, lastData, keyLength); + memcpy(lastBlock, block + inLen - 2 * BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESOfb::decryptContinue(unsigned char block[], unsigned int inLen, + unsigned char *out, unsigned int &outLen) +{ + decrypt(block, inLen, key, out, outLen, lastBlock, lastData, keyLength); + memcpy(lastBlock, block + inLen - BLOCK_BYTES_LEN, BLOCK_BYTES_LEN); +} + +void AESOfb::encrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + size_t paddedLength = getPaddedLength(inLen); + unsigned char *paddedIn = new unsigned char[paddedLength]; + padMessage(in, inLen, paddedIn); + unsigned char block[BLOCK_BYTES_LEN]; + unsigned char feedback[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(feedback, lastData, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + encryptBlock(feedback, block, roundKeys, keyLength); + xorBlocks(paddedIn + i, block, out + i, BLOCK_BYTES_LEN); + for (unsigned int j = 0; j < BLOCK_BYTES_LEN; ++j) + out[i + j] = paddedIn[i + j] ^ block[j]; + memcpy(feedback, block, BLOCK_BYTES_LEN); + memcpy(lastData, feedback, BLOCK_BYTES_LEN); + } + delete[] paddedIn; + delete[] roundKeys; +} + +void AESOfb::decrypt(unsigned char in[], unsigned int inLen, unsigned char *key, + unsigned char *out, unsigned int &outLen, + const unsigned char *iv, unsigned char *lastData, + AESKeyLength keyLength) +{ + checkLength(inLen); + unsigned char block[BLOCK_BYTES_LEN]; + outLen = inLen; + unsigned char feedback[BLOCK_BYTES_LEN]; + unsigned char *roundKeys = + new unsigned char[(aesKeyLengthData[keyLength].numRound + 1) * + NUM_BLOCKS * 4]; + keyExpansion(key, roundKeys, keyLength); + memcpy(feedback, lastData, BLOCK_BYTES_LEN); + for (unsigned int i = 0; i < outLen; i += BLOCK_BYTES_LEN) { + encryptBlock(feedback, block, roundKeys, keyLength); + xorBlocks(in + i, block, out + i, BLOCK_BYTES_LEN); + memcpy(feedback, block, BLOCK_BYTES_LEN); + memcpy(lastData, feedback, BLOCK_BYTES_LEN); + } + outLen = getUnpadMessageLength(out, inLen); + delete[] roundKeys; +} \ No newline at end of file diff --git a/hsm-server/src/big_int10.cpp b/hsm-server/src/big_int10.cpp new file mode 100644 index 00000000..6380c89f --- /dev/null +++ b/hsm-server/src/big_int10.cpp @@ -0,0 +1,567 @@ +#include +#include +#include +#include "../include/big_int10.h" +#include "../include/big_int_utils.h" +using namespace std; + +BigInt10::BigInt10(const std::string &str) +{ + initFromString(str.c_str(), str.size()); +} + +BigInt10::BigInt10(const char *str) +{ + initFromString(str, std::strlen(str)); +} + +BigInt10::BigInt10(long long val) +{ + isNegative = val < 0; + do { + limbs.push_back(val % 10); + val /= 10; + } while (val != 0); +} + +BigInt10::BigInt10(uint64_t uval) +{ + isNegative = false; + do { + limbs.push_back(uval % 10); + uval /= 10; + } while (uval != 0); +} + +BigInt10::BigInt10(bool isNegative) : BigInt10(0) +{ + this->isNegative = isNegative; +} + +BigInt10::BigInt10(int val) : BigInt10(static_cast(val)) {} + +bool BigInt10::operator==(const BigInt10 &b) const +{ + return limbs == b.limbs && isNegative == b.isNegative; +} + +bool BigInt10::operator!=(const BigInt10 &b) const +{ + return !(*this == b); +} + +bool BigInt10::operator<(const BigInt10 &b) const +{ + if (isNegative && !b.isNegative) + return true; + + if (!isNegative && b.isNegative) + return false; + + // same sign + if (isNegative) + return b.isSmallerThanUnsigned(*this); + + else + return isSmallerThanUnsigned(b); +} + +bool BigInt10::operator>(const BigInt10 &b) const +{ + return b < *this; +} + +bool BigInt10::operator<=(const BigInt10 &b) const +{ + return !(b < *this); +} + +bool BigInt10::operator>=(const BigInt10 &b) const +{ + return !(*this < b); +} + +BigInt10 &BigInt10::operator++() +{ + if (!isNegative) + prefixPlusPlusUnsigned(); + else { + prefixMinusMinusUnsigned(); + if (isZero()) + //-1 -> 0 + isNegative = false; + } + + return *this; +} + +BigInt10 BigInt10::operator++(int) +{ + BigInt10 temp = *this; + ++*this; + return temp; +} + +BigInt10 &BigInt10::operator--() +{ + if (isNegative) + prefixPlusPlusUnsigned(); + else { + if (isZero()) { + // 0 -> -1 + limbs[0] = 1; + isNegative = true; + } + else + prefixMinusMinusUnsigned(); + } + + return *this; +} +BigInt10 BigInt10::operator--(int) +{ + BigInt10 temp = *this; + --*this; + return temp; +} + +void BigInt10::thisEqualsbBSubthis(const BigInt10 &b) +{ + BigInt10 copyB(b); + copyB.subtractUnsigned(*this); // copyB-=this + *this = std::move(copyB); +} + +BigInt10 &BigInt10::operator+=(const BigInt10 &b) +{ + if (isNegative == b.isNegative) // same sign + addUnsigned(b); + else if (isNegative && !b.isSmallerThanUnsigned(*this) || + !isNegative && isSmallerThanUnsigned(b)) { + // -3 + +4/-3 + +3 || +3 + -4 + thisEqualsbBSubthis(b); + isNegative = b.isNegative; + } + else // -4 + +3 || +3 + -3 / +4 + -3 + subtractUnsigned(b); // this-=b + return *this; +} + +BigInt10 BigInt10::operator+(const BigInt10 &b) const +{ + BigInt10 c(*this); + c += b; + return c; +} + +BigInt10 &BigInt10::operator-=(const BigInt10 &b) +{ + if (isNegative != b.isNegative) // -this - +b / +a - -b + addUnsigned(b); + else if (isNegative && !b.isSmallerThanUnsigned(*this) || + !isNegative && (isSmallerThanUnsigned(b))) { + // -3 - -4/ -4 - -4 || +3 - +7 + thisEqualsbBSubthis(b); + isNegative = !b.isNegative; + } + else // -4 - -3 ||+4 - +3/ +3 - +3 + subtractUnsigned(b); // this-=b + return *this; +} + +BigInt10 BigInt10::operator-(const BigInt10 &b) const +{ + BigInt10 c(*this); + c -= b; + return c; +} + +BigInt10 &BigInt10::operator*=(const BigInt10 &b) +{ + *this = karatzubaMultiply(*this, b); + return *this; +} + +BigInt10 BigInt10::operator*(const BigInt10 &b) const +{ + BigInt10 c(*this); + c *= b; + return c; +} + +BigInt10 &BigInt10::operator/=(const BigInt10 &b) +{ + BigInt10 remainder; + *this = longDivision(*this, b, remainder); + return *this; +} + +BigInt10 BigInt10::operator/(const BigInt10 &b) const +{ + BigInt10 c(*this); + c /= b; + return c; +} + +BigInt10 &BigInt10::operator%=(const BigInt10 &b) +{ + BigInt10 remainder; + longDivision(*this, b, remainder); + *this = remainder; + return *this; +} + +BigInt10 BigInt10::operator%(const BigInt10 &b) const +{ + BigInt10 c(*this); + c %= b; + return c; +} + +BigInt10 &BigInt10::operator^=(const BigInt10 &b) +{ + *this = power(*this, b); + return *this; +} + +BigInt10 BigInt10::operator^(const BigInt10 &b) const +{ + BigInt10 c(*this); + c ^= b; + return c; +} + +std::string BigInt10::toString() const +{ + std::ostringstream oss; + oss << *this; + return oss.str(); +} + +uint64_t BigInt10::toU64() const +{ + BigInt10 base = MAX_VAL_64; + if (base.isSmallerThanUnsigned(*this)) + throw std::invalid_argument("this bigger than uint64"); + + uint64_t result = 0; + for (int i = limbsCount() - 1; i >= 0; i--) { + result *= 10; + result += limbs[i]; + } + + return result; +} + +void BigInt10::removeLeadingZeros() +{ + while (limbs.size() > 1 && limbs.back() == 0) + limbs.pop_back(); +} + +bool BigInt10::isZero() const +{ + return limbsCount() == 1 && limbs[0] == 0; +} + +int BigInt10::limbsCount() const +{ + return limbs.size(); +} + +void BigInt10::insertZroes(int n) +{ + limbs.insert(limbs.begin(), n, 0); +} + +bool BigInt10::isSmallerThanUnsigned(const BigInt10 &b) const +{ + if (limbsCount() > b.limbsCount()) + // a is longer + return false; + + if (limbsCount() < b.limbsCount()) + // b is longer + return true; + + // same length + for (int i = limbsCount() - 1; i >= 0; i--) + if (limbs[i] != b.limbs[i]) + return limbs[i] < b.limbs[i]; + + // they are equal + return false; +} + +void BigInt10::prefixPlusPlusUnsigned() +{ + int i, n = limbsCount(); + // zero alll the MAX_VAL lsb's + for (i = 0; i < n && limbs[i] == MAX_VAL_10; i++) { + limbs[i] = 0; + } + + if (i == n) + // it was all MAX_VAL + limbs.push_back(1); + else + limbs[i]++; +} + +void BigInt10::prefixMinusMinusUnsigned() +{ + if (isZero()) + throw std::invalid_argument("cant --0"); + + int i = 0, n = limbsCount(); + // starting zeros case 0 0 0 X + while (i < n && limbs[i] == 0) { + limbs[i] = MAX_VAL_10; + i++; + } + + limbs[i]--; // subtruct the first valid limb + // remove leading zero if exists + if (limbs[i] == 0 && i != 0) + limbs.pop_back(); +} + +void BigInt10::addUnsigned(const BigInt10 &b) +{ + int n = limbsCount(), m = b.limbsCount(); + uint8_t carry = 0; //(1/0) + uint8_t bLimb; + if (n < m) { + limbs.resize(m); + n = m; + } + + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + adder3_10(limbs[i], bLimb, carry, limbs[i], carry); + } + + if (carry == 1) + limbs.push_back(carry); +} + +void BigInt10::subtractUnsigned(const BigInt10 &b) +{ + if (this->isSmallerThanUnsigned(b)) + // make sure this>=b; + throw std::invalid_argument("cant -: this < b"); + + int n = limbsCount(), m = b.limbsCount(); + int borrow = 0; //(1/0) + uint8_t bLimb; + + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + if ((borrow == 1 && limbs[i] == 0) || (limbs[i] - borrow < bLimb)) { + // need to borrow from next limb + limbs[i] = limbs[i] + (bLimb == 0 ? 10 : toBase10(bLimb)) - borrow; + borrow = 1; + } + else { + limbs[i] = limbs[i] - bLimb - borrow; + borrow = 0; + } + } + + removeLeadingZeros(); +} + +BigInt10 longMultiplication(const BigInt10 &a, const BigInt10 &b) +{ + if (a.isZero() || b.isZero()) + return BigInt10(); + + int n = a.limbsCount(), m = b.limbsCount(); + std::vector result(n + m, 0); + uint8_t high, low, carry; + + for (int i = 0; i < n; i++) { + carry = 0; + for (int j = 0; j < m; j++) { + mul2Limbs10(a.limbs[i], b.limbs[j], high, low); + adder3_10(low, result[i + j], carry, result[i + j], carry); + carry = high + carry; + } + + // Handle any remaining carry after the inner loop + result[i + m] = carry; + } + + BigInt10 res; + res.limbs = std::move(result); + res.removeLeadingZeros(); // Remove leading zeros + res.isNegative = a.isNegative != b.isNegative; + return res; +} + +BigInt10 longDivision(const BigInt10 &a, const BigInt10 &b, BigInt10 &remainder) +{ + if (b.isZero()) + throw std::invalid_argument("Invalid input: non-digit character"); + + remainder.isNegative = false; + if (a.isSmallerThanUnsigned(b)) { + remainder.limbs = a.limbs; + return BigInt10(); + } + + remainder.limbs.clear(); + std::vector quotient; + + for (int i = a.limbsCount() - 1; i >= 0; i--) { // msb-lsb + remainder.limbs.insert(remainder.limbs.begin(), + a.limbs[i]); // insert msb as lsb + if (remainder.limbsCount() > 1 && remainder.limbs.back() == 0) + remainder.limbs.pop_back(); // remove 1 leading zero + int times = 0; + if (!remainder.isSmallerThanUnsigned(b)) { + int left = 1, right = 9; + while (left <= right) { + int mid = left + (right - left) / 2; + if (!remainder.isSmallerThanUnsigned( + b * mid)) { // b*times<=remainder + times = mid; + if (left == right) + break; + left = mid + 1; + } + else + right = mid - 1; + } + + remainder.subtractUnsigned(b * times); + } + + if (quotient.size() > 0 || times > 0) + quotient.push_back(times); + } + + std::reverse(quotient.begin(), quotient.end()); + BigInt10 quoti(a.isNegative != b.isNegative); + quoti.limbs = std::move(quotient); + return quoti; +} + +BigInt10 power(BigInt10 base, BigInt10 exponent) +{ + if (exponent.isNegative) + throw std::invalid_argument("Invalid input: negative exponent"); + + BigInt10 result(1); + while (!exponent.isZero()) { + if (exponent.limbs[0] & 1) { + result *= base; + } + + base *= base; + exponent /= 2; + } + + return result; +} + +void BigInt10::initFromString(const char *str, int n) +{ + isNegative = str[0] == '-'; + limbs.reserve(n); + for (int i = n - 1; i >= isNegative; i--) { + uint8_t digit = str[i] - '0'; + if (!isDigit10(digit)) + throw std::invalid_argument("Invalid input: non-digit character"); + + limbs.push_back(digit); + } +} + +std::ostream &operator<<(std::ostream &out, const BigInt10 &a) +{ + if (a.isNegative) + out << '-'; + for (int i = a.limbsCount() - 1; i >= 0; i--) + out << static_cast(a.limbs[i]); + return out; +} + +BigInt10 modularExponentiation(BigInt10 base, BigInt10 exponent, + const BigInt10 &modulus) +{ + BigInt10 res(1); + base %= modulus; + while (!exponent.isZero()) { + if (exponent.limbs[0] & 1) + res = (res * base) % modulus; + res = (res * res) % modulus; + exponent /= 2; + } + + return res; +} + +BigInt10 gcd(BigInt10 a, BigInt10 b) +{ + while (!b.isZero()) { + BigInt10 copyB = b; + b = a % b; + a = copyB; + } + + return a; +} + +BigInt10 karatzubaMultiply(const BigInt10 &a, const BigInt10 &b) +{ + int n = a.limbsCount(), m = b.limbsCount(); + if (n == 1 || m == 1) + return longMultiplication(a, b); + + const BigInt10 *longerX, *shorterY; + int xLen, yLen; + if (n >= m) { + longerX = &a; + xLen = n; + shorterY = &b; + yLen = m; + } + else { + longerX = &b; + xLen = m; + shorterY = &a; + yLen = n; + } + + int xLsbHalf = xLen / 2; + int yLsbHalf = min(xLsbHalf, yLen); + BigInt10 xM, xL, yL, yM; + xM.limbs.reserve(xLen - xLsbHalf); + xL.limbs.reserve(xLsbHalf); + yM.limbs.reserve(yLen - yLsbHalf); + yL.limbs.reserve(yLsbHalf); + // M L + // xM aL =longer <-[L M], [xL ...... xM] + // yM bL =shorter<-[L M], [yL yM] + xL.limbs.assign(longerX->limbs.begin(), longerX->limbs.begin() + xLsbHalf); + xL.removeLeadingZeros(); + xM.limbs.assign(longerX->limbs.begin() + xLsbHalf, + longerX->limbs.begin() + xLen); + yL.limbs.assign(shorterY->limbs.begin(), + shorterY->limbs.begin() + yLsbHalf); + yL.removeLeadingZeros(); + if (yLen - yLsbHalf != 0) + yM.limbs.assign(shorterY->limbs.begin() + yLsbHalf, + shorterY->limbs.begin() + yLen); + + BigInt10 sum4Mult = karatzubaMultiply(xL + xM, yL + yM); + BigInt10 xyL = karatzubaMultiply(xL, yL); + BigInt10 xyM = karatzubaMultiply(xM, yM); + BigInt10 xLyM_xMyL = sum4Mult - xyL - xyM; + xyM.insertZroes(xLsbHalf * 2); + xLyM_xMyL.insertZroes(xLsbHalf); + BigInt10 res = xyM + xLyM_xMyL + xyL; + res.isNegative = a.isNegative != b.isNegative; + return res; +} \ No newline at end of file diff --git a/hsm-server/src/big_int64.cpp b/hsm-server/src/big_int64.cpp new file mode 100644 index 00000000..0603d306 --- /dev/null +++ b/hsm-server/src/big_int64.cpp @@ -0,0 +1,1695 @@ +#include +#include +#include +#include +#include +#include "../include/big_int64.h" + +using namespace std; + +#ifdef USE_SYCL +BigInt64::BigInt64(const string &str) +{ + initFromString(str.c_str(), str.size()); +} + +BigInt64::BigInt64(const char *str) +{ + initFromString(str, std::strlen(str)); +} + +BigInt64::BigInt64(const uint8_t *str, size_t strLen, CreateModes mode) + : isNegative(false) +{ + if (strLen == 0) { + size = 1; + limbs[0] = 0; + return; + } + int fullLimbs = strLen / BYTES_IN_LIMB; + int msbParts = strLen % BYTES_IN_LIMB; + int limbsCnt = fullLimbs + (msbParts + BYTES_IN_LIMB - 1) / BYTES_IN_LIMB; + size = limbsCnt; + if (mode == CreateModes::LITTLE_ENDIANESS) { + for (int i = 0; i < fullLimbs; i++) { + int index = strLen - 1 - i * BYTES_IN_LIMB; + // little endian-> {0,1,2,3,4,5,6,7} becones 0x 07 06 05 04 03 02 01 00 + limbs[i] = ((static_cast(str[index]) << 56) | + (static_cast(str[index - 1]) << 48) | + (static_cast(str[index - 2]) << 40) | + (static_cast(str[index - 3]) << 32) | + (static_cast(str[index - 4]) << 24) | + (static_cast(str[index - 5]) << 16) | + (static_cast(str[index - 6]) << 8) | + static_cast(str[index - 7])); + } + if (msbParts != 0) { + uint64_t msb = 0; + for (int i = 0; i < msbParts; i++) { + msb |= static_cast(str[i]) << (i * BITS_IN_BYTE); + } + limbs[size++] = msb; + } + } + else { + // big endian-> {0,1,2,3,4,5,6,7} becones 0x 00 01 02 03 04 05 06 07 + for (int i = 0; i < fullLimbs; i++) { + int index = strLen - 1 - i * BYTES_IN_LIMB; + limbs[i] = (static_cast(str[index]) | + (static_cast(str[index - 1]) << 8) | + (static_cast(str[index - 2]) << 16) | + (static_cast(str[index - 3]) << 24) | + (static_cast(str[index - 4]) << 32) | + (static_cast(str[index - 5]) << 40) | + (static_cast(str[index - 6]) << 48) | + (static_cast(str[index - 7]) << 56)); + } + if (msbParts != 0) { + uint64_t msb = 0; + for (int i = 0; i < msbParts; i++) { + msb |= static_cast(str[msbParts - 1 - i]) + << (i * BITS_IN_BYTE); + } + limbs[size++] = msb; + } + } + removeLeadingZeros(); +} + +BigInt64::BigInt64(CreateModes mode, int bits) : isNegative(false) +{ + if (bits >= BITS_IN_LIMB) + generateNLimbsRandom(bits / BITS_IN_LIMB); + bits = bits % BITS_IN_LIMB; // 0-63 + if (bits != 0) { + uint64_t one = static_cast(1); + limbs[size++] = randomLimb(0, (one << bits) - 1) | (one << (bits - 1)); + } + else + limbs[size - 1] |= 0x8000000000000000ULL; +} + +BigInt64::BigInt64(CreateModes mode, uint64_t min, const BigInt64 &max) + : size(0), isNegative(false) +{ + if (max.isSmallerThanUnsigned(min)) + throw invalid_argument("min must be <= max"); + + if (max.limbsCount() == 1) { + uint64_t number = randomLimb(min, max.limbs[max.size - 1]); + limbs[size++] = number; + } + else { + generateNLimbsRandom(max.limbsCount() - 1); + uint64_t number = randomLimb(0, max.limbs[max.size - 1]); + limbs[size++] = number; + removeLeadingZeros(); + } +} + +BigInt64::BigInt64(bool isNegative) : BigInt64(0) +{ + this->isNegative = isNegative; +} + +BigInt64::BigInt64(uint64_t uval) : size(0) +{ + isNegative = false; + limbs[size++] = uval; +} + +bool BigInt64::operator==(const BigInt64 &b) const +{ + if (isNegative != b.isNegative || size != b.size) + return false; + + for (int i = 0; i < size; i++) + if (limbs[i] != b.limbs[i]) + return false; + + return true; +} + +bool BigInt64::operator!=(const BigInt64 &b) const +{ + return !(*this == b); +} + +bool BigInt64::operator<(const BigInt64 &b) const +{ + if (isNegative && !b.isNegative) + return true; + + if (!isNegative && b.isNegative) + return false; + + // same sign + if (isNegative) + return b.isSmallerThanUnsigned(*this); + + else + return isSmallerThanUnsigned(b); +} + +bool BigInt64::operator>(const BigInt64 &b) const +{ + return b < *this; +} + +bool BigInt64::operator<=(const BigInt64 &b) const +{ + return !(b < *this); +} + +bool BigInt64::operator>=(const BigInt64 &b) const +{ + return !(*this < b); +} + +BigInt64 &BigInt64::operator++() +{ + if (!isNegative) + prefixPlusPlusUnsigned(); + else { + prefixMinusMinusUnsigned(); + if (isZero()) + //-1 -> 0 + isNegative = false; + } + + return *this; +} + +BigInt64 BigInt64::operator++(int) +{ + BigInt64 temp = *this; + ++*this; + return temp; +} + +BigInt64 &BigInt64::operator--() +{ + if (isNegative) + prefixPlusPlusUnsigned(); + else { + if (isZero()) { + // 0 -> -1 + limbs[0] = 1; + isNegative = true; + } + else + prefixMinusMinusUnsigned(); + } + return *this; +} + +BigInt64 BigInt64::operator--(int) +{ + BigInt64 temp = *this; + --*this; + return temp; +} + +BigInt64 &BigInt64::operator+=(const BigInt64 &b) +{ + if (isNegative == b.isNegative) // same sign + addUnsigned(b); + else { + if ((isNegative && !b.isSmallerThanUnsigned(*this)) || + (!isNegative && isSmallerThanUnsigned(b))) { + // -3 + +4/-3 + +3 || +3 + -4 + thisEqualsbBSubthis(b); + isNegative = b.isNegative; + } + else // -4 + +3 || +3 + -3 / +4 + -3 + subtractUnsigned(b); // this-=b + } + return *this; +} + +BigInt64 BigInt64::operator+(const BigInt64 &b) const +{ + BigInt64 c(*this); + c += b; + return c; +} + +BigInt64 &BigInt64::operator-=(const BigInt64 &b) +{ + if (isNegative != b.isNegative) // -this - +b / +a - -b + addUnsigned(b); + else { + if ((isNegative && !b.isSmallerThanUnsigned(*this)) || + (!isNegative && (isSmallerThanUnsigned(b)))) { + // -3 - -4/ -4 - -4 || +3 - +7 + thisEqualsbBSubthis(b); + isNegative = !b.isNegative; + } + else // -4 - -3 ||+4 - +3/ +3 - +3 + subtractUnsigned(b); // this-=b + } + + return *this; +} + +BigInt64 BigInt64::operator-(const BigInt64 &b) const +{ + BigInt64 c(*this); + c -= b; + return c; +} + +BigInt64 &BigInt64::operator*=(const BigInt64 &b) +{ + longMultiplication(b); + return *this; +} + +BigInt64 BigInt64::operator*(const BigInt64 &b) const +{ + BigInt64 c(*this); + c *= b; + return c; +} + +BigInt64 &BigInt64::operator/=(const BigInt64 &b) +{ + BigInt64 remainder, quotient; + longDivision(b, remainder, quotient); + *this = quotient; + return *this; +} + +BigInt64 BigInt64::operator/(const BigInt64 &b) const +{ + BigInt64 c(*this); + c /= b; + return c; +} + +BigInt64 &BigInt64::operator%=(const BigInt64 &b) +{ + BigInt64 remainder, quotient; + longDivision(b, remainder, quotient); + if (isNegative != b.isNegative) + *this = b - remainder; + else + *this = remainder; + return *this; +} + +BigInt64 BigInt64::operator%(const BigInt64 &b) const +{ + BigInt64 c(*this); + c %= b; + return c; +} + +BigInt64 &BigInt64::operator^=(const BigInt64 &b) +{ + *this = power(*this, b); + return *this; +} + +BigInt64 BigInt64::operator^(const BigInt64 &b) const +{ + BigInt64 c(*this); + c ^= b; + return c; +} + +BigInt64 &BigInt64::operator>>=(uint64_t n) +{ + rightShift(n); + return *this; +} + +BigInt64 BigInt64::operator>>(uint64_t n) const +{ + BigInt64 c(*this); + c >>= n; + return c; +} + +BigInt64 &BigInt64::operator<<=(uint64_t n) +{ + leftShift(n); + return *this; +} + +BigInt64 BigInt64::operator<<(uint64_t n) const +{ + BigInt64 c(*this); + c <<= n; + return c; +} + +std::ostream &operator<<(std::ostream &out, const BigInt64 &a) +{ + if (a.limbsCount() == 1) { + if (a.isNegative) + out << "-"; + out << a.limbs[0]; + } + + else { + BigInt10 decimal = a.toDecimal(); + out << decimal; + } + + return out; +} + +bool BigInt64::isSmallerThanUnsigned(const BigInt64 &b) const +{ + if (limbsCount() > b.limbsCount()) + // a is longer + return false; + + if (limbsCount() < b.limbsCount()) + // b is longer + return true; + + // same length + for (int i = limbsCount() - 1; i >= 0; i--) + if (limbs[i] != b.limbs[i]) + return limbs[i] < b.limbs[i]; + + // they are equal + return false; +} + +void BigInt64::prefixPlusPlusUnsigned() +{ + int i, n = limbsCount(); + // zero alll the MAX_VAL_64 lsb's + for (i = 0; i < n && limbs[i] == MAX_VAL_64; i++) { + limbs[i] = 0; + } + if (i == n) + // it was all MAX_VAL_64 + limbs[size++] = 1; + else + limbs[i]++; +} + +void BigInt64::prefixMinusMinusUnsigned() +{ + if (isZero()) + return; + + int i = 0, n = limbsCount(); + // starting zeros case 0 0 0 X + while (i < n && limbs[i] == 0) { + limbs[i] = MAX_VAL_64; + i++; + } + limbs[i]--; // subtruct the first valid limb + // remove leading zero if exists + if (limbs[i] == 0 && i != 0) + size--; +} + +void BigInt64::addUnsigned(const BigInt64 &b) +{ + int n = limbsCount(), m = b.limbsCount(); + uint64_t carry = 0; //(1/0) + uint64_t bLimb; + if (n < m) { + setLimbs(0, m - n, 1, m); + n = m; + } + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + adder3_64(limbs[i], bLimb, carry, limbs[i], carry); + } + if (carry == 1) + limbs[size++] = carry; +} + +void BigInt64::subtractUnsigned(const BigInt64 &b) +{ + if (this->isSmallerThanUnsigned(b)) + // make sure this>=b; + return; + + int n = limbsCount(), m = b.limbsCount(); + int borrow = 0; //(1/0) + uint64_t bLimb; + + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + if ((borrow == 1 && limbs[i] == 0) || (limbs[i] - borrow < bLimb)) { + // need to borrow from next limb + limbs[i] = limbs[i] + toBase64(bLimb) - borrow; + borrow = 1; + } + else { + limbs[i] = limbs[i] - bLimb - borrow; + borrow = 0; + } + } + removeLeadingZeros(); +} + +void BigInt64::longMultiplication(const BigInt64 &b) +{ + if (isZero() || b.isZero()) { + zero(); + return; + } + int n = limbsCount(), m = b.limbsCount(); + uint64_t result[200] = {0}; + uint64_t high, low, carry; + + for (int i = 0; i < n; i++) { + carry = 0; + for (int j = 0; j < m; j++) { + mul2Limbs64(limbs[i], b.limbs[j], high, low); + adder3_64(low, result[i + j], carry, result[i + j], carry); + carry += high; + } + result[i + m] = carry; + } + size = m + n; + copyLimbsFrom(result, 0, size, 0, size); + removeLeadingZeros(); + isNegative = isNegative != b.isNegative; +} + +std::string BigInt64::toString() const +{ + std::ostringstream oss; + oss << *this; + return oss.str(); +} + +void BigInt64::exportTo(uint8_t *out, size_t outLen, CreateModes mode) const +{ + if (outLen < bytesCount()) + throw std::runtime_error("Not enough space in output buffer"); + + if (mode == CreateModes::LITTLE_ENDIANESS) + for (int i = 0; i < limbsCount(); i++) + for (int j = 0; j < BYTES_IN_LIMB; j++) + out[outLen - 1 - i * BYTES_IN_LIMB - (7 - j)] = + static_cast(limbs[i] >> (j * BITS_IN_BYTE)); + else + for (int i = 0; i < limbsCount(); i++) + for (int j = 0; j < BYTES_IN_LIMB; j++) + out[outLen - 1 - i * BYTES_IN_LIMB - j] = + static_cast(limbs[i] >> (j * BITS_IN_BYTE)); +} + +int BigInt64::bitsCount() const +{ + if (isZero()) + return 0; + + uint64_t mostSignificantLimb = limbs[size - 1]; + int inMsb = ::bitsCount(mostSignificantLimb); + return inMsb + (limbsCount() - 1) * BITS_IN_LIMB; +} + +void BigInt64::thisEqualsbBSubthis(const BigInt64 &b) +{ + BigInt64 copyB(b); + copyB.subtractUnsigned(*this); + *this = std::move(copyB); +} + +void BigInt64::removeLeadingZeros() +{ + while (size > 1 && limbs[size - 1] == 0) + size--; +} + +void BigInt64::insert(int n, uint64_t limb) +{ + for (int i = size - 1; i >= 0; i--) + limbs[i + n] = limbs[i]; + for (int i = 0; i < n; i++) + limbs[i] = limb; + size += n; +} + +void BigInt64::erase(int n) +{ + for (int i = 0; i < n; i++) + limbs[i] = limbs[i + n]; + size -= n; +} + +void BigInt64::generateNLimbsRandom(int limbsCnt) +{ + if (limbsCnt < 1) + throw std::invalid_argument("limbsCnt less than 1"); + + std::random_device rd; + std::mt19937_64 gen(rd()); + std::uniform_int_distribution distrib(0, UINT64_MAX); + size = limbsCnt; + + for (int i = 0; i < limbsCnt; i++) { + uint64_t number = distrib(gen); + limbs[i] = number; + } +} + +uint64_t BigInt64::randomLimb(uint64_t min, uint64_t max) +{ + if (min > max) + throw std::invalid_argument("cant random limb"); + + std::random_device rd; + std::mt19937_64 gen(rd()); + std::uniform_int_distribution distrib(min, max); + return distrib(gen); +} + +void BigInt64::zero() +{ + size = 1; + limbs[0] = 0; + isNegative = false; +} + +bool BigInt64::hasLeadingZero() +{ + return limbs[size - 1] == 0 && limbsCount() > 1; +} + +void BigInt64::copyLimbsFrom(const uint64_t *other, size_t otherStart, + size_t count, size_t meStart, size_t newSize) +{ + for (int i = 0; i < count; i++) + limbs[meStart + i] = other[otherStart + i]; + size = newSize; +} + +void BigInt64::reverse() +{ + int start = 0; + int end = size - 1; + + while (start < end) { + uint64_t temp = limbs[start]; + limbs[start] = limbs[end]; + limbs[end] = temp; + start++; + end--; + } +} + +void BigInt64::setLimbs(uint64_t val, size_t count, size_t meStart, + size_t newSize) +{ + for (int i = 0; i < count; i++) + limbs[meStart + i] = val; + size = newSize; +} + +void BigInt64::longDivision(const BigInt64 &b, BigInt64 &remainder, + BigInt64 "ient) const +{ + if (b.isZero()) + return; + + remainder.isNegative = b.isNegative; + if (isSmallerThanUnsigned(b)) { + remainder.copyLimbsFrom(limbs, 0, size, 0, size); + quotient.zero(); + return; + } + + remainder.size = 0; + quotient.size = 0; + + for (int i = limbsCount() - 1; i >= 0; i--) { // msb-lsb + remainder.insert(1, limbs[i]); // insert msb as lsb + if (remainder.hasLeadingZero()) + remainder.size--; // remove leading zero + uint64_t times = 0; + if (!remainder.isSmallerThanUnsigned(b)) { + uint64_t left = 1, right = MAX_VAL_64; + // after inserting next limb, most times t contains b is max value + // of singe limb, find in range of [0...max] + while (left <= right) { + uint64_t mid = left + (right - left) / 2; + if (!remainder.isSmallerThanUnsigned( + b * mid)) { // b*mid<=remainder + times = mid; + if (left == right) + break; + left = mid + 1; + } + else + right = mid - 1; + } + + remainder.subtractUnsigned(b * times); + } + + if (quotient.size > 0 || times > 0) + quotient.limbs[quotient.size++] = times; + } + + quotient.reverse(); + quotient.isNegative = isNegative != b.isNegative; +} +BigInt64 power(BigInt64 base, BigInt64 exponent) +{ + if (exponent.isNegative) + throw std::invalid_argument("Invalid input: negative exponent"); + + BigInt64 result(1); + + while (!exponent.isZero()) { + if (!exponent.isEven()) + result *= base; + base *= base; + exponent >>= 1; + } + + return result; +} + +BigInt10 BigInt64::toDecimal() const +{ + BigInt10 decimal; + BigInt10 base(MAX_VAL_64); + base++; + for (int i = limbsCount() - 1; i >= 0; i--) { + BigInt10 limb = limbs[i]; + decimal *= base; + decimal += limb; + } + + decimal.isNegative = isNegative; + return decimal; +} + +void BigInt64::initFromString(const char *str, int n) +{ + BigInt10 decimal = str; + size = 0; + isNegative = decimal.isNegative; + BigInt10 base = MAX_VAL_64; + base++; + if (decimal.isZero()) + limbs[size++] = 0; + else + while (!decimal.isZero()) { + limbs[size++] = (decimal % base).toU64(); + decimal /= base; + } +} + +BigInt64 gcd(BigInt64 a, BigInt64 b) +{ + a.isNegative = false; + b.isNegative = false; + while (!b.isZero()) { + BigInt64 copyB = b; + b = a % b; + a = copyB; + } + + return a; +} + +void BigInt64::rightShift(uint64_t n) +{ + if (n >= bitsCount()) { + zero(); + return; + } + uint64_t shiftEachLimb = n % BITS_IN_LIMB; + uint64_t dropLimbs = n / BITS_IN_LIMB; + if (shiftEachLimb != 0) { + for (int i = 0; i < limbsCount() - 1 - dropLimbs; i++) // lsb...msb + limbs[i] = limbs[i + dropLimbs] >> shiftEachLimb | + limbs[i + dropLimbs + 1] + << (BITS_IN_LIMB - shiftEachLimb); + limbs[limbsCount() - 1 - dropLimbs] >>= shiftEachLimb; + size -= dropLimbs; + if (hasLeadingZero() && !isZero()) + size--; + } + else + erase(dropLimbs); +} + +void BigInt64::leftShift(uint64_t n) +{ + if (n >= bitsCount()) { + zero(); + return; + } + + uint64_t shiftEachLimb = n % BITS_IN_LIMB; + uint64_t dropLimbs = n / BITS_IN_LIMB; + if (shiftEachLimb != 0) { + for (int i = limbsCount() - 1; i > dropLimbs; i--) { // msb-lst + limbs[i] = + limbs[i - dropLimbs] << shiftEachLimb | + limbs[i - dropLimbs - 1] >> (BITS_IN_LIMB - shiftEachLimb); + } + + limbs[0] <<= shiftEachLimb; + } + else { + for (int i = limbsCount() - 1; i >= dropLimbs; i--) + limbs[i] = limbs[i - dropLimbs]; + for (int i = dropLimbs - 1; i >= 0; i--) + limbs[i] = 0; + } + + removeLeadingZeros(); +} + +BigInt64 extendedGcd(BigInt64 a, BigInt64 b, BigInt64 &x, BigInt64 &y) +{ + x = 1; + y = 0; + BigInt64 x1 = 0, y1 = 1; + BigInt64 q, temp; + + while (b != 0) { + q = a / b; + temp = b; + b = a % b; + a = temp; + + temp = x1; + + x1 = x - q * x1; + x = temp; + + temp = y1; + y1 = y - q * y1; + y = temp; + } + + return a; +} + +BigInt64 modularInverse(BigInt64 a, BigInt64 b) +{ + BigInt64 x, y; + BigInt64 gcdResult = extendedGcd(a, b, x, y); + if (gcdResult != 1) + throw std::invalid_argument("Modular inverse does not exist."); + + return x % b; // Ensure result is positive +} + +size_t BigInt64::bytesCount() const +{ + return limbsCount() * BYTES_IN_LIMB; +} + +bool BigInt64::isZero() const +{ + return limbsCount() == 1 && limbs[0] == 0; +} + +int BigInt64::limbsCount() const +{ + return size; +} + +std::uint64_t BigInt64::getMsb() const +{ + return limbs[size - 1]; +} + +std::uint64_t BigInt64::getLsb() const +{ + return limbs[0]; +} + +bool BigInt64::isEven() const +{ + return (limbs[0] & 1) == 0; +} +#else +BigInt64::BigInt64(const string &str) +{ + initFromString(str.c_str(), str.size()); +} + +BigInt64::BigInt64(const char *str) +{ + initFromString(str, std::strlen(str)); +} + +BigInt64::BigInt64(const uint8_t *str, size_t strLen, CreateModes mode) + : isNegative(false) +{ + if (strLen == 0) { + limbs.push_back(0); + return; + } + + int fullLimbs = strLen / BYTES_IN_LIMB; + int msbParts = strLen % BYTES_IN_LIMB; + int limbsCnt = fullLimbs + (msbParts + BYTES_IN_LIMB - 1) / BYTES_IN_LIMB; + limbs.reserve(limbsCnt); + if (mode == CreateModes::LITTLE_ENDIANESS) { + for (int i = 0; i < fullLimbs; i++) { + int index = strLen - 1 - i * BYTES_IN_LIMB; + // little endian-> {0,1,2,3,4,5,6,7} becones 0x 07 06 05 04 03 02 01 00 + limbs.push_back((static_cast(str[index]) << 56) | + (static_cast(str[index - 1]) << 48) | + (static_cast(str[index - 2]) << 40) | + (static_cast(str[index - 3]) << 32) | + (static_cast(str[index - 4]) << 24) | + (static_cast(str[index - 5]) << 16) | + (static_cast(str[index - 6]) << 8) | + static_cast(str[index - 7])); + } + + if (msbParts != 0) { + uint64_t msb = 0; + for (int i = 0; i < msbParts; i++) + msb |= static_cast(str[i]) << (i * BITS_IN_BYTE); + limbs.push_back(msb); + } + } + else { + // big endian-> {0,1,2,3,4,5,6,7} becones 0x 00 01 02 03 04 05 06 07 + for (int i = 0; i < fullLimbs; i++) { + int index = strLen - 1 - i * BYTES_IN_LIMB; + limbs.push_back(static_cast(str[index]) | + (static_cast(str[index - 1]) << 8) | + (static_cast(str[index - 2]) << 16) | + (static_cast(str[index - 3]) << 24) | + (static_cast(str[index - 4]) << 32) | + (static_cast(str[index - 5]) << 40) | + (static_cast(str[index - 6]) << 48) | + (static_cast(str[index - 7]) << 56)); + } + + if (msbParts != 0) { + uint64_t msb = 0; + for (int i = 0; i < msbParts; i++) { + msb |= static_cast(str[msbParts - 1 - i]) + << (i * BITS_IN_BYTE); + } + + limbs.push_back(msb); + } + } + + removeLeadingZeros(); +} + +BigInt64::BigInt64(std::vector v, bool isNegative) + : limbs(v), isNegative(isNegative) +{ +} + +BigInt64::BigInt64(CreateModes mode, int bits) : isNegative(false) +{ + if (bits >= BITS_IN_LIMB) + generateNLimbsRandom(bits / BITS_IN_LIMB); + bits = bits % BITS_IN_LIMB; // 0-63 + if (bits != 0) { + uint64_t one = static_cast(1); + limbs.push_back(randomLimb(0, (one << bits) - 1) | (one << (bits - 1))); + } + else + limbs.back() |= 0x8000000000000000ULL; +} + +BigInt64::BigInt64(CreateModes mode, uint64_t min, const BigInt64 &max) + : isNegative(false) +{ + if (max.isSmallerThanUnsigned(min)) + throw invalid_argument("min must be <= max"); + + if (max.limbsCount() == 1) { + uint64_t number = randomLimb(min, max.limbs.back()); + limbs.push_back(number); + } + else { + generateNLimbsRandom(max.limbsCount() - 1); + uint64_t number = randomLimb(0, max.limbs.back()); + limbs.push_back(number); + removeLeadingZeros(); + } +} + +BigInt64::BigInt64(long long val) +{ + isNegative = false; + if (val == 0) { + limbs.push_back(0); + return; + } + + if (val < 0) { + isNegative = true; + val *= -1; + } + + limbs.push_back(val); +} + +BigInt64::BigInt64(bool isNegative) : BigInt64(0) +{ + this->isNegative = isNegative; +} + +BigInt64::BigInt64(uint64_t uval) +{ + isNegative = false; + limbs.push_back(uval); +} + +BigInt64::BigInt64(int val) : BigInt64(static_cast(val)) {} + +bool BigInt64::operator==(const BigInt64 &b) const +{ + return limbs == b.limbs && isNegative == b.isNegative; +} + +bool BigInt64::operator!=(const BigInt64 &b) const +{ + return !(*this == b); +} + +bool BigInt64::operator<(const BigInt64 &b) const +{ + if (isNegative && !b.isNegative) + return true; + + if (!isNegative && b.isNegative) + return false; + + // same sign + if (isNegative) + return b.isSmallerThanUnsigned(*this); + + else + return isSmallerThanUnsigned(b); +} + +bool BigInt64::operator>(const BigInt64 &b) const +{ + return b < *this; +} + +bool BigInt64::operator<=(const BigInt64 &b) const +{ + return !(b < *this); +} + +bool BigInt64::operator>=(const BigInt64 &b) const +{ + return !(*this < b); +} + +BigInt64 &BigInt64::operator++() +{ + if (!isNegative) + prefixPlusPlusUnsigned(); + else { + prefixMinusMinusUnsigned(); + if (isZero()) + //-1 -> 0 + isNegative = false; + } + + return *this; +} + +BigInt64 BigInt64::operator++(int) +{ + BigInt64 temp = *this; + ++*this; + return temp; +} + +BigInt64 &BigInt64::operator--() +{ + if (isNegative) + prefixPlusPlusUnsigned(); + else { + if (isZero()) { + // 0 -> -1 + limbs[0] = 1; + isNegative = true; + } + else + prefixMinusMinusUnsigned(); + } + + return *this; +} + +BigInt64 BigInt64::operator--(int) +{ + BigInt64 temp = *this; + --*this; + return temp; +} + +BigInt64 &BigInt64::operator+=(const BigInt64 &b) +{ + if (isNegative == b.isNegative) // same sign + addUnsigned(b); + else { + if (isNegative && !b.isSmallerThanUnsigned(*this) || + !isNegative && isSmallerThanUnsigned(b)) { + // -3 + +4/-3 + +3 || +3 + -4 + thisEqualsbBSubthis(b); + isNegative = b.isNegative; + } + else // -4 + +3 || +3 + -3 / +4 + -3 + subtractUnsigned(b); // this-=b + } + + return *this; +} + +BigInt64 BigInt64::operator+(const BigInt64 &b) const +{ + BigInt64 c(*this); + c += b; + return c; +} + +BigInt64 &BigInt64::operator-=(const BigInt64 &b) +{ + if (isNegative != b.isNegative) // -this - +b / +a - -b + addUnsigned(b); + else { + if (isNegative && !b.isSmallerThanUnsigned(*this) || + !isNegative && (isSmallerThanUnsigned(b))) { + // -3 - -4/ -4 - -4 || +3 - +7 + thisEqualsbBSubthis(b); + isNegative = !b.isNegative; + } + else // -4 - -3 ||+4 - +3/ +3 - +3 + subtractUnsigned(b); // this-=b + } + + return *this; +} + +BigInt64 BigInt64::operator-(const BigInt64 &b) const +{ + BigInt64 c(*this); + c -= b; + return c; +} + +BigInt64 &BigInt64::operator*=(const BigInt64 &b) +{ + *this = longMultiplication(*this, b); + return *this; +} + +BigInt64 BigInt64::operator*(const BigInt64 &b) const +{ + BigInt64 c(*this); + c *= b; + return c; +} +BigInt64 &BigInt64::operator/=(const BigInt64 &b) +{ + BigInt64 remainder; + *this = longDivision(*this, b, remainder); + return *this; +} + +BigInt64 BigInt64::operator/(const BigInt64 &b) const +{ + BigInt64 c(*this); + c /= b; + return c; +} + +BigInt64 &BigInt64::operator%=(const BigInt64 &b) +{ + BigInt64 remainder; + longDivision(*this, b, remainder); + if (isNegative != b.isNegative) + *this = b - remainder; + else + *this = remainder; + return *this; +} + +BigInt64 BigInt64::operator%(const BigInt64 &b) const +{ + BigInt64 c(*this); + c %= b; + return c; +} + +BigInt64 &BigInt64::operator^=(const BigInt64 &b) +{ + *this = power(*this, b); + return *this; +} + +BigInt64 BigInt64::operator^(const BigInt64 &b) const +{ + BigInt64 c(*this); + c ^= b; + return c; +} + +BigInt64 &BigInt64::operator>>=(uint64_t n) +{ + rightShift(n); + return *this; +} + +BigInt64 BigInt64::operator>>(uint64_t n) const +{ + BigInt64 c(*this); + c >>= n; + return c; +} + +BigInt64 &BigInt64::operator<<=(uint64_t n) +{ + leftShift(n); + return *this; +} + +BigInt64 BigInt64::operator<<(uint64_t n) const +{ + BigInt64 c(*this); + c <<= n; + return c; +} + +std::ostream &operator<<(std::ostream &out, const BigInt64 &a) +{ + if (a.limbsCount() == 1) { + if (a.isNegative) + out << "-"; + out << a.limbs[0]; + } + else { + BigInt10 decimal = a.toDecimal(); + out << decimal; + } + + return out; +} + +bool BigInt64::isSmallerThanUnsigned(const BigInt64 &b) const +{ + if (limbsCount() > b.limbsCount()) + // a is longer + return false; + + if (limbsCount() < b.limbsCount()) + // b is longer + return true; + + // same length + for (int i = limbsCount() - 1; i >= 0; i--) + if (limbs[i] != b.limbs[i]) + return limbs[i] < b.limbs[i]; + + // they are equal + return false; +} + +void BigInt64::prefixPlusPlusUnsigned() +{ + int i, n = limbsCount(); + // zero alll the MAX_VAL_64 lsb's + for (i = 0; i < n && limbs[i] == MAX_VAL_64; i++) + limbs[i] = 0; + if (i == n) + // it was all MAX_VAL_64 + limbs.push_back(1); + else + limbs[i]++; +} + +void BigInt64::prefixMinusMinusUnsigned() +{ + if (isZero()) + throw std::invalid_argument("cant --0"); + + int i = 0, n = limbsCount(); + // starting zeros case 0 0 0 X + while (i < n && limbs[i] == 0) { + limbs[i] = MAX_VAL_64; + i++; + } + + limbs[i]--; // subtruct the first valid limb + // remove leading zero if exists + if (limbs[i] == 0 && i != 0) + limbs.pop_back(); +} + +void BigInt64::addUnsigned(const BigInt64 &b) +{ + int n = limbsCount(), m = b.limbsCount(); + uint64_t carry = 0; //(1/0) + uint64_t bLimb; + if (n < m) { + limbs.resize(m); + n = m; + } + + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + adder3_64(limbs[i], bLimb, carry, limbs[i], carry); + } + + if (carry == 1) + limbs.push_back(carry); +} + +void BigInt64::subtractUnsigned(const BigInt64 &b) +{ + if (this->isSmallerThanUnsigned(b)) + // make sure this>=b; + throw std::invalid_argument("cant -: this < b"); + + int n = limbsCount(), m = b.limbsCount(); + int borrow = 0; //(1/0) + uint64_t bLimb; + + for (int i = 0; i < n; i++) { + bLimb = i < m ? b.limbs[i] : 0; + if ((borrow == 1 && limbs[i] == 0) || (limbs[i] - borrow < bLimb)) { + // need to borrow from next limb + limbs[i] = limbs[i] + toBase64(bLimb) - borrow; + borrow = 1; + } + else { + limbs[i] = limbs[i] - bLimb - borrow; + borrow = 0; + } + } + + removeLeadingZeros(); +} +BigInt64 longMultiplication(const BigInt64 &a, const BigInt64 &b) +{ + if (a.isZero() || b.isZero()) + return BigInt64(); + + int n = a.limbsCount(), m = b.limbsCount(); + std::vector result(n + m, 0); + uint64_t high, low, carry; + + for (int i = 0; i < n; i++) { + carry = 0; + for (int j = 0; j < m; j++) { + mul2Limbs64(a.limbs[i], b.limbs[j], high, low); + adder3_64(low, result[i + j], carry, result[i + j], carry); + carry += high; + } + // Handle any remaining carry after the inner loop + result[i + m] = carry; + } + + BigInt64 res; + res.limbs = std::move(result); + res.removeLeadingZeros(); + res.isNegative = a.isNegative != b.isNegative; + return res; +} + +void BigInt64::exportTo(uint8_t *out, size_t outLen, CreateModes mode) const +{ + if (outLen < bytesCount()) + throw std::runtime_error("Not enough space in output buffer"); + + if (mode == CreateModes::LITTLE_ENDIANESS) + for (int i = 0; i < limbsCount(); i++) + for (int j = 0; j < BYTES_IN_LIMB; j++) + out[outLen - 1 - i * BYTES_IN_LIMB - (7 - j)] = + static_cast(limbs[i] >> (j * BITS_IN_BYTE)); + else + for (int i = 0; i < limbsCount(); i++) + for (int j = 0; j < BYTES_IN_LIMB; j++) + out[outLen - 1 - i * BYTES_IN_LIMB - j] = + static_cast(limbs[i] >> (j * BITS_IN_BYTE)); +} + +int BigInt64::bitsCount() const +{ + if (isZero()) + return 0; + + // Count bits in the most significant limb manually + uint64_t mostSignificantLimb = limbs.back(); + int inMsb = ::bitsCount(mostSignificantLimb); + return inMsb + (limbsCount() - 1) * BITS_IN_LIMB; +} + +void BigInt64::thisEqualsbBSubthis(const BigInt64 &b) +{ + BigInt64 copyB(b); + copyB.subtractUnsigned(*this); + *this = std::move(copyB); +} + +void BigInt64::removeLeadingZeros() +{ + while (limbs.size() > 1 && limbs.back() == 0) + limbs.pop_back(); +} + +void BigInt64::insertZroes(int n) +{ + limbs.insert(limbs.begin(), n, 0); +} + +void BigInt64::generateNLimbsRandom(int limbsCnt) +{ + if (limbsCnt < 1) + throw std::invalid_argument("limbsCnt less than 1"); + + std::random_device rd; + std::mt19937_64 gen(rd()); + std::uniform_int_distribution distrib(0, UINT64_MAX); + + limbs.reserve(limbsCnt); + + for (int i = 0; i < limbsCnt; i++) { + uint64_t number = distrib(gen); + limbs.push_back(number); + } +} + +uint64_t BigInt64::randomLimb(uint64_t min, uint64_t max) +{ + if (min > max) + throw std::invalid_argument("cant random limb"); + + std::random_device rd; + std::mt19937_64 gen(rd()); + std::uniform_int_distribution distrib(min, max); + return distrib(gen); +} + +void BigInt64::zero() +{ + limbs.clear(); + limbs.push_back(0); + isNegative = false; +} + +BigInt64 longDivision(const BigInt64 &a, const BigInt64 &b, BigInt64 &remainder) +{ + if (b.isZero()) + throw std::invalid_argument("Invalid input: non-digit character"); + + remainder.isNegative = b.isNegative; + if (a.isSmallerThanUnsigned(b)) { + remainder.limbs = a.limbs; + return BigInt64(); + } + + remainder.limbs.clear(); + std::vector quotient; + + for (int i = a.limbsCount() - 1; i >= 0; i--) { // msb-lsb + remainder.limbs.insert(remainder.limbs.begin(), + a.limbs[i]); // insert msb as lsb + if (remainder.limbsCount() > 1 && remainder.limbs.back() == 0) + remainder.limbs.pop_back(); // remove leading zero + uint64_t times = 0; + if (!remainder.isSmallerThanUnsigned(b)) { + uint64_t left = 1, right = MAX_VAL_64; + // after inserting next limb, most times t contains b is max value + // of singe limb, find in range of [0...max] + while (left <= right) { + uint64_t mid = left + (right - left) / 2; + if (!remainder.isSmallerThanUnsigned( + b * mid)) { // b*mid<=remainder + times = mid; + if (left == right) + break; + left = mid + 1; + } + else + right = mid - 1; + } + + remainder.subtractUnsigned(b * times); + } + if (quotient.size() > 0 || times > 0) + quotient.push_back(times); + } + + std::reverse(quotient.begin(), quotient.end()); + BigInt64 quoti(a.isNegative != b.isNegative); + quoti.limbs = std::move(quotient); + return quoti; +} + +BigInt64 power(BigInt64 base, BigInt64 exponent) +{ + if (exponent.isNegative) + throw std::invalid_argument("Invalid input: negative exponent"); + + BigInt64 result(1); + while (!exponent.isZero()) { + if (!exponent.isEven()) { + result *= base; + } + base *= base; + exponent >>= 1; + } + + return result; +} + +BigInt10 BigInt64::toDecimal() const +{ + BigInt10 decimal; + BigInt10 base(MAX_VAL_64); + base++; + for (int i = limbsCount() - 1; i >= 0; i--) { + BigInt10 limb = limbs[i]; + decimal *= base; + decimal += limb; + } + + decimal.isNegative = isNegative; + return decimal; +} + +void BigInt64::initFromString(const char *str, int n) +{ + BigInt10 decimal = str; + isNegative = decimal.isNegative; + BigInt10 base = MAX_VAL_64; + base++; + if (decimal.isZero()) + limbs.push_back(0); + else + while (!decimal.isZero()) { + limbs.push_back((decimal % base).toU64()); + decimal /= base; + } +} + +BigInt64 modularExponentiation(BigInt64 base, BigInt64 exponent, + const BigInt64 &modulus) +{ + BigInt64 res(1); + base %= modulus; + while (!exponent.isZero()) { + if (!exponent.isEven()) + res = (res * base) % modulus; + base = (base * base) % modulus; + exponent >>= 1; + } + + return res; +} + +BigInt64 gcd(BigInt64 a, BigInt64 b) +{ + a.isNegative = false; + b.isNegative = false; + while (!b.isZero()) { + BigInt64 copyB = b; + b = a % b; + a = copyB; + } + + return a; +} + +BigInt64 karatzubaMultiplication(const BigInt64 &a, const BigInt64 &b) +{ + int n = a.limbsCount(), m = b.limbsCount(); + if (n == 1 || m == 1) + return longMultiplication(a, b); + + const BigInt64 *longerX, *shorterY; + int xLen, yLen; + if (n >= m) { + longerX = &a; + xLen = n; + shorterY = &b; + yLen = m; + } + else { + longerX = &b; + xLen = m; + shorterY = &a; + yLen = n; + } + + int xLsbHalf = xLen / 2; + int yLsbHalf = min(xLsbHalf, yLen); + BigInt64 xM, xL, yL, yM; + xM.limbs.reserve(xLen - xLsbHalf); + xL.limbs.reserve(xLsbHalf); + yM.limbs.reserve(yLen - yLsbHalf); + yL.limbs.reserve(yLsbHalf); + // Msb Lsb + // xM aL =longer <-[L M], [xL ...... xM] + // yM bL =shorter<-[L M], [yL yM] + xL.limbs.assign(longerX->limbs.begin(), longerX->limbs.begin() + xLsbHalf); + xL.removeLeadingZeros(); + xM.limbs.assign(longerX->limbs.begin() + xLsbHalf, + longerX->limbs.begin() + xLen); + yL.limbs.assign(shorterY->limbs.begin(), + shorterY->limbs.begin() + yLsbHalf); + yL.removeLeadingZeros(); + if (yLen - yLsbHalf != 0) + yM.limbs.assign(shorterY->limbs.begin() + yLsbHalf, + shorterY->limbs.begin() + yLen); + BigInt64 sum4Mult = karatzubaMultiplication(xL + xM, yL + yM); + BigInt64 xyL = karatzubaMultiplication(xL, yL); + BigInt64 xyM = karatzubaMultiplication(xM, yM); + BigInt64 xLyM_xMyL = sum4Mult - xyL - xyM; + xyM.insertZroes(xLsbHalf * 2); + xLyM_xMyL.insertZroes(xLsbHalf); + BigInt64 res = xyM + xLyM_xMyL + xyL; + res.isNegative = a.isNegative != b.isNegative; + return res; +} + +void BigInt64::rightShift(uint64_t n) +{ + if (n >= bitsCount()) { + zero(); + return; + } + uint64_t shiftEachLimb = n % BITS_IN_LIMB; + uint64_t dropLimbs = n / BITS_IN_LIMB; + if (shiftEachLimb != 0) { + for (int i = 0; i < limbsCount() - 1 - dropLimbs; i++) // lsb...msb + limbs[i] = limbs[i + dropLimbs] >> shiftEachLimb | + limbs[i + dropLimbs + 1] + << (BITS_IN_LIMB - shiftEachLimb); + limbs[limbsCount() - 1 - dropLimbs] >>= shiftEachLimb; + limbs.resize(limbsCount() - dropLimbs); + if (limbs.back() == 0 && !isZero()) + limbs.pop_back(); + } + else + limbs.erase(limbs.begin(), limbs.begin() + dropLimbs); +} + +void BigInt64::leftShift(uint64_t n) +{ + if (n >= bitsCount()) { + zero(); + return; + } + uint64_t shiftEachLimb = n % BITS_IN_LIMB; + uint64_t dropLimbs = n / BITS_IN_LIMB; + if (shiftEachLimb != 0) { + for (int i = limbsCount() - 1; i > dropLimbs; i--) { // msb-lst + limbs[i] = + limbs[i - dropLimbs] << shiftEachLimb | + limbs[i - dropLimbs - 1] >> (BITS_IN_LIMB - shiftEachLimb); + } + limbs[0] <<= shiftEachLimb; + } + else { + for (int i = limbsCount() - 1; i >= dropLimbs; i--) + limbs[i] = limbs[i - dropLimbs]; + for (int i = dropLimbs - 1; i >= 0; i--) + limbs[i] = 0; + } + + removeLeadingZeros(); +} + +BigInt64 extendedGcd(BigInt64 a, BigInt64 b, BigInt64 &x, BigInt64 &y) +{ + x = 1; + y = 0; + BigInt64 x1 = 0, y1 = 1; + BigInt64 q, temp; + + while (b != 0) { + q = a / b; + temp = b; + b = a % b; + a = temp; + + temp = x1; + + x1 = x - q * x1; + x = temp; + + temp = y1; + y1 = y - q * y1; + y = temp; + } + + return a; +} + +BigInt64 modularInverse(BigInt64 a, BigInt64 b) +{ + BigInt64 x, y; + BigInt64 gcdResult = extendedGcd(a, b, x, y); + if (gcdResult != 1) + throw std::invalid_argument("Modular inverse does not exist."); + + return x % b; // Ensure result is positive +} + +size_t BigInt64::bytesCount() const +{ + return limbsCount() * BYTES_IN_LIMB; +} + +std::string BigInt64::toString() const +{ + std::ostringstream oss; + oss << *this; + return oss.str(); +} + +bool BigInt64::isZero() const +{ + return limbsCount() == 1 && limbs[0] == 0; +} + +int BigInt64::limbsCount() const +{ + return limbs.size(); +} + +bool BigInt64::isEven() const +{ + return (limbs[0] & 1) == 0; +} +#endif \ No newline at end of file diff --git a/hsm-server/src/crypto_api.cpp b/hsm-server/src/crypto_api.cpp new file mode 100644 index 00000000..be2e7374 --- /dev/null +++ b/hsm-server/src/crypto_api.cpp @@ -0,0 +1,1613 @@ +#include +#include +#include +#include +#include +#include "../include/crypto_api.h" +#include "../include/hash_factory.h" +#include "../include/rsa.h" +#include "../include/temp_hsm.h" +#include "../logger/logger.h" +#include "../include/debug_utils.h" + +std::map> mapToInMiddleEncryptions; +std::map> mapToInMiddleDecryptions; +std::map, size_t>> mapToInMiddleHashing; + +constexpr size_t BITS_IN_BYTE = 8; +constexpr size_t ECC_CIPHER_LENGTH = 512; +constexpr size_t ECC_MAX_DECRYPTED_LENGTH = 256; + +int getCountFromEncryptions(int userID) +{ + auto it = mapToInMiddleEncryptions.find(userID); + if (it != mapToInMiddleEncryptions.end()) + return it->second.second; + + return 0; +} + +int getCountFromDecryptions(int userID) +{ + auto it = mapToInMiddleDecryptions.find(userID); + if (it != mapToInMiddleDecryptions.end()) + return it->second.second; + return 0; +} + +int getCountFromHashing(int userID) +{ + auto it = mapToInMiddleHashing.find(userID); + if (it != mapToInMiddleHashing.end()) + return it->second.second; + return 0; +} + +std::string keyPermissionToString(KeyPermission permission) +{ + switch (permission) { + case VERIFY: + return "VERIFY"; + case SIGN: + return "SIGN"; + case ENCRYPT: + return "ENCRYPT"; + case DECRYPT: + return "DECRYPT"; + case EXPORTABLE: + return "EXPORTABLE"; + default: + return "UNKNOWN"; + } +} + +std::string permissionsToString(const std::vector &permissions) +{ + std::ostringstream oss; + for (size_t i = 0; i < permissions.size(); ++i) { + oss << keyPermissionToString(permissions[i]); + if (i != permissions.size() - 1) { + oss << ", "; + } + } + return oss.str(); +} + +/** + * @brief Boot the system by generating asymmetric keys for users. + * + * This function logs the start of the boot process, iterates over a map of user IDs and + * their associated key permissions, and generates ECC and RSA key pairs for each user. + * + * @param usersIdspermissions A map where each key is a user ID (int), and the value is a + * vector of KeyPermission objects representing the user's permissions. + * + * @return CKR_OK on successful completion of the key generation process. + */ +CK_RV bootSystem( + const std::map> &usersIdspermissions) +{ + log(logger::LogLevel::INFO, "Boot: Booting system started..."); + + for (const auto &[userId, permissions] : usersIdspermissions) { + if (permissions.empty()) { + log(logger::LogLevel::ERROR, + "Boot: User ID: " + std::to_string(userId) + + " did not send any permissions."); + return CKR_ARGUMENTS_BAD; + } + + // Generate ECC and RSA key pairs + std::pair eccIds = + TempHsm::getInstance().generateECCKeyPair(userId, permissions); + std::pair rsaIds = + TempHsm::getInstance().generateRSAKeyPair(userId, permissions); + + // Log the generated key IDs + log(logger::LogLevel::INFO, + "Boot: Generated asymmetric keys for User ID: " + + std::to_string(userId) + ". ECC Key IDs (Public, Private): (" + + eccIds.first + ", " + eccIds.second + + "), RSA Key IDs (Public, Private): (" + rsaIds.first + ", " + + rsaIds.second + + "), Permissions: " + permissionsToString(permissions)); + } + + return CKR_OK; +} + +/** + * @brief Adds a user to the HSM by generating asymmetric keys for a user. + * + * This function adds a user to the HSM, it generates ECC and RSA + * key pairs for the specified user based on their permissions. + * + * @param userId The ID of the user that is being added. + * @param permissions A vector of KeyPermission objects representing the + * permissions associated with the user. + * + * @return CKR_OK on successful completion of the process. + */ +CK_RV addProccess(int userId, std::vector &permissions) +{ + log(logger::LogLevel::INFO, + "AddProccess: adding proccess...\n Generating " + "assymetric keys for user: "); + if (permissions.empty()) { + log(logger::LogLevel::ERROR, "User ID: " + std::to_string(userId) + + " did not send no permissions."); + return CKR_ARGUMENTS_BAD; + } + log(logger::LogLevel::INFO, + "User ID: " + std::to_string(userId) + + ", Permissions: " + permissionsToString(permissions)); + TempHsm::getInstance().generateECCKeyPair(userId, permissions); + TempHsm::getInstance().generateRSAKeyPair(userId, permissions); + + return CKR_OK; +} + +//Configures the encryption settings for a specific user. +CK_RV configure(int userId, CryptoConfig config) +{ + log(logger::LogLevel::INFO, + "Configure: configuring user: " + std::to_string(userId)); + TempHsm::getInstance().configure(userId, config); + return CKR_OK; +} + +//Logs and handles error conditions for operations with only input buffers. +CK_RV logAndHandleErrors(std::string action, int userId, void *in, size_t inLen, + bool isStarting) +{ + if (isStarting) + log(logger::LogLevel::INFO, + "Starting " + action + " for user ID: " + std::to_string(userId)); + + // Check if 'in' is nullptr or has zero length + if (in == nullptr || inLen == 0) { + log(logger::LogLevel::ERROR, + action + " failed for user ID: " + std::to_string(userId) + + ". An empty buffer was provided for " + action + "."); + return CKR_EMPTY_BUFFER; + } + + return CKR_OK; // Return success if no errors occurred +} + +//Logs and handles error conditions for encryption/decryption operations with input and output buffers. +CK_RV logAndHandleErrors(std::string action, int userId, std::string keyId, + void *in, size_t inLen, void *out, size_t outLen, + size_t requiredLength, bool isStarting) +{ + // if (isStarting) + // log(logger::LogLevel::INFO, + // "Starting " + action + " for user ID: " + std::to_string(userId) + + // " with keyId: " + keyId); + + // // Check if 'in' is nullptr or has zero length + // if (in == nullptr || inLen == 0) { + // log(logger::LogLevel::ERROR, + // action + " failed for user ID: " + std::to_string(userId) + + // ". An empty buffer was provided for " + action + "."); + // return CKR_EMPTY_BUFFER; + // } + CK_RV returnCode = + logAndHandleErrors(action, userId, in, inLen, isStarting); + if (returnCode != CKR_OK) + return returnCode; + + // Check if 'out' is nullptr + if (out == nullptr) { + log(logger::LogLevel::ERROR, + action + " failed for user ID: " + std::to_string(userId) + + ". Output buffer is nullptr for " + action + "."); + return CKR_EMPTY_BUFFER; + } + + // Check if the allocated output buffer is too small + if (outLen < requiredLength) { + log(logger::LogLevel::ERROR, + action + " failed for user ID: " + std::to_string(userId) + + ". Insufficient memory allocated for the result. Required " + "size: " + + std::to_string(requiredLength) + " bytes."); + return CKR_BUFFER_TOO_SMALL; + } + + return CKR_OK; // Return success if no errors occurred +} + +CK_RV logAndHandleErrors(std::string action, int userId, std::string keyId, + void *in, size_t inLen, void *out, size_t outLen, + size_t requiredLength, bool isStarting, + AESKeyLength keyLen) +{ + CK_RV returnCode = logAndHandleErrors(action, userId, keyId, in, inLen, out, + outLen, requiredLength, isStarting); + if (returnCode != CKR_OK) + return returnCode; + + if (!isValidAESKeyLength(keyLen)) { + log(logger::LogLevel::ERROR, + "Invalid AES key length provided: " + std::to_string(keyLen) + + ". Supported lengths are 128, 192, or 256 bits."); + return CKR_KEY_SIZE_RANGE; + } + + return CKR_OK; +} + +#pragma region RSA and ECC + +// Serialize the EncryptedMessage to a void* buffer +void serializeToBuffer(const EncryptedMessage &message, uint8_t *out) +{ + size_t count1, count2; + std::vector buffer1, buffer2; + size_t offset = 0; + + buffer1.resize((mpz_sizeinbase(message.c1X.get_mpz_t(), 2) + 7) / + 8); // size in bytes + mpz_export(buffer1.data(), &count1, 1, 1, 0, 0, message.c1X.get_mpz_t()); + buffer1.resize(count1); // resize buffer to actual size after export + + buffer2.resize((mpz_sizeinbase(message.c2X.get_mpz_t(), 2) + 7) / + 8); // size in bytes + mpz_export(buffer2.data(), &count2, 1, 1, 0, 0, message.c2X.get_mpz_t()); + buffer2.resize(count2); // resize buffer to actual size after export + + // Store c1X (length followed by data) + std::memcpy(out + offset, &count1, sizeof(uint8_t)); + offset += sizeof(uint8_t); + std::memcpy(out + offset, buffer1.data(), count1); + offset += count1; + + // Store c1Y + std::memcpy(out + offset, &message.c1Y, sizeof(message.c1Y)); + offset += sizeof(message.c1Y); + + // Store c2X (length followed by data) + std::memcpy(out + offset, &count2, sizeof(uint8_t)); + offset += sizeof(uint8_t); + std::memcpy(out + offset, buffer2.data(), count2); + offset += count2; + + // Store c2Y + std::memcpy(out + offset, &message.c2Y, sizeof(message.c2Y)); +} + +// Deserialize the buffer back to EncryptedMessage +EncryptedMessage deserializeFromBuffer(const void *buffer, size_t bufferSize) +{ + size_t offset = 0; + const uint8_t *byteBuffer = static_cast(buffer); + + // Deserialize c1X + mpz_class c1X; + size_t count1 = byteBuffer[offset]; + offset += sizeof(uint8_t); + mpz_import(c1X.get_mpz_t(), count1, 1, 1, 0, 0, byteBuffer + offset); + offset += count1; + + // Deserialize c1Y + bool c1Y; + std::memcpy(&c1Y, byteBuffer + offset, sizeof(c1Y)); + offset += sizeof(c1Y); + + // Deserialize c2X + mpz_class c2X; + size_t count2 = byteBuffer[offset]; + offset += sizeof(uint8_t); + mpz_import(c2X.get_mpz_t(), count2, 1, 1, 0, 0, byteBuffer + offset); + offset += count2; + + // Deserialize c2Y + bool c2Y; + std::memcpy(&c2Y, byteBuffer + offset, sizeof(c2Y)); + + return EncryptedMessage(c1X, c1Y, c2X, c2Y); +} + +//Retrieves the encrypted length based on the asymmetric encryption function. +size_t getEncryptedLengthByAssymFunc(AsymmetricFunction func) +{ + if (func == RSA) + return getRSAencryptedLength(); + else + return getECCencryptedLength(); +} + +/** + * @brief Retrieves the length of RSA-encrypted data. + * + * This function calculates the length of the data encrypted using the RSA algorithm, + * based on a predefined RSA key size. + * + * @return The encrypted data length for RSA. + */ +size_t getRSAencryptedLength() +{ + return rsaGetEncryptedLen(RSA_KEY_SIZE); +} + +/** + * @brief Retrieves the length of RSA-decrypted data. + * + * This function calculates the length of data decrypted using the RSA algorithm, + * based on a predefined RSA key size. + * + * @return The decrypted data length for RSA. + */ +size_t getRSAdecryptedLength() +{ + return rsaGetDecryptedLen(RSA_KEY_SIZE); +} + +/** + * @brief Retrieves the length of ECC-encrypted data. + * + * This function calculates the length of the data encrypted using the Elliptic Curve Cryptography (ECC) algorithm. + * It factors in the ECC cipher length and related padding. + * + * @return The encrypted data length for ECC. + */ +size_t getECCencryptedLength() +{ + return 2 * (sizeof(uint8_t) + sizeof(bool)) + + ECC_CIPHER_LENGTH / BITS_IN_BYTE; +} + +/** + * @brief Retrieves the maximum length of ECC-decrypted data. + * + * This function returns the maximum length of data that can be decrypted using the ECC algorithm. + * + * @return The maximum decrypted data length for ECC. + */ +size_t getECCdecryptedLength() +{ + return ECC_MAX_DECRYPTED_LENGTH / BITS_IN_BYTE; +} + +/** + * @brief Retrieves the public ECC key id for a specific user. + * + * This function retrieves the public Elliptic Curve Cryptography (ECC) key ID associated with a user ID. + * + * @param userId The ID of the user whose public ECC key is requested. + * + * @return The public ECC key ID for the given user. + */ +std::string getPublicECCKeyByUserId(int userId) +{ + //todo: error no such user id + return TempHsm::getInstance().getPublicKeyIdByUserId( + userId, AsymmetricFunction::ECC); +} + +/** + * @brief Retrieves the public RSA key id for a specific user. + * + * This function retrieves the public RSA key ID associated with a user ID. + * + * @param userId The ID of the user whose public RSA key is requested. + * + * @return The public RSA key ID for the given user. + */ +std::string getPublicRSAKeyByUserId(int userId) +{ + //todo: error no such user id + return TempHsm::getInstance().getPublicKeyIdByUserId( + userId, AsymmetricFunction::RSA); +} + +// Retrieves the private ECC key id for a specific user. +std::string getPrivateECCKeyByUserId(int userId) +{ + //todo: error no such user id + return TempHsm::getInstance().getPrivateKeyIdByUserId( + userId, AsymmetricFunction::ECC); +} + +// Retrieves the private RSA key id for a specific user. +std::string getPrivateRSAKeyByUserId(int userId) +{ + //todo: error no such user id + return TempHsm::getInstance().getPrivateKeyIdByUserId( + userId, AsymmetricFunction ::RSA); +} + +/** + * @brief Encrypts data using Elliptic Curve Cryptography (ECC). + * + * This function performs ECC encryption on the input data using the specified sender ID and key ID. + * It retrieves the corresponding ECC public key from the HSM and encrypts the input data using the public key. + * The encrypted data is then serialized and stored in the output buffer. + * + * @param senderId The ID of the sender. + * @param keyId The ID of the ECC public key to be used for encryption. + * @param in The input data to be encrypted. + * @param inLen The length of the input data. + * @param out The buffer where the encrypted output will be stored. + * @param outLen The length of the encrypted output. + * @return CKR_OK on success or an appropriate error code on failure. + */ +CK_RV ECCencrypt(int senderId, std::string keyId, void *in, size_t inLen, + void *out, size_t &outLen) +{ + CK_RV error = + logAndHandleErrors("ECC Encryption", senderId, keyId, in, inLen, out, + outLen, getECCencryptedLength(), true); + if (error != CKR_OK) + return error; + + std::vector inVec(static_cast(in), + static_cast(in) + inLen); + Point eccPublicKey; + + try { + eccPublicKey = TempHsm::getInstance().getECCPublicKey( + senderId, keyId, KeyPermission::ENCRYPT); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to retrieve ECC public key for user id: " + + std::to_string(senderId) + ", keyId: " + keyId + + ". Error: " + e.what()); + return CKR_USER_NOT_AUTHORIZED; + } + + //perform ecc encryption + EncryptedMessage cipher = encryptECC(inVec, eccPublicKey); + + //cast cipher from EncryptedMessage to out buffer + serializeToBuffer(cipher, static_cast(out)); + + log(logger::LogLevel::INFO, + "Successfully completed ECC encryption for user id: " + + std::to_string(senderId)); + + return CKR_OK; +} + +// Decrypts data using Elliptic Curve Cryptography (ECC). +CK_RV ECCdecrypt(int receiverId, std::string keyId, void *in, size_t inLen, + void *out, size_t &outLen, size_t requiredOutLen) +{ + // std::string eccPrivateKeyString; + // try { + // eccPrivateKeyString = + // TempHsm::getInstance().getAuthorizedKey(receiverId, keyId, + // "DECRYPT"); + // } catch (std::exception &e) { + // return CKR_USER_NOT_AUTHORIZED; + // } + // mpz_class eccPrivateKey(eccPrivateKeyString); + // // Decrypt the message + // std::vector decryptedMessage = + // decryptECC(*(reinterpret_cast(in)), + // eccPrivateKey); + // outLen = decryptedMessage.size(); + // std::memcpy(out, decryptedMessage.data(), outLen); + // return CKR_OK; + + CK_RV error = logAndHandleErrors("ECC Decryption", receiverId, keyId, in, + inLen, out, outLen, requiredOutLen, true); + if (error != CKR_OK) + return error; + + mpz_class key; + + try { + key = TempHsm::getInstance().getECCPrivateKey(receiverId, keyId, + KeyPermission::DECRYPT); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to retrieve ECC private key for user id: " + + std::to_string(receiverId) + ", keyId: " + keyId + + ". Error: " + e.what()); + return CKR_USER_NOT_AUTHORIZED; + } + + //cast the cipher from in buffer to EncryptedMessage + EncryptedMessage cipher = deserializeFromBuffer(in, inLen); + + //perform decryption + std::vector decryptedMessage = decryptECC(cipher, key); + outLen = decryptedMessage.size(); + std::memcpy(out, decryptedMessage.data(), outLen); + + log(logger::LogLevel::INFO, + "Successfully completed ECC decryption for user id: " + + std::to_string(receiverId)); + + return CKR_OK; +} + +/** + * @brief Decrypts data using Elliptic Curve Cryptography (ECC). + * + * This function decrypts the input data using the ECC decryption algorithm and the provided key. + * It retrieves the private ecc key from the HSM for the specified user and key ID, then decrypts the input data. + * + * @param receiverId The ID of the reciever. + * @param keyId The ID of the key to be used for decryption. + * @param in A pointer to the input data to be decrypted. + * @param inLen The length of the input data. + * @param out A pointer to the buffer where the decrypted output will be stored. + * @param[out] outLen The length of the decrypted output. + * + * @return CKR_OK if the decryption is successful, or an appropriate error code if the decryption fails. + * + * @note This function logs the start and end of the decryption process for debugging purposes. + * @note If the decryption fails due to an unauthorized key, it returns CKR_USER_NOT_AUTHORIZED. + */ +CK_RV ECCdecrypt(int receiverId, std::string keyId, void *in, size_t inLen, + void *out, size_t &outLen) +{ + return ECCdecrypt(receiverId, keyId, in, inLen, out, outLen, + getECCdecryptedLength()); +} + +/** + * @brief Encrypts data using RSA. + * + * This function performs RSA encryption on the input data using the specified sender ID and key ID. + * It retrieves the corresponding RSA key from the HSM and encrypts the input data. + * The encrypted data is then stored in the output buffer. + * + * @param userId The ID of the user. + * @param keyId The ID of the RSA encryption key to be used. + * @param in The input data to be encrypted. + * @param inLen The length of the input data. + * @param out The buffer where the encrypted output will be stored. + * @param outLen The length of the buffer for the encrypted output. + * + * @return CKR_OK on successful encryption, or CKR_USER_NOT_AUTHORIZED if the key retrieval fails. + */ +CK_RV RSAencrypt(int userId, std::string keyId, void *in, size_t inLen, + void *out, size_t outLen) +{ + // std::string rsaKeyString; + // try { + // rsaKeyString = + // TempHsm::getInstance().getAuthorizedKey(userId, keyId, "ENCRYPT"); + // } catch (std::exception &e) { + // return CKR_USER_NOT_AUTHORIZED; + // } + // CK_RV returnCode = + // rsaEncrypt(reinterpret_cast(in), inLen, + // reinterpret_cast(rsaKeyString.c_str()), + // rsaKeyString.size(), reinterpret_cast(out), + // outLen, rsaKeyString.size() * BITS_IN_BYTE); + + CK_RV error = + logAndHandleErrors("RSA Encryption", userId, keyId, in, inLen, out, + outLen, getRSAencryptedLength(), true); + if (error != CKR_OK) + return error; + + std::pair key; + + try { + key = TempHsm::getInstance().getRSAKey(userId, keyId, + KeyPermission::ENCRYPT); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to retrieve RSA key for user id: " + + std::to_string(userId) + ", keyId: " + keyId + + ". Error: " + e.what()); + //either keyid not found or user not authorised to use key + //so really should have 2 types of codes that could be + //returned but for now... + return CKR_USER_NOT_AUTHORIZED; + } + + CK_RV returnCode = rsaEncrypt( + reinterpret_cast(in), inLen, key.first, key.second, + reinterpret_cast(out), outLen, RSA_KEY_SIZE); + + if (returnCode == CKR_OK) + log(logger::LogLevel::INFO, + "Successfully completed RSA encryption for user id: " + + std::to_string(userId)); + + return returnCode; +} + +//Decrypts data using RSA. +CK_RV RSAdecrypt(int userId, std::string keyId, void *in, size_t inLen, + void *out, size_t *outLen, size_t requiredLength) +{ + // std::string rsaKeyString; + // try { + // rsaKeyString = + // TempHsm::getInstance().getAuthorizedKey(userId, keyId, "DECRYPT"); + // } catch (std::exception &e) { + // return CKR_USER_NOT_AUTHORIZED; + // } + // CK_RV returnCode = + // rsaDecrypt(reinterpret_cast(in), inLen, + // reinterpret_cast(rsaKeyString.c_str()), + // rsaKeyString.size(), reinterpret_cast(out), + // outLen, rsaKeyString.size() * BITS_IN_BYTE); + // return returnCode; + + // RSAdecryptPrintParams(userId, keyId, in, inLen, + // out, outLen); + CK_RV error = logAndHandleErrors("RSA Decryption", userId, keyId, in, inLen, + out, *outLen, requiredLength, true); + if (error != CKR_OK) + return error; + + std::pair key; + + try { + key = TempHsm::getInstance().getRSAKey(userId, keyId, + KeyPermission::DECRYPT); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to retrieve RSA key for user id: " + + std::to_string(userId) + ", keyId: " + keyId + + ". Error: " + e.what()); + //either keyid not found or user not authorised to use key + //so really should have 2 types of codes that could be + //returned but for now... + return CKR_USER_NOT_AUTHORIZED; + } + + CK_RV returnCode = rsaDecrypt( + reinterpret_cast(in), inLen, key.first, key.second, + reinterpret_cast(out), outLen, RSA_KEY_SIZE); + + if (returnCode == CKR_OK) + log(logger::LogLevel::INFO, + "Successfully completed RSA decryption for user id: " + + std::to_string(userId)); + + return returnCode; +} + +/** + * @brief Decrypts data using RSA. + * + * This function decrypts the input data using the RSA decryption algorithm and the provided key. + * It retrieves the corresponding RSA key from the HSM for the specified user and key ID, then decrypts the input data. + * The decrypted data is then stored in the output buffer. + * + * @param userId The ID of the user. + * @param keyId The ID of the RSA decryption key to be used. + * @param in The input data to be decrypted. + * @param inLen The length of the input data. + * @param out The buffer where the decrypted output will be stored. + * @param outLen The length of the buffer for the decrypted output. + * + * @return CKR_OK on successful decryption, or CKR_USER_NOT_AUTHORIZED if the + * key retrieval fails, or the return code fron rsa decryption. + */ +CK_RV RSAdecrypt(int userId, std::string keyId, void *in, size_t inLen, + void *out, size_t *outLen) +{ + return RSAdecrypt(userId, keyId, in, inLen, out, outLen, + getRSAdecryptedLength()); +} + +// Generates a pair of asymmetric ECC keys and returns their keyIds +std::pair generateECCKeyPair( + int userId, std::vector permissions) +{ + //todo logging and validations + return TempHsm::getInstance().generateECCKeyPair(userId, permissions); +} + +// Generates a pair of asymmetric RSA keys and returns their keyIds +std::pair generateRSAKeyPair( + int userId, std::vector permissions) +{ + //todo logging and validations + return TempHsm::getInstance().generateRSAKeyPair(userId, permissions); +} + +#pragma endregion RSA and ECC + +#pragma region AES + +// Checks if the user is encrypting the first chunck. +bool isFirstChunckForEncryption(int userId) +{ + return mapToInMiddleEncryptions.count(userId) == 0; +} + +// Checks if the user is decrypting the first chunck. +bool isFirstChunckForDecryption(int userId) +{ + return mapToInMiddleDecryptions.count(userId) == 0; +} + +// Retrieves an AES key from the HSM by key ID. +CK_RV retrieveAESKeyByKeyId(int userId, std::string aesKeyId, + std::shared_ptr &symmetricKey, + KeyPermission permission) +{ + try { + // std::pair, int> keyAndLength = + // TempHsm::getInstance().getAESKey(userId, aesKeyId, permission); + symmetricKey = TempHsm::getInstance() + .getAESKey(userId, aesKeyId, permission) + .first; + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to retrieve AES key for user id: " + + std::to_string(userId) + ", keyId: " + aesKeyId + + ". Error: " + e.what()); + return CKR_USER_NOT_AUTHORIZED; + } + return CKR_OK; +} + +//function to encrypt symmetric key with RSA or ECC +CK_RV encryptAESkey(int senderId, int recieverId, uint8_t *symmetricKey, + size_t symmetricKeyLen, void *encryptedKey, + size_t encryptedKeyLen, AsymmetricFunction func) +{ + std::string recieversPublicKeyId = + TempHsm::getInstance().getPublicKeyIdByUserId(recieverId, func); + CK_RV returnCode; + + // encrypt symmetric key with ECC or RSA with recievers public key + if (func == RSA) + returnCode = RSAencrypt(senderId, recieversPublicKeyId, symmetricKey, + symmetricKeyLen, encryptedKey, encryptedKeyLen); + else { + returnCode = ECCencrypt(senderId, recieversPublicKeyId, symmetricKey, + symmetricKeyLen, encryptedKey, encryptedKeyLen); + } + // printBufferHex(encryptedKey, encryptedKeyLen, "encrypted key"); + + return returnCode; +} + +//function to decrypt symmetric key with RSA or ECC +CK_RV decryptAESkey(int senderId, int recieverId, void *in, size_t inLen, + uint8_t *symmetricKey, size_t &symmetricKeyLen, + AsymmetricFunction func, AESKeyLength keyLen) +{ + std::string recieverrsPrivateKeyId = + TempHsm::getInstance().getPrivateKeyIdByUserId(recieverId, func); + CK_RV returnCode; + + // decrypt symmetric key with ECC or RSA with recievers private key + if (func == RSA) + returnCode = RSAdecrypt(recieverId, recieverrsPrivateKeyId, in, inLen, + symmetricKey, &symmetricKeyLen, keyLen); + else + returnCode = ECCdecrypt(recieverId, recieverrsPrivateKeyId, in, inLen, + symmetricKey, symmetricKeyLen, keyLen); + + //printBufferHexa(symmetricKey, symmetricKeyLen, "decrypted key"); + + return returnCode; +} + +//Performs AES encryption on the first data block. +CK_RV performAESEncryption(int senderId, void *in, size_t inLen, void *out, + size_t outLen, AESChainingMode chainingMode, + std::shared_ptr symmetricKey, + AESKeyLength keyLength, size_t counter) +{ + LOG_BUFFER_HEXA(in, inLen, "this is the plain data"); + StreamAES *streamAES = FactoryManager::getInstance().create(chainingMode); + mapToInMiddleEncryptions[senderId] = std::make_pair(streamAES, counter); + + mapToInMiddleEncryptions[senderId].first->encryptStart( + reinterpret_cast(in), inLen, + static_cast(out), outLen, symmetricKey.get(), + keyLength); + LOG_BUFFER_HEXA(out, outLen, "this is the encrypted data"); + + return CKR_OK; +} + +// Encrypts data using AES encryption with optional key generation or retrieval. +CK_RV AESencrypt(int senderId, int receiverId, void *in, size_t inLen, + void *out, size_t outLen, AESKeyLength keyLength, + AESChainingMode chainingMode, size_t counter, + std::string keyId, bool generateKeyFlag, + AsymmetricFunction func) +{ + CK_RV returnCode = logAndHandleErrors( + "AES Encryption", senderId, keyId, in, inLen, out, outLen, + getAESencryptedLength(inLen, isFirstChunckForEncryption(senderId), + chainingMode), + isFirstChunckForEncryption(senderId), keyLength); + + if (returnCode != CKR_OK) { + deleteFromMap(mapToInMiddleEncryptions, senderId, + "mapToInMiddleEncryptions"); + return returnCode; + } + + size_t encryptedKeyLength = 0; + + //if first chunck + if (isFirstChunckForEncryption(senderId)) { + size_t symmetricKeyLen = keyLength; + std::shared_ptr key; + + // Handle key generation or retrieval: + // if using key generation - generate a new key and concatenate it to the encrypted data + if (generateKeyFlag) { + key = + std::shared_ptr(new unsigned char[keyLength]); + generateKey(key.get(), keyLength); + encryptedKeyLength = getEncryptedLengthByAssymFunc(func); + //encrypt the symmetric key and store it in the out buffer + returnCode = + encryptAESkey(senderId, receiverId, key.get(), symmetricKeyLen, + out, getEncryptedLengthByAssymFunc(func), func); + + if (returnCode != CKR_OK) { + deleteFromMap(mapToInMiddleEncryptions, senderId, + "mapToInMiddleEncryptions"); + return returnCode; + } + } + //otherwise retrieve the key from file by keyId: + else { + retrieveAESKeyByKeyId(senderId, keyId, key, ENCRYPT); + } + //printBufferHexa(symmetricKey, symmetricKeyLen, "key retrieved for encrypting"); + if (generateKeyFlag == true) + log(logger::LogLevel::INFO, + "Performing AES encryption for user id: " + + std::to_string(senderId) + + " for chunck of data number 1 with keyId: " + + keyId); //aes key + else + log(logger::LogLevel::INFO, + "Performing AES encryption for user id: " + + std::to_string(senderId) + + " for chunck of data number 1"); //receiver rsa public key + // Perform AES encryption + returnCode = performAESEncryption( + senderId, in, inLen, + static_cast(out) + encryptedKeyLength, + outLen - encryptedKeyLength, chainingMode, key, keyLength, counter); + if (returnCode != CKR_OK) { + deleteFromMap(mapToInMiddleEncryptions, senderId, + "mapToInMiddleEncryptions"); + return returnCode; + } + } + else { + // Handle chunk continuation + log(logger::LogLevel::INFO, + "Performing AES encryption for user id: " + + std::to_string(senderId) + " for chunck of data number " + + std::to_string(counter - + mapToInMiddleEncryptions[senderId].second + 1) + + "."); + //perform encryption + LOG_BUFFER_HEXA(in, inLen, "this is the plain data"); + mapToInMiddleEncryptions[senderId].first->encryptContinue( + reinterpret_cast(in), inLen, + static_cast(out), outLen); + LOG_BUFFER_HEXA(out, outLen, "this is the encrypted data"); + } + + //reduce a chunck from the chuncks counter + mapToInMiddleEncryptions[senderId].second--; + + // If all chunks have been encrypted, erase the entry from the map + if (mapToInMiddleEncryptions[senderId].second == 0) { + deleteFromMap(mapToInMiddleEncryptions, senderId, + "mapToInMiddleEncryptions"); + log(logger::LogLevel::INFO, + "Successfully completed AES encryption for user id: " + + std::to_string(senderId) + " for all " + + std::to_string(counter) + " chuncks."); + } + + return CKR_OK; +} + +// Performs AES decryption on the first data block. +CK_RV performAESDecryption(int receiverId, void *in, size_t inLen, void *out, + size_t &outLen, AESChainingMode chainingMode, + std::shared_ptr symmetricKey, + AESKeyLength keyLength, size_t counter, + bool generateKeyFlag) +{ + LOG_BUFFER_HEXA(in, inLen, "this is the encrypted data"); + StreamAES *streamAES = FactoryManager::getInstance().create(chainingMode); + mapToInMiddleDecryptions[receiverId] = std::make_pair(streamAES, counter); + unsigned int outLen2 = outLen; + try { + mapToInMiddleDecryptions[receiverId].first->decryptStart( + reinterpret_cast(in), inLen, + static_cast(out), outLen2, symmetricKey.get(), + keyLength); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to decrypt AES data for user id: " + + std::to_string(receiverId) + ". Error: " + e.what()); + return CKR_ARGUMENTS_BAD; + } + LOG_BUFFER_HEXA(out, outLen, "this is the decrypted data"); + + outLen = outLen2; + return CKR_OK; +} + +// Decrypts data using AES decryption with optional key generation or retrieval. +CK_RV AESdecrypt(int senderId, int receiverId, void *in, size_t inLen, + void *out, size_t &outLen, AsymmetricFunction func, + AESKeyLength keyLength, AESChainingMode chainingMode, + size_t counter, bool generateKeyFlag, std::string keyId = "") +{ + size_t encryptedKeyLen = + ((isFirstChunckForDecryption(receiverId)) && generateKeyFlag) + ? ((func == RSA) ? rsaGetEncryptedLen(RSA_KEY_SIZE) + : getECCencryptedLength()) + : 0; + size_t requiredLength = + getAESdecryptedLength(inLen, isFirstChunckForDecryption(receiverId), + chainingMode) - + encryptedKeyLen; + + CK_RV error = + logAndHandleErrors("AES Decryption", receiverId, keyId, in, + inLen - encryptedKeyLen, out, outLen, requiredLength, + isFirstChunckForDecryption(receiverId), keyLength); + if (error != CKR_OK) { + deleteFromMap(mapToInMiddleDecryptions, receiverId, + "mapToInMiddleDecryptions"); + return error; + } + + //if first chunck + if (isFirstChunckForDecryption(receiverId)) { + std::shared_ptr symmetricKey; + size_t offset = 0; + + // Handle key generation or retrieval: + //if using key generation - decrypt the concatenated key + if (generateKeyFlag) { + symmetricKey = + std::shared_ptr(new unsigned char[keyLength]); + size_t encryptedKeyLength = getEncryptedLengthByAssymFunc(func); + size_t symmetricKeyLength = keyLength; + //decrypt the symmetric key + CK_RV returnCode = decryptAESkey( + senderId, receiverId, in, encryptedKeyLength, + symmetricKey.get(), symmetricKeyLength, func, keyLength); + offset = encryptedKeyLength; + + if (returnCode != CKR_OK) { + deleteFromMap(mapToInMiddleDecryptions, receiverId, + "mapToInMiddleDecryptions"); + return returnCode; + } + } + //otherwise retrieve the key from file by keyId: + else { + retrieveAESKeyByKeyId(receiverId, keyId, symmetricKey, DECRYPT); + } + if (keyId != "") + log(logger::LogLevel::INFO, + "Performing AES decryption for user id: " + + std::to_string(receiverId) + + " for chunck of data number 1 with keyId: " + keyId + "."); + else + log(logger::LogLevel::INFO, + "Performing AES decryption for user id: " + + std::to_string(receiverId) + + " for chunck of data number 1."); + // Perform AES decryption + CK_RV error = performAESDecryption( + receiverId, static_cast(in) + offset, + inLen - offset, out, outLen, chainingMode, symmetricKey, keyLength, + counter, generateKeyFlag); + if (error != CKR_OK) { + deleteFromMap(mapToInMiddleDecryptions, receiverId, + "mapToInMiddleDecryptions"); + return error; + } + } + // Handle chunk continuation + else { + log(logger::LogLevel::INFO, + "Performing AES decryption for user id: " + + std::to_string(receiverId) + " for chunck of data number " + + std::to_string( + counter - mapToInMiddleDecryptions[receiverId].second + 1) + + "."); + unsigned int outLen2 = outLen; + try { + LOG_BUFFER_HEXA(in, inLen, "this is the encrypted data"); + mapToInMiddleDecryptions[receiverId].first->decryptContinue( + reinterpret_cast(in), inLen, + static_cast(out), outLen2); + LOG_BUFFER_HEXA(out, outLen2, "this is the decrypted data"); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "Failed to decrypt AES data for user id: " + + std::to_string(receiverId) + ". Error: " + e.what()); + deleteFromMap(mapToInMiddleDecryptions, receiverId, + "mapToInMiddleDecryptions"); + return CKR_ARGUMENTS_BAD; + } + outLen = outLen2; + } + // reduce a chunck from the chuncks counter + mapToInMiddleDecryptions[receiverId].second--; + + // If all chunks have been decrypted, erase the entry from the map + if (mapToInMiddleDecryptions[receiverId].second == 0) { + deleteFromMap(mapToInMiddleDecryptions, receiverId, + "mapToInMiddleDecryptions"); + log(logger::LogLevel::INFO, + "Successfully completed AES decryption for user id: " + + std::to_string(receiverId) + " for all " + + std::to_string(counter) + " chuncks."); + } + + return CKR_OK; +} + +// Generates a symmetric AES key, writes it to file and returns its keyId +std::string generateAESKey(int userId, AESKeyLength aesKeyLength, + std::vector permissions, + int destUserId) +{ + if (!isValidAESKeyLength(aesKeyLength)) { + log(logger::LogLevel::ERROR, + "Invalid AES key length provided: " + std::to_string(aesKeyLength) + + ". Supported lengths are 128, 192, or 256 bits."); + //return CKR_KEY_SIZE_RANGE; + return ""; + } + log(logger::LogLevel::INFO, + "Generating AES key for user " + std::to_string(userId)); + return TempHsm::getInstance().generateAESKey(userId, aesKeyLength, + permissions, destUserId); +} + +// Function to calculate length of encrypted data by AES when using a keyId. +size_t getAESencryptedLength(size_t dataLen, bool isFirst, + AESChainingMode chainingMode) +{ + return calculatEncryptedLenAES(dataLen, isFirst, chainingMode); +} + +// Function to calculate length of decrypted data by AES when using a keyId. +size_t getAESdecryptedLength(size_t dataLen, bool isFirst, + AESChainingMode chainingMode) +{ + if (dataLen == 0) + return 0; + return calculatDecryptedLenAES(dataLen, isFirst, chainingMode); +} + +/** + * @brief Encrypts data using AES. + * + * This function performs AES encryption. + * It performs encryption using the provided sender and receiver IDs, input data, and key ID. + * Unlike the inner `AESencrypt` function, this version does not generate a new AES key + * but instead retrieves an existing key. + * + * @param senderId The ID of the sender. + * @param receiverId The ID of the receiver. + * @param in The input data to be encrypted. + * @param inLen The length of the input data. + * @param[out] out The buffer where the encrypted output will be stored. + * @param[out] outLen The length of the encrypted output. + * @param func The asymmetric encryption function used (e.g., RSA, ECC). + * @param keyLength The AES key length (128, 192, or 256 bits). + * @param chainingMode The AES chaining mode (e.g., CBC, CTR). + * @param counter The counter for the chunked encryption process. + * @param keyId The ID of the key to be retrieved. + * @return CKR_OK on success or an appropriate error code on failure. + */ +CK_RV AESencrypt(int senderId, int receiverId, void *in, size_t inLen, + void *out, size_t outLen, AESKeyLength keyLength, + AESChainingMode chainingMode, size_t counter, + std::string keyId) +{ + return AESencrypt(senderId, receiverId, in, inLen, out, outLen, keyLength, + chainingMode, counter, keyId, false, RSA); +} + +/** + * @brief Decrypts data using AES. + * + * This function performs AES decryption. + * It performs decryption using the provided sender and receiver IDs, input data, and key ID. + * Unlike the inner `AESdecrypt` function, this version does not get an aes key concatenated + * to data but instead retrieves an existing key. + * + * @param senderId The ID of the sender. + * @param receiverId The ID of the receiver. + * @param in The input data to be decrypted. + * @param inLen The length of the input data. + * @param[out] out The buffer where the decrypted output will be stored. + * @param[out] outLen The length of the decrypted output. + * @param keyLength The AES key length (128, 192, or 256 bits). + * @param chainingMode The AES chaining mode (e.g., CBC, CTR). + * @param counter The chuncks counter for the chunked decryption process. + * @param keyId The ID of the key to be retrieved. + * @return CKR_OK on successful encryption, an appropriate error code on failure.. + */ +CK_RV AESdecrypt(int senderId, int receiverId, void *in, size_t inLen, + void *out, size_t &outLen, AESKeyLength keyLength, + AESChainingMode chainingMode, size_t counter, + std::string keyId) +{ + return AESdecrypt(senderId, receiverId, in, inLen, out, outLen, RSA, + keyLength, chainingMode, counter, false, keyId); +} + +#pragma endregion A + +#pragma region SIGN VERIFY + +// Retrieves the size of the hashed message based on the hash algorithm. +size_t getHashedMessageSize(SHAAlgorithm hashFunc) +{ + switch (hashFunc) { + case SHAAlgorithm::SHA_256: + return 256 / BITS_IN_BYTE; + case SHAAlgorithm::SHA_3_512: + return 512 / BITS_IN_BYTE; + default: + throw std::invalid_argument("Invalid hash function"); + } +} + +// Checks if the hashing process is done for a specific user. +bool isDoneHashing(int userId) +{ + return mapToInMiddleHashing.count(userId) != 0 && + mapToInMiddleHashing[userId].second == 0; +} + +// Checks if the user is hashing the first chunck. +bool isFirstChunckHash(int userId) +{ + return mapToInMiddleHashing.count(userId) == 0; +} + +// Updates the hash with the provided data. +CK_RV hashDataUpdate(int userId, void *data, size_t dataLen, + SHAAlgorithm hashfunc, int counter, + std::string signOrVerify) +{ + LOG_BUFFER_HEXA(data, dataLen, "chunck to hash:"); + CK_RV returnCode = logAndHandleErrors("Digital Signature", userId, data, + dataLen, isFirstChunckHash(userId)); + if (returnCode != CKR_OK) + return returnCode; + log(logger::LogLevel::INFO, signOrVerify + + " for user id: " + std::to_string(userId) + + " chunck of data."); + + if (isFirstChunckHash(userId)) { // first time + HashFactory *factoryManager = &HashFactory::getInstance(); + mapToInMiddleHashing[userId] = + std::make_pair(std::unique_ptr(), counter); + returnCode = factoryManager->create(hashfunc, + mapToInMiddleHashing[userId].first); + if (returnCode != CKR_OK) + return returnCode; + } + + std::vector(static_cast(data), + static_cast(data) + dataLen); + + returnCode = mapToInMiddleHashing[userId].first->update( + std::vector(static_cast(data), + static_cast(data) + dataLen)); + mapToInMiddleHashing[userId].second--; + + return returnCode; +} + +// Finalizes the hash computation and retrieves the resulting hash. +CK_RV hashDataFinalize(int userId, void *out, size_t outLen) +{ + log(logger::LogLevel::INFO, + "Signing for user id: " + std::to_string(userId) + " finalizing."); + + std::vector result; + if (mapToInMiddleHashing.count(userId) == 0) + return CKR_SIGNATURE_INVALID; + + CK_RV returnCode = mapToInMiddleHashing[userId].first->finalize(result); + deleteFromMap(mapToInMiddleHashing, userId, "mapToInMiddleHashing"); + memcpy(out, result.data(), outLen); + + return returnCode; +} + +/** + * @brief Retrieves the length of the signature based on the RSA encryption length. + * + * This function calculates and returns the length of a signature, which is determined by + * the length of the RSA-encrypted data. It internally calls the function that provides + * the RSA encrypted length. + * + * @return The length of the signature in bytes. + */ +size_t getSignatureLength() +{ + return getRSAencryptedLength(); +} + +// Updates the hash with the provided data for signing. +CK_RV signUpdate(int senderId, void *data, size_t dataLen, + SHAAlgorithm hashfunc, int counter) +{ + CK_RV returnCode = + hashDataUpdate(senderId, data, dataLen, hashfunc, counter, "Signing "); + if (returnCode != CKR_OK) + deleteFromMap(mapToInMiddleHashing, senderId, "mapToInMiddleHashing"); + + return returnCode; +} + +// Finalizes the signing process and retrieves the resulting digital signature. +CK_RV signFinalize(int senderId, void *signature, size_t signatureLen, + SHAAlgorithm hashfunc, std::string keyId) +{ + size_t hashLen = getHashedMessageSize(hashfunc); + std::vector hash(hashLen); + CK_RV returnCode = hashDataFinalize(senderId, hash.data(), hashLen); + LOG_BUFFER_HEXA(hash.data(), hashLen, "hashed in sign finalize"); + if (returnCode != CKR_OK) + return returnCode; + + returnCode = RSAencrypt(senderId, keyId, hash.data(), hashLen, signature, + signatureLen); + LOG_BUFFER_HEXA(signature, signatureLen, "signature in sign finalize"); + return returnCode; +} + +// Verifies and updates the hash with the provided data. +CK_RV verifyUpdate(int recieverId, void *data, size_t dataLen, + SHAAlgorithm hashFunc, size_t counter) +{ + ////printGlobalMaps(mapToInMiddleEncryptions, mapToInMiddleDecryptions, mapToInMiddleHashing);(); + CK_RV returnCode = hashDataUpdate(recieverId, data, dataLen, hashFunc, + counter, "Verifying "); + if (returnCode != CKR_OK) + deleteFromMap(mapToInMiddleHashing, recieverId, "mapToInMiddleHashing"); + + return returnCode; +} + +// Verifies the digital signature of the hashed input data and finalizes the signature verification process. +CK_RV verifyFinalize(int recieverId, void *signature, size_t signatureLen, + SHAAlgorithm hashFunc, std::string keyId) +{ + ////printGlobalMaps(mapToInMiddleEncryptions, mapToInMiddleDecryptions, mapToInMiddleHashing);(); + size_t hashLen = getHashedMessageSize(hashFunc); + std::vector hash(hashLen); + CK_RV returnCode = hashDataFinalize(recieverId, hash.data(), hashLen); + if (returnCode != CKR_OK) + return returnCode; + + LOG_BUFFER_HEXA(hash.data(), hashLen, "hashed in verify finalize"); + LOG_BUFFER_HEXA(signature, signatureLen, "signature in verify finalize"); + + size_t decryptSignatureLen = rsaGetDecryptedLen(RSA_KEY_SIZE); + std::vector decryptSignature(decryptSignatureLen); + returnCode = RSAdecrypt(recieverId, keyId, signature, signatureLen, + decryptSignature.data(), &decryptSignatureLen, + getRSAdecryptedLength()); + //printBufferHexa(decryptSignature.data(), decryptSignatureLen, "decrypted signature by verify finalize"); + if (returnCode != CKR_OK) + return returnCode; + LOG_BUFFER_HEXA(decryptSignature.data(), decryptSignatureLen, + "decrypted signature in verify finalize"); + + //printBufferHexa(hash.data(), hashLen, "hash by verify finalize (before if)"); + if (decryptSignatureLen != hashLen || + memcmp(decryptSignature.data(), hash.data(), decryptSignatureLen) != + 0) { + returnCode = CKR_SIGNATURE_INVALID; + log(logger::LogLevel::ERROR, + "Verifying signature failed for user id: " + + std::to_string(recieverId) + "."); + } + + return returnCode; +} + +#pragma endregion SIGN VERIFY + +#pragma region ENCRYPT DECRYPT + +/** + * @brief Retrieves the encrypted length for the specified user and input data. + * + * This function calculates the total length of the encrypted data based on the sender's + * encryption configuration, including both symmetric and asymmetric encryption lengths. + * If this is the first chunk of data (`isFirst` is true), the length also includes the + * encrypted symmetric key. + * + * The function retrieves the encryption function type from the user's configuration. + * If the user ID does not exist or any error occurs while retrieving the configuration, + * it logs an error and returns the error code `CKR_FUNCTION_FAILED` instead of the length. + * + * @param senderId The ID of the user whose encryption configuration is being retrieved. + * @param inLen The length of the input data to be encrypted. + * @param isFirst Indicates if this is the first chunk of data, which includes the symmetric key. + * + * @return The total length of the encrypted data in bytes, or `CKR_FUNCTION_FAILED` if + * the user does not exist or an error occurs. + */ +size_t getEncryptedLen(int senderId, size_t inLen, bool isFirst) +{ + try { + // Retrieve the encryption function type for the given sender ID + CryptoConfig config = TempHsm::getInstance().getUserConfig(senderId); + + // encrypted padded data (+ if first chunk: encrypted symmetric key) + return getAESencryptedLength(inLen, isFirst, config.aesChainingMode) + + (isFirst + ? getEncryptedLengthByAssymFunc(config.asymmetricFunction) + : 0); + } + catch (const std::runtime_error &e) { + log(logger::LogLevel::ERROR, + "Error while retrieving encryption configuration for user ID " + + std::to_string(senderId) + ": " + e.what()); + + return CKR_USER_NOT_LOGGED_IN; + } +} + +/** + * @brief Retrieves the decrypted length for the specified user and input data. + * + * This function calculates the total length of the decrypted data based on the sender's + * encryption configuration. It determines the decrypted length of the data that was + * encrypted with AES, subtracting the asymmetric encrypted key length if it's the first + * chunk (`isFirst` is true). + * + * The function retrieves the encryption function type from the user's configuration. + * If the user ID does not exist or any error occurs while retrieving the configuration, + * it logs an error and returns the error code `CKR_FUNCTION_FAILED` instead of the length. + * + * @param senderId The ID of the user whose encryption configuration is being retrieved. + * @param inLen The length of the encrypted input data. + * @param isFirst Indicates if this is the first chunk of data, which includes the symmetric key. + * + * @return The total length of the decrypted data in bytes, or `CKR_FUNCTION_FAILED` if + * the user does not exist or an error occurs. + */ +size_t getDecryptedLen(int senderId, size_t inLen, bool isFirst) +{ + try { + // Retrieve the encryption function type for the given sender ID + CryptoConfig config = TempHsm::getInstance().getUserConfig(senderId); + size_t encryptedLength = + (inLen - + (isFirst ? getEncryptedLengthByAssymFunc(config.asymmetricFunction) + : 0)); + + return calculatDecryptedLenAES(encryptedLength, isFirst, + config.aesChainingMode); + } + catch (const std::runtime_error &e) { + log(logger::LogLevel::ERROR, + "Error while retrieving encryption configuration for user ID " + + std::to_string(senderId) + ": " + e.what()); + + return CKR_USER_NOT_LOGGED_IN; + } +} + +/** + * @brief Encrypts the input data using AES and signs it with RSA. + * + * This function performs the encryption and signing operations for the input data. + * It uses the sender's user ID to retrieve its encryption and signing configurations. + * The encrypted data is then signed using the sender's private key. + * and by the last chunck the signature is sent in the signature buffer. + * The encryption and signing are based on the settings defined in the sender's user configuration. + * + * @param senderId The ID of the sender, used to retrieve the encryption and signing configurations. + * @param receiverId The ID of the receiver, used to retrieve the public key for encryption. + * @param in The input data to be encrypted and signed. + * @param inLen The length of the input data. + * @param out The buffer to store the encrypteddata. + * @param outLen The length of the encrypted data. + * @param signature The buffer to store the digital signature. + * @param signatureLen The length of the digital signature. + * @param counter The counter value used for streaming. + * + * @return CKR_OK on success, or an appropriate error code on failure. + */ +CK_RV encrypt(int senderId, int receiverId, void *in, size_t inLen, void *out, + size_t outLen, void *signature, size_t signatureLen, + size_t counter) +{ + LOG_BUFFER_HEXA(in, inLen, "this is the plain data"); + + CryptoConfig config; + + try { + config = TempHsm::getInstance().getUserConfig(senderId); + } + catch (const std::runtime_error &e) { + log(logger::LogLevel::ERROR, + "Error while retrieving encryption configuration for user ID " + + std::to_string(senderId) + ": " + e.what()); + + return CKR_USER_NOT_LOGGED_IN; + } + + CK_RV returnCode; + + std::string recieversPublicKeyId = + TempHsm::getInstance().getPublicKeyIdByUserId( + receiverId, config.asymmetricFunction); + + //perform encryption + returnCode = + AESencrypt(senderId, receiverId, in, inLen, out, outLen, + config.aesKeyLength, config.aesChainingMode, counter, + recieversPublicKeyId, true, config.asymmetricFunction); + if (returnCode != CKR_OK) + return returnCode; + + //sign the data + returnCode = signUpdate(senderId, in, inLen, config.hashFunction, counter); + if (returnCode != CKR_OK) + return returnCode; + if (isDoneHashing(senderId)) { + std::string senderPrivateKeyId = + TempHsm::getInstance().getPrivateKeyIdByUserId(senderId, RSA); + returnCode = signFinalize(senderId, signature, signatureLen, + config.hashFunction, senderPrivateKeyId); + if (returnCode != CKR_OK) + return returnCode; + } + LOG_BUFFER_HEXA(out, outLen, "this is the encrypted data"); + + return CKR_OK; +} + +/** + * @brief Decrypts the input data using AES and verifies it with RSA. + * + * This function gets the digital signature and encrypted data, + * decrypts the data using AES, and verifies the digital signature using RSA. + * The decryption and signature verification are based on the settings defined in the sender's user configuration. + * + * @param senderId The ID of the sender, used for retrieving the signature verification settings. + * @param receiverId The ID of the receiver, used for retrieving the private key for decryption. + * @param in The input buffer containing the concatenated signature and encrypted data. + * @param inLen The length of the input buffer. + * @param out The buffer to store the decrypted data. + * @param[out] outLen The length of the decrypted data. + * @param counter The counter value used for streaming. + * + * @return CKR_OK on success, or an appropriate error code on failure. + */ +CK_RV decrypt(int senderId, int receiverId, void *in, size_t inLen, + void *signature, size_t signatureLen, void *out, size_t &outLen, + size_t counter) +{ + LOG_BUFFER_HEXA(in, inLen, "this is the encrypted data"); + + CryptoConfig config; + + try { + config = TempHsm::getInstance().getUserConfig(senderId); + } + catch (const std::runtime_error &e) { + log(logger::LogLevel::ERROR, + "Error while retrieving encryption configuration for user ID " + + std::to_string(senderId) + ": " + e.what()); + + return CKR_USER_NOT_LOGGED_IN; + } + + CK_RV returnCode; + + //perform decryption + returnCode = AESdecrypt(senderId, receiverId, in, inLen, out, outLen, + config.asymmetricFunction, config.aesKeyLength, + config.aesChainingMode, counter, true); + if (returnCode != CKR_OK) + return returnCode; + //perform signature verification + returnCode = + verifyUpdate(receiverId, out, outLen, config.hashFunction, counter); + if (returnCode != CKR_OK) + return returnCode; + if (isDoneHashing(receiverId)) { + std::string senderPublicKeyId = + TempHsm::getInstance().getPublicKeyIdByUserId(senderId, RSA); + returnCode = verifyFinalize(receiverId, signature, signatureLen, + config.hashFunction, senderPublicKeyId); + } + + if (returnCode != CKR_OK) + return returnCode; + LOG_BUFFER_HEXA(out, outLen, "this is the decrypted data"); + + return CKR_OK; +} + +#pragma endregion ENCRYPT DECRYPT + +////////////////////////////////////// +//json copying to maps +// /** +// * @brief Loads key data from a JSON file and populates key maps. +// * +// * This function reads a JSON file containing key information and populates +// * the corresponding key maps with user IDs and key IDs. It handles +// different +// * key types, including ECC and RSA private and public keys. The JSON file +// * should have a structure where each key entry includes the key type, user +// ID, +// * and key ID. +// * +// * @note The JSON file is expected to be located at "../keys/keys.json". +// * The key types supported are "ECC-Private", "ECC-Public", +// "RSA-Private", +// * and "RSA-Public". +// * +// * @return void This function does not return any value. +// * +// * @throws std::ifstream::failure If the file could not be opened for +// reading. +// */ +// void loadDataFromJson() { +// std::string filePath = "../keys/keys.json"; +// std::ifstream file(filePath); +// if (!file.is_open()) { +// std::cerr << "Could not open the file!" << std::endl; +// return; +// } +// nlohmann::json jsonData; +// file >> jsonData; +// for (const auto &key : jsonData["keys"]) { +// // Check if the key_type is "ECC-Private" +// int user; +// std::string keyId; +// if (key["key_type"] == "ECC-Private") { +// // Extract user and key_id +// user = key["user"]; +// keyId = key["key_id"]; +// // Insert into the map +// TempHsm::EccPrivateKeysIds[user] = keyId; +// } else if (key["key_type"] == "ECC-Public") { +// user = key["user"]; +// keyId = key["key_id"]; +// TempHsm::EccPublicKeysIds[user] = keyId; +// } else if (key["key_type"] == "RSA-Private") { +// user = key["user"]; +// keyId = key["key_id"]; +// TempHsm::RsaPrivateKeysIds[user] = keyId; +// } else if (key["key_type"] == "RSA-Public") { +// user = key["user"]; +// keyId = key["key_id"]; +// TempHsm::RsaPublicKeysIds[user] = keyId; +// } +// } +// // Close the file after reading +// file.close(); +// } diff --git a/hsm-server/src/crypto_service.cpp b/hsm-server/src/crypto_service.cpp new file mode 100644 index 00000000..f0d869e4 --- /dev/null +++ b/hsm-server/src/crypto_service.cpp @@ -0,0 +1,1051 @@ +#include "../include/crypto_service.h" +#include "../include/general.h" +#include "../include/crypto_api.h" +#include "../include/debug_utils.h" +#include "../include/my_logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +grpc::Status CryptoServiceServer::bootSystem( + grpc::ServerContext *context, const crypto::BootSystemRequest *request, + crypto::Empty *response) +{ + + std::map> usersIdsPermissions; + for (auto user : request->usersidspermissions()) + for (auto permission : user.permissions()) + usersIdsPermissions[user.userid()].push_back( + static_cast(permission)); + if (::bootSystem(usersIdsPermissions) == CKR_OK) + return grpc::Status::OK; + return grpc::Status::CANCELLED; +} + +grpc::Status CryptoServiceServer::addProccess( + grpc::ServerContext *context, const crypto::AddProcessRequest *request, + crypto::Empty *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->permissions().data(), + request->permissions().size())); + std::vector permissions; + for (auto permission : request->permissions()) + permissions.push_back(static_cast(permission)); + if (::addProccess(request->userid(), permissions) == CKR_OK) { + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + + std::to_string(request->userid()) + + std::string(", total packets: ") + std::to_string(1) + " " + + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + return grpc::Status::OK; + } + return grpc::Status::CANCELLED; +} + +grpc::Status CryptoServiceServer::configure( + grpc::ServerContext *context, const crypto::ConfigureRequest *request, + crypto::Empty *response) +{ + + CryptoConfig config( + static_cast(request->config().hashfunction()), + static_cast(request->config().aeskeylength()), + static_cast(request->config().aeschainingmode()), + static_cast( + request->config().asymmetricfunction())); + if (::configure(request->userid(), config) == CKR_OK) { + return grpc::Status::OK; + } + return grpc::Status::CANCELLED; +} + +/** + * Encrypts the provided data and returns the encrypted result and signature. + * + * @param context The gRPC server context. + * @param request The request containing the data to encrypt. + * @param response The response containing the encrypted data and signature. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::encrypt(grpc::ServerContext *context, + const crypto::EncryptRequest *request, + crypto::EncryptResponse *response) +{ + int packetNumber = getCountFromEncryptions(request->senderid()); + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + std::string data = request->data(); + size_t outLen = ::getEncryptedLen( + request->senderid(), request->data().length(), request->isfirst()); + void *out = new uint8_t[outLen]; + size_t signatureLen = ::getSignatureLength(); + void *signature = new uint8_t[signatureLen]; + CK_RV status = ::encrypt( + request->senderid(), request->receiverid(), + static_cast(const_cast(request->data().data())), + request->data().length(), out, outLen, signature, signatureLen, + request->counter()); + if (status != CKR_OK) + return grpc::Status::CANCELLED; + char *charPtr = static_cast(out); + response->set_encrypteddata(out, outLen); + response->set_signature(signature, signatureLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + "1" + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)response->encrypteddata().data(), + response->encrypteddata().size())); + + return grpc::Status::OK; +} + +/** + * Decrypts the provided encrypted data and returns the decrypted result. + * + * @param context The gRPC server context. + * @param request The request containing the encrypted data and signature. + * @param response The response containing the decrypted data. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::decrypt(grpc::ServerContext *context, + const crypto::DecryptRequest *request, + crypto::DecryptResponse *response) +{ + int packetNumber = getCountFromDecryptions(request->receiverid()); + log(logger::LogLevel::INFO, std::to_string(request->receiverid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->encrypteddata().data(), + request->encrypteddata().size())); + + size_t outLen = ::getDecryptedLen(request->senderid(), + request->encrypteddata().length(), + request->isfirst()); + void *out = new uint8_t[outLen]; + CK_RV status = ::decrypt( + request->senderid(), request->receiverid(), + static_cast( + const_cast(request->encrypteddata().data())), + request->encrypteddata().length(), + static_cast(const_cast(request->signature().data())), + request->signature().length(), out, outLen, request->counter()); + if (status != CKR_OK) + return grpc::Status::CANCELLED; + response->set_decrypteddata(out, outLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->receiverid()), + std::string("sending packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + "2" + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)response->decrypteddata().data(), + response->decrypteddata().size())); + + return grpc::Status::OK; +} + +/** + * Generates an AES key with the specified permissions and user ID. + * + * @param context The gRPC server context. + * @param request The request containing the user ID and key length. + * @param response The response containing the generated AES key. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::generateAESKey( + grpc::ServerContext *context, const crypto::GenerateAESKeyRequest *request, + crypto::GenerateAESKeyResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + std::vector permissions; + for (auto permission : request->permissions()) + permissions.push_back(static_cast(permission)); + response->set_aeskey(::generateAESKey( + request->userid(), static_cast(request->keylength()), + permissions, request->destuserid())); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "3" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Generates an RSA key pair with the specified permissions and user ID. + * + * @param context The gRPC server context. + * @param request The request containing the user ID and permissions. + * @param response The response containing the generated RSA key pair. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::generateRSAKeyPair( + grpc::ServerContext *context, const crypto::GenerateKeyPairRequest *request, + crypto::GenerateKeyPairResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + std::vector permissions; + for (auto permission : request->permissions()) + permissions.push_back(static_cast(permission)); + std::pair pair = + ::generateRSAKeyPair(request->userid(), permissions); + response->set_privatekey(pair.second); + response->set_publickey(pair.first); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "4" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Generates an ECC key pair with the specified permissions and user ID. + * + * @param context The gRPC server context. + * @param request The request containing the user ID and permissions. + * @param response The response containing the generated ECC key pair. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::generateECCKeyPair( + grpc::ServerContext *context, const crypto::GenerateKeyPairRequest *request, + crypto::GenerateKeyPairResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + std::vector permissions; + for (auto permission : request->permissions()) + permissions.push_back(static_cast(permission)); + std::pair pair = + ::generateECCKeyPair(request->userid(), permissions); + response->set_privatekey(pair.second); + response->set_publickey(pair.first); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "5" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Retrieves the length of signed data (signature length). + * + * @param context The gRPC server context. + * @param request The request for getting the hash length. + * @param response The response containing the length of the signed data. + * @return The gRPC status indicating success or failure. + */ +grpc::Status CryptoServiceServer::getSignedDataLength( + grpc::ServerContext *context, const crypto::GetHashLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getSignatureLength()); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + + request->messageid() + "6" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Retrieves the public ECC key associated with a given user ID. +grpc::Status CryptoServiceServer::getPublicECCKeyByUserId( + grpc::ServerContext *context, const crypto::KeyRequest *request, + crypto::KeyResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_key(::getPublicECCKeyByUserId(request->userid())); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "7" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Retrieves the public RSA key associated with a given user ID. +grpc::Status CryptoServiceServer::getPublicRSAKeyByUserId( + grpc::ServerContext *context, const crypto::KeyRequest *request, + crypto::KeyResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_key(::getPublicRSAKeyByUserId(request->userid())); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "8" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Gets the length of the encrypted ECC data. +grpc::Status CryptoServiceServer::getECCencryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getECCencryptedLength()); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "9" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Gets the length of the decrypted ECC data. +grpc::Status CryptoServiceServer::getECCDecryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getECCdecryptedLength()); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "10" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Encrypts data using ECC with the specified sender ID and key ID. +grpc::Status CryptoServiceServer::ECCencrypt( + grpc::ServerContext *context, + const crypto::AsymetricEncryptRequest *request, + crypto::AsymetricEncryptResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t outLen = ::getECCencryptedLength(); + void *out = new uint8_t[outLen]; + + ::ECCencrypt(request->senderid(), request->keyid(), + (void *)request->data().data(), request->data().length(), out, + outLen); + response->set_encrypteddata(out, outLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "11" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->encrypteddata().data(), + response->encrypteddata().size())); + + return grpc::Status::OK; +} + +// Decrypts ECC-encrypted data using the specified receiver ID and key ID. +grpc::Status CryptoServiceServer::ECCdecrypt( + grpc::ServerContext *context, + const crypto::AsymetricDecryptRequest *request, + crypto::AsymetricDecryptResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t outLen = ::getECCdecryptedLength(); + void *out = new uint8_t[outLen]; + ::ECCdecrypt(request->receiverid(), request->keyid(), + (void *)request->data().data(), request->data().length(), out, + outLen); + response->set_decrypteddata(out, outLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "12" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->decrypteddata().data(), + response->decrypteddata().size())); + + return grpc::Status::OK; +} + +// Gets the length of the encrypted RSA data. +grpc::Status CryptoServiceServer::getRSAencryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getRSAencryptedLength()); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "13" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Gets the length of the decrypted RSA data. +grpc::Status CryptoServiceServer::getRSAdecryptedLength( + grpc::ServerContext *context, const crypto::GetLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getRSAdecryptedLength()); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "14" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +// Encrypts data using RSA with the specified sender ID and key ID. +grpc::Status CryptoServiceServer::RSAencrypt( + grpc::ServerContext *context, + const crypto::AsymetricEncryptRequest *request, + crypto::AsymetricEncryptResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t outLen = ::getRSAencryptedLength(); + void *out = new uint8_t[outLen]; + + ::RSAencrypt(request->senderid(), request->keyid(), + (void *)request->data().data(), request->data().length(), out, + outLen); + response->set_encrypteddata(out, outLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() +"15" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->encrypteddata().data(), + response->encrypteddata().size())); + + return grpc::Status::OK; +} + +// Decrypts RSA-encrypted data using the specified receiver ID and key ID. +grpc::Status CryptoServiceServer::RSAdecrypt( + grpc::ServerContext *context, + const crypto::AsymetricDecryptRequest *request, + crypto::AsymetricDecryptResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t outLen = ::getRSAdecryptedLength(); + void *out = new uint8_t[outLen]; + ::RSAdecrypt(request->receiverid(), request->keyid(), + (void *)request->data().data(), request->data().length(), out, + &outLen); + response->set_decrypteddata(out, outLen); + delete[](uint8_t *) out; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "16" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->decrypteddata().data(), + response->decrypteddata().size())); + + return grpc::Status::OK; +} + +// aes +/** + * Retrieves the length of encrypted data using AES. + * + * @param context The gRPC server context. + * @param request The request containing data length and chaining mode. + * @param response The response object to send back the length. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::getAESencryptedLength( + grpc::ServerContext *context, const crypto::GetAESLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getAESencryptedLength( + request->datalen(), request->isfirst(), + static_cast(request->chainingmode()))); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "17" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Retrieves the length of decrypted data using AES. + * + * @param context The gRPC server context. + * @param request The request containing data length and chaining mode. + * @param response The response object to send back the length. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::getAESdecryptedLength( + grpc::ServerContext *context, const crypto::GetAESLengthRequest *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getAESdecryptedLength( + request->datalen(), request->isfirst(), + static_cast(request->chainingmode()))); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "18" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Encrypts data using AES encryption. + * + * @param context The gRPC server context. + * @param request The request containing sender and receiver IDs and data. + * @param response The response object to send back the encrypted data. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::AESencrypt( + grpc::ServerContext *context, const crypto::AESEncryptRequest *request, + crypto::AESEncryptResponse *response) +{ + int packetNumber = getCountFromEncryptions(request->senderid()); + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber +1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t outLen = ::getAESencryptedLength( + request->data().length(), request->isfirst(), + static_cast(request->chainingmode())); + + std::unique_ptr> out( + new uint8_t[outLen]); + + CK_RV status = ::AESencrypt( + request->senderid(), request->receiverid(), + (void *)request->data().data(), request->data().length(), out.get(), + outLen, static_cast(request->keylength()), + static_cast(request->chainingmode()), + request->counter(), request->keyid()); + response->set_encrypteddata(out.get(), outLen); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + + std::to_string(packetNumber != 0 ? (request->counter() - packetNumber) + 1 + : 1) + + std::string(", of messageId: ") + + request->messageid() + "19" + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)response->encrypteddata().data(), + response->encrypteddata().size())); + + return grpc::Status::OK; +} + +/** + * Decrypts data using AES decryption. + * + * @param context The gRPC server context. + * @param request The request containing sender and receiver IDs and encrypted data. + * @param response The response object to send back the decrypted data. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::AESdecrypt( + grpc::ServerContext *context, const crypto::AESDecryptRequest *request, + crypto::AESDecryptResponse *response) +{ + int packetNumber = getCountFromDecryptions(request->userid()); + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->datain().data(), + request->datain().size())); + size_t outLen = ::getAESdecryptedLength( + request->datain().length(), request->isfirst(), + static_cast(request->chainingmode())); + + std::unique_ptr out(new uint8_t[outLen]); + CK_RV status = ::AESdecrypt( + request->senderid(), request->receiverid(), + (void *)request->datain().data(), request->datain().length(), out.get(), + outLen, static_cast(request->keylength()), + static_cast(request->chainingmode()), + request->counter(), request->keyid()); + if (status != CKR_OK) + return grpc::Status::CANCELLED; + response->set_decrypteddata(out.get(), outLen); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + "20" + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)response->decrypteddata().data(), + response->decrypteddata().size())); + + return grpc::Status::OK; +} + +/** + * Retrieves the length of encrypted data for a specific sender. + * + * @param context The gRPC server context. + * @param request The request containing sender ID and input length. + * @param response The response object to send back the length. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::getEncryptedLen( + grpc::ServerContext *context, const crypto::GetWholeLength *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getEncryptedLen(request->senderid(), request->inlen(), + request->isfirst())); + + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "21" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + return grpc::Status::OK; +} + +/** + * Retrieves the length of decrypted data for a specific sender. + * + * @param context The gRPC server context. + * @param request The request containing sender ID and input length. + * @param response The response object to send back the length. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::getDecryptedLen( + grpc::ServerContext *context, const crypto::GetWholeLength *request, + crypto::GetLengthResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->userid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)request->SerializeAsString().data(), + request->SerializeAsString().size())); + response->set_len(::getDecryptedLen(request->senderid(), request->inlen(), + request->isfirst())); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->userid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "22" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->SerializeAsString().data(), + response->SerializeAsString().size())); + + return grpc::Status::OK; +} + +/** + * Updates the signing process with new data. + * + * @param context The gRPC server context. + * @param request The request containing sender ID and data to sign. + * @param response The response object to send back the status of the operation. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::signUpdate(grpc::ServerContext *context, + const crypto::SignRequest *request, + crypto::SignResponse *response) +{ + int packetNumber = getCountFromHashing(request->senderid()); + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + CK_RV status = ::signUpdate( + request->senderid(), (void *)request->data().data(), + request->data().length(), + static_cast(request->hashfunc()), request->counter()); + + return status == CKR_OK ? grpc::Status::OK : grpc::Status::CANCELLED; +} + +/** + * Finalizes the signing process and returns the signature. + * + * @param context The gRPC server context. + * @param request The request containing sender ID and key ID. + * @param response The response object to send back the generated signature. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::signFinalize( + grpc::ServerContext *context, const crypto::SignRequest *request, + crypto::SignResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(request->counter()) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + size_t signatureLen = ::getSignatureLength(); + void *signature = new uint8_t[signatureLen]; + if (CK_RV status = + ::signFinalize(request->senderid(), signature, signatureLen, + static_cast(request->hashfunc()), + request->keyid()) != CKR_OK) + return grpc::Status::CANCELLED; + response->set_signature(signature, getSignatureLength()); + delete[](uint8_t *) signature; + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "23" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + + dataToHex((unsigned char *)response->signature().data(), + response->signature().size())); + + return grpc::Status::OK; +} + +/** + * Updates the verification process with new data. + * + * @param context The gRPC server context. + * @param request The request containing receiver ID and data to verify. + * @param response The response object to send back the status of the verification. + * @return grpc::Status indicating the success or failure of the operation. + */ +grpc::Status CryptoServiceServer::verifyUpdate( + grpc::ServerContext *context, const crypto::VerifyRequest *request, + crypto::VerifyResponse *response) +{ + int packetNumber = getCountFromHashing(request->senderid()); + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(packetNumber != 0 ? request->counter() - packetNumber + 1 + : 1) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + if (::verifyUpdate(request->receiverid(), (void *)request->data().data(), + request->data().length(), + static_cast(request->hashfunc()), + request->counter()) == CKR_OK) { + + + return grpc::Status::OK; + } + + return grpc::Status::CANCELLED; +} + +// Finalizes the verification process of a signature. +// Checks if the provided signature is valid by comparing it against the expected value. +// If the verification is successful, sets the validity of the signature in the response to true. +// +// Parameters: +// - context: A pointer to the server context. +// - request: A pointer to the VerifyRequest containing the necessary information for verification, +// including receiver ID, signature data, hash function, and key ID. +// - response: A pointer to the VerifyResponse where the result of the verification will be stored. +// +// Returns: +// - grpc::Status::OK if the signature is valid. +// - grpc::Status::CANCELLED if the verification fails. +grpc::Status CryptoServiceServer::verifyFinalize( + grpc::ServerContext *context, const crypto::VerifyRequest *request, + crypto::VerifyResponse *response) +{ + log(logger::LogLevel::INFO, std::to_string(request->senderid()), + std::to_string(HSM_ID), + std::string("received packet number: ") + + std::to_string(request->counter()) + + std::string(", of messageId: ") + request->messageid() + + std::string(", total packets: ") + + std::to_string(request->counter()) + std::string(" ") + + "Success Data: " + + dataToHex((unsigned char *)request->data().data(), + request->data().size())); + if (::verifyFinalize(request->receiverid(), + (void *)request->signature().data(), + request->signature().length(), + static_cast(request->hashfunc()), + request->keyid()) != CKR_OK) + return grpc::Status::CANCELLED; + response->set_valid(true); + log(logger::LogLevel::INFO, std::to_string(HSM_ID), + std::to_string(request->senderid()), + std::string("sending packet number: ") + std::to_string(1) + + std::string(", of messageId: ") + request->messageid() + "24" + + std::string(", total packets: ") + std::to_string(1) + + std::string(" ") + "Success Data: " + "0x01"); + + return grpc::Status::OK; +} + +void RunServer() +{ + std::string serverAddress("0.0.0.0:50051"); + CryptoServiceServer service; + + grpc::ServerBuilder builder; + builder.AddListeningPort(serverAddress, grpc::InsecureServerCredentials()); + builder.RegisterService(&service); + std::unique_ptr server(builder.BuildAndStart()); + std::cout << "Server listening on " << serverAddress << std::endl; + + server->Wait(); +} + +int main(int argc, char **argv) +{ + signal(SIGINT, signalHandler); + RunServer(); + return 0; +} diff --git a/hsm-server/src/debug_utils.cpp b/hsm-server/src/debug_utils.cpp new file mode 100644 index 00000000..7468bf5e --- /dev/null +++ b/hsm-server/src/debug_utils.cpp @@ -0,0 +1,91 @@ +#include +#include + +#include +#include "../include/debug_utils.h" +using namespace std; + +#define DEBUG +#define LOG_BUFFERS +void printBufferHexa(const uint8_t *buffer, size_t len, std::string message) +{ +#ifdef DEBUG + std::cout << message << std::endl; + for (size_t i = 0; i < len; ++i) { + std::cout << std::hex << std::setw(2) << std::setfill('0') + << static_cast(buffer[i]) << " "; + // Print a new line every 16 bytes for better readability + if ((i + 1) % 16 == 0) + std::cout << std::endl; + } + std::cout << std::endl; + // Reset the stream format back to decimal + std::cout << std::dec; +#endif +} + +void logBufferHexa(const void *voidBuffer, size_t len, + const std::string &message, const char *callingFunction, + int line) +{ +#ifdef LOG_BUFFERS + const uint8_t *buffer = static_cast(voidBuffer); + // Accumulate the message and buffer data in a single string + std::ostringstream oss; + oss << message << std::endl; + oss << " (function: " << callingFunction << ", line:" << line << ")\n"; + + for (size_t i = 0; i < len; ++i) { + oss << std::hex << std::setw(2) << std::setfill('0') + << static_cast(buffer[i]) << " "; + // Add a new line every 16 bytes for readability + if ((i + 1) % 16 == 0) + oss << std::endl; + } + + // Append a final newline after the buffer, if needed + if (len % 16 != 0) + oss << std::endl; + + // Reset the stream back to decimal + oss << std::dec; + + // Log the buffer content using the logging system + log(logger::LogLevel::INFO, oss.str()); +#endif +} + +void encryptStartPrintParams(unsigned char block[], unsigned int inLen, + unsigned char *&out, unsigned int &outLen, + unsigned char *key, AESKeyLength keyLength) +{ + printBufferHexa(block, inLen, "Block: "); + printBufferHexa(key, 128, "Key: "); + std::cout << "inLen: " << inLen << ", outLen(before): " << outLen + << std::endl; +} + +void encryptContinuePrintParams(unsigned char block[], unsigned int inLen, + unsigned char *&out, unsigned int &outLen) +{ + printBufferHexa(block, inLen, "Block: "); + std::cout << "inLen: " << inLen << ", outLen(before): " << outLen + << std::endl; +} + +void printStreamAES(const StreamAES &obj, size_t blockSize, std::string message) +{ + printBufferHexa(obj.iv, blockSize, "IV: "); + + printBufferHexa(obj.lastBlock, blockSize, "Last Block: "); + + printBufferHexa(obj.key, obj.keyLength, "Key: "); + + std::cout << "Key Length: " << obj.keyLength << " bytes" << std::endl; +} + +// Definition of the debugLog function +void debugLog(const std::string &message, const std::string &functionName) +{ + std::cout << "Function: " << functionName << " -> " << message << std::endl; +} diff --git a/hsm-server/src/ecc.cpp b/hsm-server/src/ecc.cpp new file mode 100644 index 00000000..183bd273 --- /dev/null +++ b/hsm-server/src/ecc.cpp @@ -0,0 +1,430 @@ +#include "../include/ecc.h" +#include +#include +#include +#include +#include +#include + +unsigned int added = 0; + +// Define static constants +const mpz_class prime( + "11579208923731619542357098500868790785326998466564056403945758400791312963" + "9936"); +const mpz_class a = 0; +const mpz_class b = 7; +const Point basicPoint(mpz_class("550662630222773436695787188951685343262506034" + "53777594175500187360389116729240"), + mpz_class("326705100207588169780830851305070431844712733" + "80659243275938904335757337482424")); + +#ifdef USE_SYCL +#include +using namespace cl::sycl; +/** + * Converts a message string to a point on the elliptic curve using SYCL. + * @param text The message to convert. + * @return The point on the elliptic curve. + */ +Point convertMessageToPoint(const std::string &text) +{ + std::string binaryStr(text.size() * 8, '0'); + queue queue; + buffer textBuf(text.data(), range<1>(text.size())); + buffer binaryStrBuf(binaryStr.data(), range<1>(binaryStr.size())); + + queue + .submit([&](handler &handler) { + auto textAcc = textBuf.get_access(handler); + auto binaryStrAcc = + binaryStrBuf.get_access(handler); + + handler.parallel_for( + range<1>(text.size()), [=](id<1> idx) { + for (int i = 7; i >= 0; --i) + binaryStrAcc[idx[0] * 8 + (7 - i)] = + ((textAcc[idx] >> i) & 1) ? '1' : '0'; + }); + }) + .wait(); + + mpz_class x; + x.set_str(binaryStr, 2); + + for (;; added++) { + mpz_class xAdded = x + mpz_class(added); + mpz_class rhs = mod(xAdded * xAdded * xAdded + a * xAdded + b); + mpz_class yAdded; + + if (modularSqrt(yAdded.get_mpz_t(), rhs.get_mpz_t(), prime.get_mpz_t())) + return Point(xAdded, yAdded); + } + + throw std::runtime_error( + "Unable to convert message to a valid point on the curve."); +} + +/** + * Converts a point on the elliptic curve to a message string. + * @param point The point to convert. + * @return The message string. + */ +std::string convertPointToMessage(const Point &point) +{ + sycl::queue queue; + + mpz_class x = point.x - mpz_class(added); + std::string binaryStr = x.get_str(2); + + size_t paddingLength = 8 - (binaryStr.size() % 8); + if (paddingLength != 8) + binaryStr = std::string(paddingLength, '0') + binaryStr; + + size_t numBytes = binaryStr.size() / 8; + std::vector result(numBytes); + sycl::buffer binaryBuffer(binaryStr.data(), + sycl::range<1>(binaryStr.size())); + sycl::buffer resultBuffer(result.data(), + sycl::range<1>(result.size())); + + queue + .submit([&](sycl::handler &handler) { + auto binaryAcc = + binaryBuffer.get_access(handler); + auto resultAcc = + resultBuffer.get_access(handler); + + handler.parallel_for( + sycl::range<1>(numBytes), [=](sycl::id<1> id) { + size_t idx = id[0] * 8; + std::bitset<8> byteStr; + for (size_t bit = 0; bit < 8; ++bit) + byteStr[7 - bit] = binaryAcc[idx + bit] == '1'; + resultAcc[id] = static_cast(byteStr.to_ulong()); + }); + }) + .wait(); + std::string text(result.begin(), result.end()); + return text; +} + +#else + +/** + * Converts a message string to a point on the elliptic curve. + * @param text The message to convert. + * @return The point on the elliptic curve. + */ +Point convertMessageToPoint(const std::string &text) +{ + std::string binaryStr; + for (char c : text) + for (int i = 7; i >= 0; --i) + binaryStr += ((c >> i) & 1) ? '1' : '0'; + + mpz_class x; + x.set_str(binaryStr, 2); + for (;; added++) { + mpz_class xAdded = x + mpz_class(added); + mpz_class rhs = mod(xAdded * xAdded * xAdded + a * xAdded + b); + mpz_class yAdded; + if (modularSqrt(yAdded.get_mpz_t(), rhs.get_mpz_t(), prime.get_mpz_t())) + return Point(xAdded, yAdded); + } + + throw std::runtime_error( + "Unable to convert message to a valid point on the curve."); +} + +/** + * Converts a point on the elliptic curve to a message string. + * @param point The point to convert. + * @return The message string. + */ +std::string convertPointToMessage(const Point &point) +{ + mpz_class x = point.x - mpz_class(added); + std::string binaryStr = x.get_str(2); + + // Adding leading zeros to complete to a multiple of 8 + size_t paddingLength = 8 - (binaryStr.size() % 8); + if (paddingLength != 8) // If the string is not already a multiple of 8 + binaryStr = std::string(paddingLength, '0') + binaryStr; + + std::string text; + for (size_t i = 0; i < binaryStr.size(); i += 8) { + std::string byteStr = binaryStr.substr(i, 8); + char c = static_cast(std::bitset<8>(byteStr).to_ulong()); + text += c; + } + + return text; +} + +#endif + +/** + * Computes the modular square root using the Tonelli-Shanks algorithm. + * @param result The computed square root. + * @param a The value to find the square root of. + * @param p The modulus. + * @return True if the square root exists, false otherwise. + */ +bool modularSqrt(mpz_t result, const mpz_t a, const mpz_t p) +{ + mpz_t q, s, z, m, c, t, r, b, temp; + mpz_inits(q, s, z, m, c, t, r, b, temp, NULL); + + // Check if a is sqrt of 1 (x^2 ≡ a (mod p)) + if (mpz_legendre(a, p) != 1) { + mpz_clears(q, s, z, m, c, t, r, b, temp, NULL); + return false; + } + + // If p ≡ 3 (mod 4), the solution is: a^((p+1)/4) mod p + mpz_mod_ui(temp, p, 4); + if (mpz_cmp_ui(temp, 3) == 0) { + mpz_add_ui(q, p, 1); + mpz_tdiv_q_ui(q, q, 4); + mpz_powm(result, a, q, p); + mpz_clears(q, s, z, m, c, t, r, b, temp, NULL); + return true; + } + + // For the general case, use the Tonley-Shanks method + mpz_sub_ui(m, p, 1); + mpz_tdiv_q_ui(m, m, 2); + mpz_set_ui(s, 0); + mpz_set_ui(z, 2); + + while (true) { + mpz_powm(b, z, m, p); + if (mpz_cmp_ui(b, 1) != 0) + break; + mpz_add_ui(s, s, 1); + mpz_sub_ui(m, p, 1); + mpz_tdiv_q_ui(m, m, 2); + mpz_tdiv_q_ui(m, m, 2); + mpz_add_ui(m, m, 1); + } + + mpz_set_ui(c, 0); + mpz_set(r, a); + mpz_set_ui(t, 1); + mpz_powm(t, t, m, p); + + while (true) { + mpz_powm(b, t, c, p); + if (mpz_cmp_ui(b, 1) == 0) + break; + mpz_set_ui(b, 0); + mpz_powm(b, r, b, p); + mpz_mul(r, r, b); + mpz_mod(r, r, p); + mpz_mul(t, t, b); + mpz_mod(t, t, p); + mpz_set_ui(c, 0); + mpz_add_ui(c, c, 1); + } + + mpz_set(result, r); + + // Clear memory + mpz_clears(q, s, z, m, c, t, r, b, temp, NULL); + return true; +} + +/** + * Generates a private key for ECC. + * @return The generated private key. + */ +mpz_class generatePrivateKey() +{ + gmp_randclass rng(gmp_randinit_default); + rng.seed(time(nullptr)); + return rng.get_z_range(prime - 1) + 1; +} + +/** + * Generates a random value k for ECC. + * @return The generated value of k. + */ +mpz_class generateK() +{ + gmp_randclass rng(gmp_randinit_default); + rng.seed(time(nullptr)); + return rng.get_z_range(prime - 1) + 1; +} + +/** + * Generates a public key for ECC. + * @return The generated public key. + */ +Point generatePublicKey(mpz_class privateKey) +{ + return multiply(basicPoint, privateKey); +} + +/** + * Calculates the y-coordinate for a given x-coordinate on the elliptic curve. + * @param x The x-coordinate. + * @return The y-coordinate. + */ +mpz_class calculateY(mpz_class x) +{ + mpz_class rhs = mod(x * x * x + a * x + b); + mpz_class y; + if (modularSqrt(y.get_mpz_t(), rhs.get_mpz_t(), prime.get_mpz_t())) + return y; + else + throw std::runtime_error("No solution for Y."); +} + +/** + * Checks if a point is on the elliptic curve. + * @param P The point to check. + * @return True if the point is on the curve, false otherwise. + */ +bool isOnCurve(Point P) +{ + return mod(P.y * P.y) == mod(P.x * P.x * P.x + a * P.x + b); +} + +/** + * Computes the modular reduction of a value by the curve's prime. + * @param x The value to reduce. + * @return The reduced value. + */ +mpz_class mod(mpz_class x) +{ + mpz_class result; + mpz_mod(result.get_mpz_t(), x.get_mpz_t(), prime.get_mpz_t()); + return result; +} + +/** + * Computes the modular inverse of a value. + * @param base The value to invert. + * @return The modular inverse. + */ +mpz_class inverse(mpz_class base) +{ + mpz_class result; + mpz_invert(result.get_mpz_t(), base.get_mpz_t(), prime.get_mpz_t()); + return result; +} + +/** + * Adds two points on the elliptic curve. + * @param P The first point. + * @param Q The second point. + * @return The resulting point. + */ +Point add(Point P, Point Q) +{ + mpz_class incline; + if (P.x == 0 && P.y == 0) + return Q; + + if (Q.x == 0 && Q.y == 0) + return P; + + if (P.x == Q.x && P.y == -Q.y) + return Point(0, 0); + + if (P.x == Q.x && P.y == Q.y) + incline = mod((3 * P.x * P.x + a) * inverse(2 * P.y)); + else + incline = mod((Q.y - P.y) * inverse(Q.x - P.x)); + + mpz_class x = mod(incline * incline - P.x - Q.x); + mpz_class y = mod(incline * (P.x - x) - P.y); + return Point(x, y); +} + +/** + * Multiplies a point by a scalar on the elliptic curve. + * @param P The point to multiply. + * @param times The scalar to multiply by. + * @return The resulting point. + */ +Point multiply(Point P, mpz_class times) +{ + Point R(0, 0); + Point N = P; + while (times > 0) { + if (times % 2 == 1) + R = add(R, N); + + N = add(N, N); + times /= 2; + } + + return R; +} + +/** + * Encrypts a message using ECC. + * @param message The message text to encrypt. + * @return A pair of points representing the ciphertext. + */ +EncryptedMessage encryptECC(std::vector message, Point publicKey) +{ + std::string text = uint8ToString(message); + mpz_class k = generateK(); + Point meesagePoint = convertMessageToPoint(text); + Point C1 = multiply(basicPoint, k); + Point C2 = add(meesagePoint, multiply(publicKey, k)); + return EncryptedMessage(C1.x, C1.y < 0, C2.x, C2.y < 0); +} + +/** + * @brief Converts a vector of uint8_t to a string. + * + * This function takes a vector of uint8_t and converts it to a std::string. + * It uses the std::string constructor that takes two iterators, converting + * the entire vector to a string. + * + * @param uint8Vec The vector of uint8_t to convert. + * @return std::string The resulting string from the conversion. + */ +std::string uint8ToString(const std::vector &uint8Vec) +{ + return std::string(uint8Vec.begin(), uint8Vec.end()); +} + +/** + * @brief Converts a string to a vector of uint8_t. + * + * This function takes a std::string and converts it to a vector of uint8_t. + * It uses the std::vector constructor that takes two iterators, converting + * the entire string to a vector of uint8_t. + * + * @param str The string to convert. + * @return std::vector The resulting vector of uint8_t from the conversion. + */ +std::vector stringToUint8(const std::string &str) +{ + std::vector uint8Vec(str.begin(), str.end()); + return uint8Vec; +} + +/** + * Decrypts a ciphertext using ECC. + * @param ciphertext The ciphertext to decrypt. + * @return The decrypted message point. + */ +std::vector decryptECC(EncryptedMessage ciphertext, + mpz_class privateKey) +{ + Point temp = multiply(Point(ciphertext.c1X, calculateY(ciphertext.c1X) * + (ciphertext.c1Y ? -1 : 1)), + privateKey); + Point negTemp = Point(temp.x, mod(-temp.y)); + Point decrypted = add(Point(ciphertext.c2X, calculateY(ciphertext.c2X) * + (ciphertext.c1Y ? -1 : 1)), + negTemp); + std::string text = convertPointToMessage(decrypted); + return stringToUint8(text); +} \ No newline at end of file diff --git a/hsm-server/src/general.cpp b/hsm-server/src/general.cpp new file mode 100644 index 00000000..5fb37998 --- /dev/null +++ b/hsm-server/src/general.cpp @@ -0,0 +1,36 @@ +#include "../include/general.h" + +std::unique_ptr logInstance; +void log(logger::LogLevel level, const std::string &message) +{ + // Ensure logger instance exists + if (!logInstance) { + logInstance = std::make_unique("HSM"); + } + logInstance->logMessage(level, message); +} + +bool isValidAESKeyLength(AESKeyLength aesKeyLength) +{ + // Create a set of valid key lengths and check if the provided key length is in this set + switch (aesKeyLength) { + case AES_128: + case AES_192: + case AES_256: + return true; + default: + return false; + } +} + +void signalHandler(int signum) +{ + std::cout << "Interrupt signal (" << signum + << ") received. Cleaning up resources..." << std::endl; + + // Explicitly delete the logger instance + logInstance.reset(); + + // Exit the program + exit(signum); +} diff --git a/hsm-server/src/hash_factory.cpp b/hsm-server/src/hash_factory.cpp new file mode 100644 index 00000000..413ed36e --- /dev/null +++ b/hsm-server/src/hash_factory.cpp @@ -0,0 +1,74 @@ +#include "../include/hash_factory.h" +#include + +/** + * @brief Gets the singleton instance of HashFactory. + * + * This method ensures that only one instance of HashFactory exists during + * the program's lifetime (Singleton Pattern). + * + * @return The singleton instance of HashFactory. + */ +HashFactory &HashFactory::getInstance() +{ + log(logger::LogLevel::DEBUG, "HashFactory::getInstance() called"); + static HashFactory instance; + return instance; +} + +/** + * @brief Creates an IHash object based on the specified SHAAlgorithm. + * + * This method creates a hash algorithm object depending on the specified + * type (e.g., SHA256, SHA3-512). + * + * @param type The SHA algorithm type to create. + * @param hashPtr A reference to a unique_ptr where the newly created IHash object will be stored. + * @return CK_RV The return code indicating success or failure. + */ +CK_RV HashFactory::create(const SHAAlgorithm &type, + std::unique_ptr &hashPtr) const +{ + log(logger::LogLevel::INFO, + "HashFactory::create() called with SHAAlgorithm: " + + std::to_string(static_cast(type))); + + try { + const auto it = factories.find(type); + if (it != factories.end()) { + hashPtr = it->second(); + return CKR_OK; // Success + } + else { + log(logger::LogLevel::ERROR, + "Error: Algorithm type not found in HashFactory."); + return CKR_FUNCTION_FAILED; // Error: Algorithm type not found + } + } + catch (const std::exception &e) { + log(logger::LogLevel::ERROR, + std::string("Exception caught in HashFactory::create: ") + + e.what()); + return CKR_FUNCTION_FAILED; // Error: Exception occurred + } +} + +/** + * @brief Private constructor that initializes the hash algorithm factories. + * + * This constructor registers hash algorithms to the factory map. It is private + * to ensure that only one instance of HashFactory can exist (Singleton Pattern). + */ +HashFactory::HashFactory() + : factories({{SHAAlgorithm::SHA_256, + []() -> std::unique_ptr { + return std::make_unique(); + }}, + {SHAAlgorithm::SHA_3_512, []() -> std::unique_ptr { + return std::make_unique(); + }}}) +{ + log(logger::LogLevel::INFO, + "HashFactory constructor called, initializing hash algorithm " + "factories."); +} \ No newline at end of file diff --git a/hsm-server/src/my_logger.cpp b/hsm-server/src/my_logger.cpp new file mode 100644 index 00000000..d1321b2e --- /dev/null +++ b/hsm-server/src/my_logger.cpp @@ -0,0 +1,45 @@ +#include "../include/my_logger.h" +const std::string logFilePath = "../sharedLogs/HSM_Communication.log"; + +std::ofstream logFile(logFilePath, std::ios::app); + +std::mutex logMutex; + +std::string getTimestamp() { + auto now = std::chrono::system_clock::now(); + auto now_ns = std::chrono::duration_cast(now.time_since_epoch()).count(); + return std::to_string(now_ns); +} + +std::string dataToHex(const unsigned char* data, size_t size) { + std::ostringstream oss; + oss << "0x"; + for (size_t i = 0; i < size; ++i) { + oss << std::hex << std::setw(2) << std::setfill('0') << static_cast(data[i]); + } + return oss.str(); +} + +void log(logger::LogLevel loglevel, const std::string& hsm_id, const std::string& user_id, const std::string& message) +{ + std::string levelStr; + switch (loglevel) { + case logger::LogLevel::INFO: + levelStr = "INFO"; + break; + case logger::LogLevel::ERROR: + levelStr = "ERROR"; + break; + } + + std::string logMessage = "[" + getTimestamp() + "ns] [" + levelStr + "] SRC " + hsm_id + " DST " + user_id + " " + message; + + std::lock_guard guard(logMutex); + logFile << logMessage << std::endl; +} + +int getId() +{ + static int counter = 0; + return ++counter; +} \ No newline at end of file diff --git a/hsm-server/src/prime_tests.cpp b/hsm-server/src/prime_tests.cpp new file mode 100644 index 00000000..22dba3b1 --- /dev/null +++ b/hsm-server/src/prime_tests.cpp @@ -0,0 +1,798 @@ +#include +#include "../include/big_int_utils.h" +#include "../include/prime_tests.h" +#include "../logger/logger.h" +#include "../include/general.h" +using namespace std; + +constexpr size_t smallPrimesSize = 2000; +constexpr int smallPrimes[2000] = { + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, + 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, + 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, + 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, + 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, + 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, + 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, + 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, + 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, + 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, + 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, + 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, + 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, + 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, + 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, + 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, + 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, + 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, + 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, + 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, + 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, + 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, + 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, + 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, + 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, + 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, + 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, + 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, + 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, + 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, + 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, + 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, + 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, + 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, + 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, + 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, + 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, + 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, + 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, + 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, + 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, + 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, + 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, + 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, + 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, + 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, + 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, + 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, + 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, + 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, + 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, + 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, + 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, + 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, + 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, + 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, + 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, + 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, + 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, + 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, + 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, + 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, + 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, + 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, + 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, + 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, + 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, + 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, + 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, + 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, + 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, + 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, + 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, + 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, + 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, + 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, + 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, + 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, + 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, + 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, + 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, + 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, + 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, + 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, + 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, + 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, + 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, + 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, + 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, + 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, + 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, + 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, + 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, + 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, + 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, + 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, + 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, + 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, + 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, + 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, + 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, + 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, + 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, + 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, + 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, + 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, + 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, + 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, + 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, + 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, + 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, + 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, + 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, + 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, + 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, + 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, + 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, + 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, + 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, + 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, + 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, + 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, 11069, 11071, + 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, + 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11257, 11261, 11273, 11279, + 11287, 11299, 11311, 11317, 11321, 11329, 11351, 11353, 11369, 11383, 11393, + 11399, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11489, 11491, + 11497, 11503, 11519, 11527, 11549, 11551, 11579, 11587, 11593, 11597, 11617, + 11621, 11633, 11657, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, + 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, + 11833, 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, + 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 12037, + 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, 12113, 12119, + 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, 12227, 12239, 12241, + 12251, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12329, 12343, + 12347, 12373, 12377, 12379, 12391, 12401, 12409, 12413, 12421, 12433, 12437, + 12451, 12457, 12473, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, + 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12601, 12611, 12613, + 12619, 12637, 12641, 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, + 12721, 12739, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, + 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, + 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, 13009, + 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13121, 13127, + 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, 13217, 13219, 13229, + 13241, 13249, 13259, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, + 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13441, 13451, 13457, + 13463, 13469, 13477, 13487, 13499, 13513, 13523, 13537, 13553, 13567, 13577, + 13591, 13597, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13687, + 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, + 13763, 13781, 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, + 13879, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, + 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, 14083, + 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, + 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14327, 14341, 14347, + 14369, 14387, 14389, 14401, 14407, 14411, 14419, 14423, 14431, 14437, 14447, + 14449, 14461, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14551, + 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14629, 14633, 14639, 14653, + 14657, 14669, 14683, 14699, 14713, 14717, 14723, 14731, 14737, 14741, 14747, + 14753, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, + 14843, 14851, 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, + 14947, 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, + 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, 15161, + 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, 15263, 15269, + 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15349, + 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15413, 15427, 15439, 15443, + 15451, 15461, 15467, 15473, 15493, 15497, 15511, 15527, 15541, 15551, 15559, + 15569, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15647, 15649, + 15661, 15667, 15671, 15679, 15683, 15727, 15731, 15733, 15737, 15739, 15749, + 15761, 15767, 15773, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, + 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, + 15971, 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, + 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16187, + 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, 16273, 16301, + 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, 16411, 16417, 16421, + 16427, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16519, 16529, + 16547, 16553, 16561, 16567, 16573, 16603, 16607, 16619, 16631, 16633, 16649, + 16651, 16657, 16661, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, + 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16871, 16879, 16883, + 16889, 16901, 16903, 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, + 16987, 16993, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, + 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, + 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, 17321, + 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389}; + +bool isDivisibleBySmallPrimes(const BigInt64 &n) +{ + for (int i = 0; i < smallPrimesSize && n > smallPrimes[i]; i++) + if (n % smallPrimes[i] == 0) + return true; + + return false; +} + +bool fermatPrimalityTest(const BigInt64 &number, size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + if (isDivisibleBySmallPrimes(number)) + return false; + + while (k-- > 0) { + // assume n is a prime number + // pick randon integer a, such that 1 its not prime + if (modExpo != 1) + return false; + } + + return true; +} + +bool millerRabinPrimalityTest(const BigInt64 &number, size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + // Write n-1 as 2^s * d where d is odd + BigInt64 s = 0; + BigInt64 d = number - 1; + while (d.isEven()) { + d >>= 1; + s++; + } + while (k-- > 0) { + // pick randon integer a, such that 1 +bool isDivisibleBySmallPrimesBuffers(sycl::queue &q, const BigInt64 &n) +{ + const std::vector nVec(smallPrimesSize, n); + int sumResult = 0; + sycl::range<1> sizeRange{smallPrimesSize}; + sycl::buffer sumBuff{&sumResult, 1}; + sycl::buffer primesBuff{smallPrimes, sizeRange}; + sycl::buffer nBuff{nVec.data(), sizeRange}; + + q.submit([&](sycl::handler &h) { + auto sumResult = sycl::reduction(sumBuff, h, sycl::plus<>()); + sycl::accessor primesAcc(primesBuff, h, sycl::read_only); + sycl::accessor nAcc(nBuff, h, sycl::read_only); + + h.parallel_for(sizeRange, sumResult, [=](sycl::id<1> idx, auto &sum) { + if (nAcc[idx] % primesAcc[idx] == 0 && nAcc[idx] != primesAcc[idx]) + sum += true; + sum += false; + }); + }); + q.wait(); + return sumResult > 0; +} + +bool isDivisibleBySmallPrimesUSM(sycl::queue &q, const BigInt64 &n) +{ + const std::vector nVec(smallPrimesSize, n); + int sumResult = 0; + sycl::range<1> sizeRange{smallPrimesSize}; + sycl::buffer sumBuff{&sumResult, 1}; + + int *primesShared = sycl::malloc_shared(smallPrimesSize, q); + BigInt64 *nShared = sycl::malloc_shared(smallPrimesSize, q); + for (int i = 0; i < smallPrimesSize; i++) { + primesShared[i] = smallPrimes[i]; + nShared[i] = nVec[i]; + } + + q.submit([&](sycl::handler &h) { + auto sumResult = sycl::reduction(sumBuff, h, sycl::plus<>()); + + h.parallel_for(sizeRange, sumResult, [=](sycl::id<1> idx, auto &sum) { + if (nShared[idx] % primesShared[idx] == 0 && + nShared[idx] != primesShared[idx]) + sum += true; + sum += false; + }); + }); + q.wait(); + sycl::free(primesShared, q); + sycl::free(nShared, q); + return sumResult > 0; +} + +bool millerRabinPrimalityTestBuffers(sycl::queue &q, const BigInt64 &number, + size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + // Write n-1 as 2^s * d where d is odd + BigInt64 s = 0; + BigInt64 d = number - 1; + while (d.isEven()) { + d >>= 1; + s++; + } + vector randoms(k, BigInt64(BigInt64::RANDOM, 2, number - 2)); + vector dVec(k, d); + vector numberVec(k, number); + vector sVec(k, s); + + sycl::range<1> kRange{k}; + int sumResult = 0; + sycl::buffer sumBuf{&sumResult, 1}; + sycl::buffer randomsBuff{randoms.data(), kRange}; + sycl::buffer dBuff{dVec.data(), kRange}; + sycl::buffer numberBuff{numberVec.data(), kRange}; + sycl::buffer sBuff{sVec.data(), kRange}; + + q.submit([&](sycl::handler &cgh) { + auto sumReduction = reduction(sumBuf, cgh, sycl::plus<>()); + sycl::accessor randomsAcc(randomsBuff, cgh, + sycl::read_write); + sycl::accessor dAcc(dBuff, cgh, sycl::read_write); + sycl::accessor numberAcc(numberBuff, cgh, + sycl::read_write); + sycl::accessor sAcc(sBuff, cgh, sycl::read_write); + + cgh.parallel_for(kRange, sumReduction, [=](sycl::id<1> idx, auto &sum) { + BigInt64 aIn = randomsAcc[idx]; + BigInt64 dIn = dAcc[idx]; + BigInt64 numberIn = numberAcc[idx]; + BigInt64 sIn = sAcc[idx]; + // pick randon integer a, such that 1>= 1; + s++; + } + + std::uint64_t offset = number.getLsb(); + oneapi::dpl::minstd_rand engine(seed, offset); + oneapi::dpl::uniform_real_distribution distr; + BigInt64 a(2, number - 2, distr, engine); + + BigInt64 x = modularExponentiation(a, d, number); + if (x == 1 || x == number - 1) + return true; + + for (BigInt64 i = 0; i < s - 1; i++) { + x = modularExponentiation(x, 2, number); + if (x == number - 1) // x^2 mod n=n-1 + return true; + } + + return false; +} + +bool millerRabinPrimalityTestUSM(sycl::queue &q, const BigInt64 &number, + size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + // Write n-1 as 2^s * d where d is odd + BigInt64 s = 0; + BigInt64 d = number - 1; + while (d.isEven()) { + d >>= 1; + s++; + } + + sycl::range<1> kRange{k}; + int sumResult = 0; + sycl::buffer sumBuf{&sumResult, 1}; + + BigInt64 *randomsShared = sycl::malloc_shared(k, q); + BigInt64 *dShared = sycl::malloc_shared(k, q); + BigInt64 *numberShared = sycl::malloc_shared(k, q); + BigInt64 *sShared = sycl::malloc_shared(k, q); + + for (int i = 0; i < k; i++) { + randomsShared[i] = BigInt64(BigInt64::RANDOM, 2, number - 2); + dShared[i] = d; + numberShared[i] = number; + sShared[i] = s; + } + q.submit([&](sycl::handler &cgh) { + auto sumReduction = reduction(sumBuf, cgh, sycl::plus<>()); + + cgh.parallel_for(kRange, sumReduction, [=](sycl::id<1> idx, auto &sum) { + BigInt64 aIn = randomsShared[idx]; + BigInt64 dIn = dShared[idx]; + BigInt64 numberIn = numberShared[idx]; + BigInt64 sIn = sShared[idx]; + // pick randon integer a, such that 1 distr; + BigInt64 a(2, number - 2, distr, engine); + // check if n is divisible by a + if (gcd(number, a) != 1) + return false; + + BigInt64 modExpo = modularExponentiation(a, number - 1, number); + // Fermat's little theorem- a^(prime-1)%prime ==1, else-> its not prime + if (modExpo != 1) + return false; + + return true; +} + +bool fermatPrimalityTest(sycl::queue &q, const BigInt64 &number, size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + if (isDivisibleBySmallPrimes(number)) + return false; + + while (k-- > 0) { + // assume n is a prime number + // pick randon integer a, such that 1 its not prime + if (modExpo != 1) + return false; + } + + return true; +} + +bool nextPrimeChunk(BigInt64 &number, const BigInt64 &max, std::uint32_t seed) +{ + if (number < 2) + return 2; + + if (number.isEven()) + number++; + + while (!fermatPrimalityTestInKernel(number, seed)) { + number += 2; + if (number > max) + return false; + } + // candidate passed fermats test + return true; +} + +BigInt64 nextPrimeSequential(const BigInt64 &number, size_t k) +{ + if (number < 2) + return 2; + + BigInt64 res = number; + if (res.isEven()) + res++; + sycl::queue q; + do { + while (!fermatPrimalityTest(q, res, 1)) { + res += 2; + } + // candidate passed fermats test + } while (!millerRabinPrimalityTestUSM(q, res, k)); + return res; +} + +BigInt64 nextPrimeDivideToChunks(const BigInt64 &number, size_t k) +{ + log(logger::LogLevel::DEBUG, + "RSA next prime: finding next prime after random number "); + size_t numChunks; + size_t chunkSize; + size_t bits = number.bitsCount(); + if (bits <= 513) { // 500 + numChunks = 10; + chunkSize = 50; + } + else { // 1000 + numChunks = 10; + chunkSize = 100; + } + sycl::queue q; + BigInt64 *numberShared = sycl::malloc_shared(numChunks, q); + BigInt64 *maxShared = sycl::malloc_shared(numChunks, q); + bool *resultsShared = sycl::malloc_shared(numChunks, q); + BigInt64 currentStart = number; + while (true) { + for (int i = 0; i < numChunks; i++) { + resultsShared[i] = false; + numberShared[i] = currentStart + i * chunkSize; + maxShared[i] = currentStart + (i + 1) * chunkSize - 1; + } + + currentStart += chunkSize * numChunks; + int sumResult = 0; + sycl::buffer sumBuff{&sumResult, 1}; + + q.submit([&](sycl::handler &cgh) { + auto sumReduction = reduction(sumBuff, cgh, sycl::plus<>()); + cgh.parallel_for(sycl::range<1>{numChunks}, sumReduction, + [=](sycl::id<1> idx, auto &sum) { + resultsShared[idx] = + nextPrimeChunk(numberShared[idx], + maxShared[idx], idx.get(0)); + sum += resultsShared[idx]; + }); + }); + q.wait(); + for (int i = 0; i < numChunks; i++) { + if (resultsShared[i] == true) { + BigInt64 candidate = numberShared[i]; + bool passed = millerRabinPrimalityTestUSM(q, candidate, k); + if (passed) { + sycl::free(numberShared, q); + sycl::free(maxShared, q); + sycl::free(resultsShared, q); + log(logger::LogLevel::DEBUG, + "RSA next prime: found prime number at gap " + + (candidate - number).toString()); + return candidate; + } + } + } + + log(logger::LogLevel::DEBUG, + "RSA next prime: didnt find primes in range of " + + (currentStart - number).toString() + + " numbers, continue searching..."); + } +} + +#else +#include +#include +#include + +bool millerRabinPrimalityTestRound(const BigInt64 &number, const BigInt64 &d, + const BigInt64 &s, std::atomic &passed) +{ + BigInt64 a(BigInt64::CreateModes::RANDOM, 2, number - 2); + BigInt64 x = modularExponentiation(a, d, number); + if (x == 1 || x == number - 1) + return true; + + for (BigInt64 i = 0; passed.load() == true && i < s - 1; i++) { + x = modularExponentiation(x, 2, number); + if (x == number - 1) // x^2 mod n=n-1 + return true; + } + + return false; +} + +void parallelRound(const BigInt64 &number, const BigInt64 &d, const BigInt64 &s, + std::atomic &passed) +{ + if (!passed.load()) + return; + + bool res = millerRabinPrimalityTestRound(number, d, s, passed); + if (!res && passed.exchange(false)) + return; +} + +bool millerRabinPrimalityTestThreads(const BigInt64 &number, size_t k) +{ + if (number == 2 || number == 3) + return true; + + if (number <= 1 || number.isEven()) + return false; + + // Write n-1 as 2^s * d where d is odd + BigInt64 s = 0; + BigInt64 d = number - 1; + while (d.isEven()) { + d >>= 1; + s++; + } + + std::atomic passed(true); + std::vector threads; + for (int i = 0; i < k; i++) { + threads.emplace_back(parallelRound, std::ref(number), std::ref(d), + std::ref(s), std::ref(passed)); + } + + for (auto &t : threads) + t.join(); + return passed.load(); +} + +bool nextPrimeChunk(BigInt64 &number, const BigInt64 &end, + std::atomic &found) +{ + if (found.load()) + return false; + + if (number < 2) + return 2; + + if (number.isEven()) + number++; + while (!fermatPrimalityTest(number, 1)) { + number += 2; + if (found.load() || number > end) + return false; + } + + if (!found.exchange(true)) + return true; + + return true; +} + +BigInt64 nextPrimeDivideToChunks(const BigInt64 &number, size_t k) +{ + log(logger::LogLevel::DEBUG, + "RSA next prime: finding next prime after random number"); + size_t numChunks; + size_t chunkSize; + size_t bits = number.bitsCount(); + if (bits <= 513) { // 500 + numChunks = 10; + chunkSize = 50; + } + else { // 1000 + numChunks = 10; + chunkSize = 100; + } + + std::vector numbers(numChunks); + std::vector ends(numChunks); + BigInt64 currentStart = number; + std::vector > futures; + std::atomic found(false); + while (true) { + for (int i = 0; i < numChunks; i++) { + numbers[i] = currentStart + i * chunkSize; + ends[i] = currentStart + (i + 1) * chunkSize - 1; + futures.push_back(std::async(std::launch::async, nextPrimeChunk, + std::ref(numbers[i]), + std::ref(ends[i]), std::ref(found))); + } + + currentStart += numChunks * chunkSize; + for (int i = 0; i < numChunks; i++) + if (futures[i].get() && + millerRabinPrimalityTestThreads(numbers[i], k)) { + log(logger::LogLevel::DEBUG, + "RSA next prime: found prime number at gap " + + (numbers[i] - number).toString()); + return numbers[i]; + } + + log(logger::LogLevel::DEBUG, + "RSA next prime: didnt find primes in range of " + + (currentStart - number).toString() + + " numbers, continue searching..."); + futures.clear(); + } +} + +BigInt64 nextPrimeSequential(const BigInt64 &number, size_t k) +{ + if (number < 2) + return 2; + + BigInt64 res = number; + if (res.isEven()) + res++; + do { + while (!fermatPrimalityTest(res, 1)) { + res += 2; + } + + // candidate passed fermats test + } while (!millerRabinPrimalityTestThreads(res, k)); + return res; +} + +#endif \ No newline at end of file diff --git a/hsm-server/src/rsa.cpp b/hsm-server/src/rsa.cpp new file mode 100644 index 00000000..2cafd9f9 --- /dev/null +++ b/hsm-server/src/rsa.cpp @@ -0,0 +1,357 @@ +#include +#include +#include +#include +#include "../include/rsa.h" +#include "../logger/logger.h" +#include "../include/prime_tests.h" +#include "../include/big_int64.h" + +using namespace std; + +constexpr int PADDING_MIN_LEN = 11; +constexpr int PRIME_TEST_ROUNDS = 40; +constexpr int DEFAULT_E = 65537; +constexpr int FALLBACK_E = 17; + +bool allowedKeySizes(size_t keySize) +{ + return keySize == 1024 || keySize == 2048 || keySize == 4096; +} + +void rsaGeneratePrime(size_t bits, BigInt64 &prime) +{ + BigInt64 random = BigInt64(BigInt64::CreateModes::RANDOM, bits); + prime = nextPrimeDivideToChunks(random, PRIME_TEST_ROUNDS); +} + +void rsaKeysGeneration(const BigInt64 &p, const BigInt64 &q, size_t keySize, + BigInt64 &e, BigInt64 &d) +{ + BigInt64 phi; + BigInt64 gcdVal; + // phi(n) = (p-1) * (q-1) + BigInt64 pMinus1 = p - 1; + BigInt64 qMinus1 = q - 1; + phi = pMinus1 * qMinus1; + // Choose e such that 1 < e < phi and gcd(e, phi) = 1 (coprime) + // A common choice for e is 65537 + e = DEFAULT_E; + gcdVal = gcd(e, phi); + while (gcdVal != 1) { + e += 2; + if (e > phi) + e = FALLBACK_E; + } + + // d is the modular inverse of e modulo ϕ(n) or e^-1 mod phi + // 0 dis(1, 255); + // Start with 0x00 0x02 + padded[0] = 0x00; + padded[1] = 0x02; + + // Add non-zero random padding + for (size_t i = 2; i < paddingLen + 2; i++) { + padded[i] = static_cast(dis(gen)); + } + + // Add 0x00 separator + padded[paddingLen + 2] = 0x00; + std::memcpy(padded + paddingLen + 3, plaintext, plaintextLen); +} + +void rsaPkcs1v15Unpad(const uint8_t *padded, size_t paddedLen, + uint8_t *plaintext, size_t *plaintextLen) +{ + if (paddedLen < PADDING_MIN_LEN || padded[0] != 0x00 || padded[1] != 0x02) + throw std::runtime_error("Invalid padding"); + + // Find 0x00 separator + size_t i = 2; + while (i < paddedLen && padded[i] != 0x00) + ++i; + if (i == paddedLen) + throw std::runtime_error("Invalid padding: No separator found"); + + *plaintextLen = paddedLen - i - 1; + std::memcpy(plaintext, padded + i + 1, *plaintextLen); +} + +/** + * @brief Encrypts data using RSA public or private key. + * @param plaintext Pointer to the plaintext data. + * @param plaintextLen The length of the plaintext in bytes. + * @param modulus Pointer to the modulus (n). + * @param modulusLen The length of the modulus in bytes. + * @param exponent Pointer to the exponent (either public or private). + * @param exponentLen The length of the exponent in bytes. + * @param ciphertext Pointer to the buffer where the encrypted data (ciphertext) will be stored. + * @param ciphertextLen The length of the ciphertext buffer. + * @param keySize The size of the RSA key in bits. + * @return CKR_OK on success, CKR_KEY_SIZE_RANGE if the key size is invalid, or CKR_BUFFER_TOO_SMALL if buffers are insufficient. + */ +CK_RV rsaEncrypt(const uint8_t *plaintext, size_t plaintextLen, + const uint8_t *key, size_t keyLen, uint8_t *ciphertext, + size_t ciphertextLen, size_t keySize) +{ + if (!allowedKeySizes(keySize)) { + log(logger::LogLevel::ERROR, "RSA encryption: invalid key size"); + return CKR_KEY_SIZE_RANGE; + } + + if ((!(keyLen == rsaGetPublicKeyLen(keySize)) && + !(keyLen == rsaGetPrivateKeyLen(keySize)))) { + log(logger::LogLevel::ERROR, + "RSA encryption: buffer sizes are insufficient"); + return CKR_BUFFER_TOO_SMALL; + } + + size_t keySizeBytes = keySize / BITS_IN_BYTE; + if (plaintextLen > rsaGetPlainMaxLen(keySize)) { + log(logger::LogLevel::ERROR, "RSA encryption: plaintext is too long"); + return CKR_DATA_TOO_LARGE; + } + + if (ciphertextLen != keySizeBytes) { + log(logger::LogLevel::ERROR, + "RSA encryption: ciphertext buffer is too small"); + return CKR_BUFFER_TOO_SMALL; + } + + size_t paddedLen = keySizeBytes; + // Padding plaintext to keySizeBytes + uint8_t *padded = new uint8_t[keySizeBytes]; + rsaPkcs1v15Pad(plaintext, plaintextLen, padded, keySizeBytes); + // Convert padded plaintext to BigInt64 + BigInt64 plainNumber(padded, paddedLen, + BigInt64::CreateModes::BIG_ENDIANESS); + BigInt64 modulus(key, rsaGetModulusLen(keySize), + BigInt64::CreateModes::BIG_ENDIANESS); + BigInt64 exponent(key + rsaGetModulusLen(keySize), + keyLen - rsaGetModulusLen(keySize), + BigInt64::CreateModes::BIG_ENDIANESS); + // Encrypt message: plain = plain^key % n + BigInt64 cipherNumber; + try { + cipherNumber = modularExponentiation(plainNumber, exponent, modulus); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "RSA encryption: error performing modular exponentiation " + + string(e.what())); + return CKR_DECRYPTED_DATA_INVALID; + } + + memset(ciphertext, 0, keySizeBytes); + cipherNumber.exportTo(ciphertext, ciphertextLen, + BigInt64::CreateModes::BIG_ENDIANESS); + delete[] padded; + return CKR_OK; +} + +/** + * @brief Decrypts data using RSA public or private key. + * @param ciphertext Pointer to the encrypted data (ciphertext). + * @param ciphertextLen The length of the ciphertext in bytes. + * @param modulus Pointer to the modulus (n). + * @param modulusLen The length of the modulus in bytes. + * @param exponent Pointer to the exponent (either public or private). + * @param exponentLen The length of the exponent in bytes. + * @param plaintext Pointer to the buffer where the decrypted data (plaintext) will be stored. + * @param plaintextLen Pointer to a variable that will store the length of the decrypted data. + * @param keySize The size of the RSA key in bits. + * @return CKR_OK on success, CKR_KEY_SIZE_RANGE if the key size is invalid, or CKR_BUFFER_TOO_SMALL if buffers are insufficient. + */ +CK_RV rsaDecrypt(const uint8_t *ciphertext, size_t ciphertextLen, + const uint8_t *key, size_t keyLen, uint8_t *plaintext, + size_t *plaintextLen, size_t keySize) +{ + if (!allowedKeySizes(keySize)) { + log(logger::LogLevel::ERROR, "RSA decryption: invalid key size"); + return CKR_KEY_SIZE_RANGE; + } + + if ((!(keyLen == rsaGetPublicKeyLen(keySize)) && + !(keyLen == rsaGetPrivateKeyLen(keySize)))) { + log(logger::LogLevel::ERROR, + "RSA encryption: buffer sizes are insufficient"); + return CKR_BUFFER_TOO_SMALL; + } + + size_t keySizeBytes = keySize / BITS_IN_BYTE; + if (ciphertextLen != keySizeBytes) { + log(logger::LogLevel::ERROR, + "RSA decryption: ciphertext buffer is too small"); + return CKR_BUFFER_TOO_SMALL; + } + + // Convert ciphertext to BigInt64 + BigInt64 cipherNumber(ciphertext, ciphertextLen, + BigInt64::CreateModes::BIG_ENDIANESS); + BigInt64 modulus(key, rsaGetModulusLen(keySize), + BigInt64::CreateModes::BIG_ENDIANESS); + BigInt64 exponent(key + rsaGetModulusLen(keySize), + keyLen - rsaGetModulusLen(keySize), + BigInt64::CreateModes::BIG_ENDIANESS); + // Decrypt message: plain = cipher^key % n + BigInt64 plainNumber; + try { + plainNumber = modularExponentiation(cipherNumber, exponent, modulus); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "RSA decryption: error performing modular exponentiation " + + string(e.what())); + return CKR_ENCRYPTED_DATA_INVALID; + } + + uint8_t *padded = new uint8_t[keySizeBytes]; + size_t paddedLen = keySizeBytes; + plainNumber.exportTo(padded, paddedLen, + BigInt64::CreateModes::BIG_ENDIANESS); + // Remove padding + try { + rsaPkcs1v15Unpad(padded, paddedLen, plaintext, plaintextLen); + } + catch (std::exception &e) { + log(logger::LogLevel::ERROR, + "RSA decryption: error unpadding plaintext " + string(e.what())); + delete[] padded; + return CKR_DECRYPTED_DATA_INVALID; + } + + delete[] padded; + return CKR_OK; +} + +size_t rsaGetEncryptedLen(size_t keySize) +{ + return keySize / BITS_IN_BYTE; +} + +/** + * @brief Gets the maximum length of plaintext that can be encrypted with a given RSA key size. + * @param keySize The size of the RSA key in bits. + * @return The maximum length of plaintext in bytes. + */ +size_t rsaGetPlainMaxLen(size_t keySize) +{ + return keySize / BITS_IN_BYTE - PADDING_MIN_LEN; +} + +/** + * @brief Gets the length of decrypted data for a given RSA key size. + * @param keySize The size of the RSA key in bits. + * @return The length of the decrypted data in bytes. + */ +size_t rsaGetDecryptedLen(size_t keySize) +{ + // Minimum padding length for PKCS#1 v1.5 is 11 bytes + // Remove the padding: The maximum length of the plaintext is keySize - + // minPaddingLength + return keySize / BITS_IN_BYTE - PADDING_MIN_LEN; +} + +/** + * @brief Gets the total length of the public key (including the modulus and public exponent) for RSA. + * @param keySize The size of the RSA key in bits. + * @return The length of the public key in bytes, which includes the modulus and the public exponent. + */ +size_t rsaGetPublicKeyLen(size_t keySize) +{ + return rsaGetModulusLen(keySize) + BYTES_IN_LIMB; +} + +/** + * @brief Gets the total length of the private key (including the modulus and private exponent) for RSA. + * @param keySize The size of the RSA key in bits. + * @return The length of the private key in bytes, which includes the modulus and the private exponent. + */ +size_t rsaGetPrivateKeyLen(size_t keySize) +{ + return rsaGetModulusLen(keySize) + keySize / BITS_IN_BYTE; +} \ No newline at end of file diff --git a/hsm-server/src/sha256.cpp b/hsm-server/src/sha256.cpp new file mode 100644 index 00000000..568a0116 --- /dev/null +++ b/hsm-server/src/sha256.cpp @@ -0,0 +1,340 @@ +#include "../include/sha256.h" +#include + +#ifdef USE_SYCL +#include +using namespace sycl; +#endif //USE_SYCL +using namespace std; + +// Constants used in SHA-256 processing +#define CHOOSE(x, y, z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJORITY(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define ROTRIGHT(a, b) (((a) >> (b)) | ((a) << (32 - (b)))) +#define SIGMA0(x) (ROTRIGHT(x, 2) ^ ROTRIGHT(x, 13) ^ ROTRIGHT(x, 22)) +#define SIGMA1(x) (ROTRIGHT(x, 6) ^ ROTRIGHT(x, 11) ^ ROTRIGHT(x, 25)) +#define GAMMA0(x) (ROTRIGHT(x, 7) ^ ROTRIGHT(x, 18) ^ ((x) >> 3)) +#define GAMMA1(x) (ROTRIGHT(x, 17) ^ ROTRIGHT(x, 19) ^ ((x) >> 10)) +/** + * SHA256 constructor initializes the hash values with SHA-256 specific constants. + * Sets the initial message size and bit length to 0. + */ +SHA256::SHA256() +{ + result[0] = 0x6a09e667; + result[1] = 0xbb67ae85; + result[2] = 0x3c6ef372; + result[3] = 0xa54ff53a; + result[4] = 0x510e527f; + result[5] = 0x9b05688c; + result[6] = 0x1f83d9ab; + result[7] = 0x5be0cd19; + messageSize = 0; + bitLength = 0; +} +/** + * Updates the SHA-256 hash with the provided data. + * Processes data in 64-byte chunks, calling `transform` for each chunk. + * + * @param data A vector of bytes to be added to the hash. + */ +CK_RV SHA256::update(const std::vector &data) +{ + log(logger::LogLevel::DEBUG, "Updating SHA-256 with data."); + + // Get the size of the input data + size_t length = data.size(); + + // Process the input data byte by byte + for (size_t i = 0; i < length; i++) { + message[messageSize++] = static_cast(data[i]); + + // If the message buffer is full (64 bytes), apply the SHA-256 transform + if (messageSize == 64) { + CK_RV transform_status = transform(); + if (transform_status != CKR_OK) { + log(logger::LogLevel::ERROR, + "Transform failed during SHA-256 update."); + return transform_status; // Return the error code from the transform function + } + + // Reset the message size and increment the bit length + messageSize = 0; + bitLength += 512; + } + } + return CKR_OK; // Return success if everything goes well +} + +/** + * Adds padding to the message and appends the length of the original message. + * The message is padded so its length is congruent to 56 modulo 64. + */ +void SHA256::padding() +{ + log(logger::LogLevel::DEBUG, + "Padding the message and appending its length to make it congruent to " + "56 mod 64."); + + uint64_t currentLength = messageSize; + uint8_t paddingEnd = currentLength < 56 ? 56 : 64; + + // Append the 0x80 byte (0b10000000) + message[currentLength++] = 0x80; + + // Pad with 0x00 bytes until the length of the message is 56 bytes mod 64 + memset(message + currentLength, 0, paddingEnd - currentLength); + currentLength = paddingEnd; + + // If message length is >= 56, process the current block and reset for new padding + if (messageSize >= 56) { + transform(); + memset(message, 0, 56); + currentLength = 56; + } + + // Append the length of the original message in bits (64-bit big-endian) + bitLength += messageSize * 8; + for (int i = 0; i < 8; i++) { + message[63 - i] = bitLength >> (i * 8); + } + transform(); +} + +#ifdef USE_SYCL + +/** + * Transforms the message block by applying SHA-256 compression. + * This function runs in parallel using SYCL if the USE_SYCL flag is enabled. + * + * The function computes the message schedule array (`temp`) and then + * updates the hash state by processing the message in 64 rounds. + */ +CK_RV SHA256::transform() +{ + log(logger::LogLevel::DEBUG, + "Transforming message block and updating hash state using 64 rounds of " + "SHA-256 compression."); + uint32_t temp[64]; + queue q; + + // Check if message size is correct + if (messageSize != 64) { + log(logger::LogLevel::ERROR, "Message size is not 64 bytes."); + return CKR_FUNCTION_FAILED; // Return an error code if the message size is incorrect + } + + // Initialize the first 16 elements of temp with the message schedule + for (uint8_t i = 0, j = 0; i < 16; i++, j += 4) + temp[i] = (message[j] << 24) | (message[j + 1] << 16) | + (message[j + 2] << 8) | (message[j + 3]); + + for (uint8_t k = 16; k < 64; k++) + temp[k] = GAMMA1(temp[k - 2]) + temp[k - 7] + GAMMA0(temp[k - 15]) + + temp[k - 16]; + + // Save the current state + uint32_t s[8]; + for (uint8_t i = 0; i < 8; i++) + s[i] = result[i]; + + for (size_t i = 0; i < 64; i++) { + uint32_t choose, sum, majority, newA, newE; + + choose = CHOOSE(s[4], s[5], s[6]); + majority = MAJORITY(s[0], s[1], s[2]); + sum = temp[i] + bytes[i] + s[7] + choose + SIGMA1(s[4]); + newA = SIGMA0(s[0]) + majority + sum; + newE = s[3] + sum; + + s[7] = s[6]; + s[6] = s[5]; + s[5] = s[4]; + s[4] = newE; + s[3] = s[2]; + s[2] = s[1]; + s[1] = s[0]; + s[0] = newA; + } + // Process the message in 64-byte chunks, parallelizing where feasible + { + buffer state_buf(s, range<1>(8)); + buffer result_buf(result, range<1>(8)); + + // Update the result with the state + q.submit([&](handler &h) { + auto state_acc = state_buf.get_access(h); + auto result_acc = + result_buf.get_access(h); + + h.parallel_for(range<1>(8), [=](id<1> idx) { + result_acc[idx] += state_acc[idx]; + }); + }).wait(); + } + return CKR_OK; +} + +/** + * Finalizes the SHA-256 hash computation. + * Applies padding and appends the length of the original message. + * Returns the final hash as a vector of bytes. + * + * @param state The SHA256State object to finalize. + * @return A vector containing the SHA-256 hash value. + */ +CK_RV SHA256::finalize(std::vector &output) +{ + log(logger::LogLevel::DEBUG, + "Finalizing SHA-256 hash computation and returning the hash value."); + + try { + // Perform padding + padding(); + + // SHA-256 hash size is 32 bytes (256 bits) + std::vector hash(32); + + // Define SYCL buffers + sycl::buffer result_buf(result, sycl::range<1>(8)); + sycl::buffer hash_buf(hash.data(), sycl::range<1>(32)); + + // Submit SYCL command group + sycl::queue q; + q.submit([&](sycl::handler &h) { + auto result_acc = + result_buf.get_access(h); + auto hash_acc = hash_buf.get_access(h); + h.parallel_for(sycl::range<1>(8), [=](sycl::id<1> idx) { + size_t i = idx[0]; + hash_acc[i * 4 + 0] = (result_acc[i] >> 24) & 0xff; + hash_acc[i * 4 + 1] = (result_acc[i] >> 16) & 0xff; + hash_acc[i * 4 + 2] = (result_acc[i] >> 8) & 0xff; + hash_acc[i * 4 + 3] = (result_acc[i] >> 0) & 0xff; + }); + }).wait(); + + // Copy the hash to the output vector + output = hash; + + return CKR_OK; // Return success + } + catch (const sycl::exception &e) { + // Handle SYCL exceptions + log(logger::LogLevel::ERROR, "SYCL error: " + std::string(e.what())); + return CKR_FUNCTION_FAILED; + } + catch (const std::exception &e) { + // Handle other exceptions + log(logger::LogLevel::ERROR, + "Standard error: " + std::string(e.what())); + return CKR_FUNCTION_FAILED; + } +} + +#else + +/** + * Processes a 64-byte block of the message and updates the hash state. + * Applies the SHA-256 compression function to the current block. + */ +CK_RV SHA256::transform() +{ + log(logger::LogLevel::DEBUG, + "Transforming message block and updating hash state using 64 rounds of " + "SHA-256 compression."); + + uint32_t temp[64]; + + // Initialize temp array with message data + for (uint8_t i = 0, j = 0; i < 16; i++, j += 4) + temp[i] = (message[j] << 24) | (message[j + 1] << 16) | + (message[j + 2] << 8) | (message[j + 3]); + + // Compute remaining values for temp array + for (uint8_t k = 16; k < 64; k++) + temp[k] = GAMMA1(temp[k - 2]) + temp[k - 7] + GAMMA0(temp[k - 15]) + + temp[k - 16]; + + // Initialize working variables + uint32_t a, b, c, d, e, f, g, h; + a = result[0]; + b = result[1]; + c = result[2]; + d = result[3]; + e = result[4]; + f = result[5]; + g = result[6]; + h = result[7]; + + // Perform the 64 rounds of SHA-256 compression + for (size_t i = 0; i < 64; i++) { + uint32_t temp1 = h + SIGMA1(e) + CHOOSE(e, f, g) + bytes[i] + temp[i]; + uint32_t temp2 = SIGMA0(a) + MAJORITY(a, b, c); + h = g; + g = f; + f = e; + e = d + temp1; + d = c; + c = b; + b = a; + a = temp1 + temp2; + } + + // Update result with compressed values + result[0] += a; + result[1] += b; + result[2] += c; + result[3] += d; + result[4] += e; + result[5] += f; + result[6] += g; + result[7] += h; + + return CKR_OK; // Return success if no errors occurred +} + +/** + * Finalizes the SHA-256 hash computation. + * Applies padding and appends the length of the original message. + * Returns the final hash as a vector of bytes. + * + * @return A vector containing the SHA-256 hash value. + */ +CK_RV SHA256::finalize(std::vector &output) +{ + log(logger::LogLevel::DEBUG, "Finalizing SHA-256 hash computation."); + + // Check if the internal state is valid + if (result == nullptr) { + log(logger::LogLevel::ERROR, + "SHA-256 computation has not been initialized or has failed."); + return CKR_FUNCTION_FAILED; + } + + try { + // Apply padding to the data + padding(); + } + catch (const std::exception &e) { + log(logger::LogLevel::ERROR, + std::string("Padding failed: ") + e.what()); + return CKR_FUNCTION_FAILED; + } + + // Ensure the output vector has the correct size + if (output.size() != 32) { + output.resize(32); + } + + for (size_t i = 0; i < 8; i++) { + output[i * 4 + 0] = (result[i] >> 24) & 0xFF; + output[i * 4 + 1] = (result[i] >> 16) & 0xFF; + output[i * 4 + 2] = (result[i] >> 8) & 0xFF; + output[i * 4 + 3] = (result[i]) & 0xFF; + } + + return CKR_OK; +} + +#endif //USE_SYCL \ No newline at end of file diff --git a/hsm-server/tests/aes_tests.cpp b/hsm-server/tests/aes_tests.cpp new file mode 100644 index 00000000..2e467a11 --- /dev/null +++ b/hsm-server/tests/aes_tests.cpp @@ -0,0 +1,197 @@ +#include +#include "gtest/gtest.h" +#include "aes.h" +#include "debug_utils.h" +#include "aes_stream_factory.h" // Assuming this is where your FactoryManager is defined + +/* Helper function to setup encryption and decryption */ +void testEncryptionDecryption(AESChainingMode mode, AESKeyLength keyLength) +{ + // Same data as used in testEncryptionDecryptionAPI + size_t inputLength1 = 16; + unsigned char inputData1[inputLength1]; + memset(inputData1, 0x01, inputLength1); + size_t inputLength2 = 16; + unsigned char inputData2[inputLength2]; + memset(inputData2, 0x02, inputLength2); + size_t inputLength3 = 16; + unsigned char inputData3[inputLength3]; + memset(inputData3, 0x03, inputLength3); + + // Create a factory instance + StreamAES *streamAES = FactoryManager::getInstance().create(mode); + ASSERT_NE(streamAES, nullptr); + + // Allocate memory for the key + std::unique_ptr key( + new unsigned char[aesKeyLengthData[keyLength].keySize]); + generateKey(key.get(), keyLength); + + // Calculate encrypted lengths + unsigned int encryptedLen1 = + calculatEncryptedLenAES(inputLength1, true, mode); + unsigned int encryptedLen2 = + calculatEncryptedLenAES(inputLength2, false, mode); + unsigned int encryptedLen3 = + calculatEncryptedLenAES(inputLength3, false, mode); + + // Allocate memory for encrypted data based on the calculated lengths + std::unique_ptr encrypted( + new unsigned char[encryptedLen1]); + std::unique_ptr encrypted2( + new unsigned char[encryptedLen2]); + std::unique_ptr encrypted3( + new unsigned char[encryptedLen3]); + + unsigned int outLenEncrypted = 0; + unsigned int outLenEncrypted2 = 0; + unsigned int outLenEncrypted3 = 0; + + // Use the raw pointers from unique_ptr + unsigned char *encryptedPtr = encrypted.get(); + unsigned char *encrypted2Ptr = encrypted2.get(); + unsigned char *encrypted3Ptr = encrypted3.get(); + + // Encrypt the data + streamAES->encryptStart(inputData1, inputLength1, encryptedPtr, + outLenEncrypted, key.get(), keyLength); + streamAES->encryptContinue(inputData2, inputLength2, encrypted2Ptr, + outLenEncrypted2); + streamAES->encryptContinue(inputData3, inputLength3, encrypted3Ptr, + outLenEncrypted3); + + // Print encrypted data + printBufferHexa(encryptedPtr, outLenEncrypted, + "Encrypted data1 aes through streamAES"); + printBufferHexa(encrypted2Ptr, outLenEncrypted2, + "Encrypted data2 aes through streamAES"); + printBufferHexa(encrypted3Ptr, outLenEncrypted3, + "Encrypted data3 aes through streamAES"); + + // Calculate decrypted lengths + unsigned int decryptedLen1 = + calculatDecryptedLenAES(outLenEncrypted, true, mode); + unsigned int decryptedLen2 = + calculatDecryptedLenAES(outLenEncrypted2, false, mode); + unsigned int decryptedLen3 = + calculatDecryptedLenAES(outLenEncrypted3, false, mode); + + // Allocate memory for decrypted data + std::unique_ptr decrypted( + new unsigned char[decryptedLen1]); + std::unique_ptr decrypted2( + new unsigned char[decryptedLen2]); + std::unique_ptr decrypted3( + new unsigned char[decryptedLen3]); + + unsigned int outLenDecrypted = 0; + unsigned int outLenDecrypted2 = 0; + unsigned int outLenDecrypted3 = 0; + + // Use the raw pointers from unique_ptr + unsigned char *decryptedPtr = decrypted.get(); + unsigned char *decrypted2Ptr = decrypted2.get(); + unsigned char *decrypted3Ptr = decrypted3.get(); + + // Decrypt the data + streamAES->decryptStart(encryptedPtr, outLenEncrypted, decryptedPtr, + outLenDecrypted, key.get(), keyLength); + streamAES->decryptContinue(encrypted2Ptr, outLenEncrypted2, decrypted2Ptr, + outLenDecrypted2); + streamAES->decryptContinue(encrypted3Ptr, outLenEncrypted3, decrypted3Ptr, + outLenDecrypted3); + + // Print original and decrypted data for comparison + printBufferHexa(inputData1, inputLength1, "Original Data1: "); + printBufferHexa(decryptedPtr, outLenDecrypted, "Decrypted Data1: "); + printBufferHexa(inputData2, inputLength2, "Original Data2: "); + printBufferHexa(decrypted2Ptr, outLenDecrypted2, "Decrypted Data2: "); + printBufferHexa(inputData3, inputLength3, "Original Data3: "); + printBufferHexa(decrypted3Ptr, outLenDecrypted3, "Decrypted Data3: "); + + // Assertions to verify correctness + ASSERT_EQ(memcmp(inputData1, decryptedPtr, inputLength1), 0); + ASSERT_EQ(memcmp(inputData2, decrypted2Ptr, inputLength2), 0); + ASSERT_EQ(memcmp(inputData3, decrypted3Ptr, inputLength3), 0); +} + +TEST(KeyLengths, KeyLength128_ECB) +{ + testEncryptionDecryption(AESChainingMode::ECB, AESKeyLength::AES_128); +} + +TEST(KeyLengths, KeyLength128_CBC) +{ + testEncryptionDecryption(AESChainingMode::CBC, AESKeyLength::AES_128); +} + +TEST(KeyLengths, KeyLength128_CFB) +{ + testEncryptionDecryption(AESChainingMode::CFB, AESKeyLength::AES_128); +} + +TEST(KeyLengths, KeyLength128_OFB) +{ + testEncryptionDecryption(AESChainingMode::OFB, AESKeyLength::AES_128); +} + +TEST(KeyLengths, KeyLength128_CTR) +{ + testEncryptionDecryption(AESChainingMode::CTR, AESKeyLength::AES_128); +} + +TEST(KeyLengths, KeyLength192_ECB) +{ + testEncryptionDecryption(AESChainingMode::ECB, AESKeyLength::AES_192); +} + +TEST(KeyLengths, KeyLength192_CBC) +{ + testEncryptionDecryption(AESChainingMode::CBC, AESKeyLength::AES_192); +} + +TEST(KeyLengths, KeyLength192_CFB) +{ + testEncryptionDecryption(AESChainingMode::CFB, AESKeyLength::AES_192); +} + +TEST(KeyLengths, KeyLength192_OFB) +{ + testEncryptionDecryption(AESChainingMode::OFB, AESKeyLength::AES_192); +} + +TEST(KeyLengths, KeyLength192_CTR) +{ + testEncryptionDecryption(AESChainingMode::CTR, AESKeyLength::AES_192); +} + +TEST(KeyLengths, KeyLength256_ECB) +{ + testEncryptionDecryption(AESChainingMode::ECB, AESKeyLength::AES_256); +} + +TEST(KeyLengths, KeyLength256_CBC) +{ + testEncryptionDecryption(AESChainingMode::CBC, AESKeyLength::AES_256); +} + +TEST(KeyLengths, KeyLength256_CFB) +{ + testEncryptionDecryption(AESChainingMode::CFB, AESKeyLength::AES_256); +} + +TEST(KeyLengths, KeyLength256_OFB) +{ + testEncryptionDecryption(AESChainingMode::OFB, AESKeyLength::AES_256); +} + +TEST(KeyLengths, KeyLength256_CTR) +{ + testEncryptionDecryption(AESChainingMode::CTR, AESKeyLength::AES_256); +} + +int main() +{ + ::testing::InitGoogleTest(); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/hsm-server/tests/aes_tests.cpp:Zone.Identifier b/hsm-server/tests/aes_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/crypto_api_tests.cpp b/hsm-server/tests/crypto_api_tests.cpp new file mode 100644 index 00000000..d2cadf5e --- /dev/null +++ b/hsm-server/tests/crypto_api_tests.cpp @@ -0,0 +1,1032 @@ +#include "crypto_api.h" +#include "debug_utils.h" +#include "temp_hsm.h" +#include + +class CryptoAPIFixture : public ::testing::Test { + protected: + int user1 = 1; + int user2 = 2; + size_t counter = 1; + std::pair rsaKeyIds; + std::pair eccKeyIds; + std::vector permissions = { + KeyPermission::DECRYPT, KeyPermission::ENCRYPT, KeyPermission::SIGN, + KeyPermission::VERIFY, KeyPermission::EXPORTABLE}; + AESChainingMode chainingMode = AESChainingMode::CBC; // Change as needed + AESKeyLength keyLength = AESKeyLength::AES_128; // Change as needed + + void SetUp() override + { + rsaKeyIds = generateRSAKeyPair(1, permissions); + eccKeyIds = generateECCKeyPair(1, permissions); + } + + void TearDown() override {} +}; + +//#define RSA_TEST +// #define ECC_TEST +// #define SIGN_VERIFY_TEST + +#ifdef RSA_TEST +TEST_F(CryptoAPIFixture, rsa) +{ + // Generate RSA key pair for user1 + + uint8_t data[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + size_t dataLen = 6; + printBufferHexa(data, dataLen, "rsa plain data"); + + size_t encryptedLen = getRSAencryptedLength(); + uint8_t *encrypted = new uint8_t[encryptedLen]; + + // RSA encryption: user2 -> user1 + CK_RV rv2 = RSAencrypt(user2, rsaKeyIds.first, data, dataLen, encrypted, + encryptedLen); + EXPECT_EQ(CKR_OK, rv2); + + size_t decryptedLen = getRSAdecryptedLength(); + uint8_t *decrypted = new uint8_t[decryptedLen]; + + // RSA decryption: user1 + CK_RV rv3 = RSAdecrypt(user1, rsaKeyIds.second, encrypted, encryptedLen, + decrypted, &decryptedLen); + EXPECT_EQ(CKR_OK, rv3); + + printBufferHexa(decrypted, decryptedLen, "rsa decrypted"); + + EXPECT_EQ(0, memcmp(data, decrypted, dataLen)); + + delete[] encrypted; + delete[] decrypted; +} +#endif // RSA_TEST +#ifdef ECC_TEST +TEST_F(CryptoAPIFixture, ecc) +{ + // Generate ECC key pair for user1 + + size_t dataLen = 16; + uint8_t data[dataLen]; + memset(data, 1, dataLen); + + printBufferHexa(data, dataLen, "ecc plain data"); + + size_t encryptedLen = getECCencryptedLength(); + uint8_t *encrypted = new uint8_t[encryptedLen]; + + // ECC encryption: user2 -> user1 + CK_RV rv2 = ECCencrypt(user2, eccKeyIds.first, data, dataLen, encrypted, + encryptedLen); + printBufferHexa(encrypted, encryptedLen, "ecc encrypted"); + EXPECT_EQ(CKR_OK, rv2); + + size_t decryptedLen = getECCdecryptedLength(); + uint8_t *decrypted = new uint8_t[decryptedLen]; + + // ECC decryption: user1 + CK_RV rv3 = ECCdecrypt(user1, eccKeyIds.second, encrypted, encryptedLen, + decrypted, decryptedLen); + EXPECT_EQ(CKR_OK, rv3); + + printBufferHexa(decrypted, decryptedLen, "ecc decrypted"); + + EXPECT_EQ(0, memcmp(data, decrypted, dataLen)); + + delete[] encrypted; + delete[] decrypted; +} +#endif // ECC_TEST +#ifdef SIGN_VERIFY_TEST +TEST_F(CryptoAPIFixture, SignVerifySingleChunkTest) +{ + CK_RV rv; + // Define the data size to be within a single chunk (e.g., 32KB) + size_t singleChunkDataLen = + 32 * 1024; // 32KB, smaller than the 64KB chunk size + std::vector singleChunkData(singleChunkDataLen, + 0xAB); // Fill the data with 0xAB + + // Define chunk size (same as the data size, ensuring only one chunk) + size_t chunkSize = + singleChunkDataLen; // For single chunk, chunk size is equal to data size + size_t numChunks = 1; // Only one chunk in this case + + // Buffer for signature + size_t signatureLen = getSignatureLength(); + uint8_t + signature[signatureLen]; // Assuming RSA-2048 for a 256-byte signature + + // Sign the single chunk + std::cout << "Signing a single chunk..." << std::endl; + size_t offset = 0; // No offset needed for a single chunk + rv = signUpdate(user1, &singleChunkData[offset], singleChunkDataLen, + SHA_256, 0); // Only one call to signUpdate + EXPECT_EQ(CKR_OK, rv) << "signUpdate failed for the single chunk"; + + // Finalize signing + rv = + signFinalize(user1, signature, signatureLen, SHA_256, rsaKeyIds.second); + EXPECT_EQ(CKR_OK, rv) << "signFinalize failed"; + + // Verify the single chunk + std::cout << "Verifying a single chunk..." << std::endl; + rv = verifyUpdate(user2, &singleChunkData[offset], singleChunkDataLen, + SHA_256, 0); // Only one call to verifyUpdate + EXPECT_EQ(CKR_OK, rv) << "verifyUpdate failed for the single chunk"; + + // Finalize verifying + rv = verifyFinalize(user2, signature, signatureLen, SHA_256, + rsaKeyIds.first); + EXPECT_EQ(CKR_OK, rv) << "verifyFinalize failed"; + + // If all assertions pass, signing and verification of the single chunk were successful + std::cout << "Sign and Verify for a single chunk Passed" << std::endl; +} + +// Test for sign and verify functions +TEST_F(CryptoAPIFixture, SignVerifyChunkedTest) +{ + CK_RV rv; + // Simulate large data (e.g., 1MB) + size_t largeDataLen = 1024 * 1024; // 1MB + std::vector largeData( + largeDataLen, 0xAB); // Fill the data with 0xAB for simulation + + // Define chunk size (e.g., 64KB) + size_t chunkSize = 64 * 1024; + size_t numChunks = (largeDataLen + chunkSize - 1) / + chunkSize; // Calculate the number of chunks + + // Buffer for signature + size_t signatureLen = getSignatureLength(); + uint8_t + signature[signatureLen]; // Assuming RSA-2048 for a 256-byte signature + + // Sign in chunks + std::cout << "Signing in chunks..." << std::endl; + for (size_t i = 0; i < numChunks; ++i) { + size_t offset = i * chunkSize; + size_t currentChunkSize = std::min( + chunkSize, largeDataLen - offset); // Handle last chunk size + rv = + signUpdate(user1, &largeData[offset], currentChunkSize, SHA_256, i); + EXPECT_EQ(CKR_OK, rv) << "signUpdate failed for chunk " << i; + } + + // Finalize signing, user1 + rv = + signFinalize(user1, signature, signatureLen, SHA_256, rsaKeyIds.second); + EXPECT_EQ(CKR_OK, rv) << "signFinalize failed"; + + // Now, let's verify in chunks + std::cout << "Verifying in chunks..." << std::endl; + for (size_t i = 0; i < numChunks; ++i) { + size_t offset = i * chunkSize; + size_t currentChunkSize = std::min(chunkSize, largeDataLen - offset); + rv = verifyUpdate(user2, &largeData[offset], currentChunkSize, SHA_256, + i); + EXPECT_EQ(CKR_OK, rv) << "verifyUpdate failed for chunk " << i; + } + + // Finalize verifying + rv = verifyFinalize(user2, signature, signatureLen, SHA_256, + rsaKeyIds.first); + EXPECT_EQ(CKR_OK, rv) << "verifyFinalize failed"; + + // If all assertions pass, signing and verification of large data in chunks + // were successful + std::cout << "Sign and Verify for large data in chunks Passed" << std::endl; +} +#endif // SIGN_VERIFY_TEST +void testEncryptionDecryptionAPI(AESChainingMode mode, AESKeyLength keyLength) +{ + int user1 = 1; + int user2 = 2; + size_t counter = 1; + std::vector permissions = { + KeyPermission::DECRYPT, KeyPermission::ENCRYPT, KeyPermission::SIGN, + KeyPermission::VERIFY, KeyPermission::EXPORTABLE}; + AESChainingMode chainingMode = mode; // Change as needed + std::string keyId = generateAESKey(user1, keyLength, permissions, user2); + size_t inputLength1 = 64; + unsigned char inputData1[inputLength1]; + memset(inputData1, 0x02, inputLength1); + size_t inputLength2 = 32; + unsigned char inputData2[inputLength2]; + memset(inputData2, 0x02, inputLength2); + size_t inputLength3 = 32; + unsigned char inputData3[inputLength3]; + memset(inputData3, 0x02, inputLength3); + + size_t encryptedLength1 = getAESencryptedLength(inputLength1, true, mode); + uint8_t encryptedData1[encryptedLength1]; + size_t encryptedLength2 = getAESencryptedLength(inputLength2, false, mode); + uint8_t encryptedData2[encryptedLength2]; + size_t encryptedLength3 = getAESencryptedLength(inputLength3, false, mode); + uint8_t encryptedData3[encryptedLength3]; + counter = 3; + + // Encrypt the data + CK_RV result1 = AESencrypt(user1, user2, (void *)inputData1, inputLength1, + encryptedData1, encryptedLength1, keyLength, + chainingMode, counter, keyId); + + // Check for successful encryption + EXPECT_EQ(result1, CKR_OK); + // Encrypt the data + CK_RV result2 = AESencrypt(user1, user2, (void *)inputData2, inputLength2, + encryptedData2, encryptedLength2, keyLength, + chainingMode, counter, keyId); + + // Check for successful encryption + EXPECT_EQ(result2, CKR_OK); // Encrypt the data + CK_RV result3 = AESencrypt(user1, user2, (void *)inputData3, inputLength3, + encryptedData3, encryptedLength3, keyLength, + chainingMode, counter, keyId); + + // Check for successful encryption + EXPECT_EQ(result3, CKR_OK); + + // Decrypt the data + size_t decryptedLength1 = + getAESdecryptedLength(encryptedLength1, true, mode); + size_t decryptedLength2 = + getAESdecryptedLength(encryptedLength2, false, mode); + size_t decryptedLength3 = + getAESdecryptedLength(encryptedLength3, false, mode); + printBufferHexa(encryptedData1, encryptedLength1, + "Encrypted data1 aes through api"); + printBufferHexa(encryptedData2, encryptedLength2, + "Encrypted data2 aes through api"); + printBufferHexa(encryptedData3, encryptedLength3, + "Encrypted data3 aes through api"); + uint8_t decryptedData1[decryptedLength1]; + uint8_t decryptedData2[decryptedLength2]; + uint8_t decryptedData3[decryptedLength3]; + + result1 = AESdecrypt(user1, user2, encryptedData1, encryptedLength1, + decryptedData1, decryptedLength1, keyLength, + chainingMode, counter, keyId); + EXPECT_EQ(result1, CKR_OK); + printBufferHexa(inputData1, inputLength1, "Original Data1: "); + printBufferHexa(decryptedData1, decryptedLength1, "Decrypted Data1: "); + result2 = AESdecrypt(user1, user2, encryptedData2, encryptedLength2, + decryptedData2, decryptedLength2, keyLength, + chainingMode, counter, keyId); + EXPECT_EQ(result2, CKR_OK); + + printBufferHexa(inputData2, inputLength2, "Original Data2: "); + printBufferHexa(decryptedData2, decryptedLength2, "Decrypted Data2: "); + result3 = AESdecrypt(user1, user2, encryptedData3, encryptedLength3, + decryptedData3, decryptedLength3, keyLength, + chainingMode, counter, keyId); + printBufferHexa(inputData3, inputLength3, "Original Data3: "); + printBufferHexa(decryptedData3, decryptedLength3, "Decrypted Data3: "); + + // Check for successful decryption + EXPECT_EQ(result3, CKR_OK); + + // Verify the decrypted data matches the original input + EXPECT_EQ(memcmp(inputData1, decryptedData1, decryptedLength1), 0); + EXPECT_EQ(memcmp(inputData2, decryptedData2, decryptedLength2), 0); + EXPECT_EQ(memcmp(inputData3, decryptedData3, decryptedLength3), 0); + EXPECT_EQ(inputLength1, decryptedLength1); + EXPECT_EQ(inputLength2, decryptedLength2); + EXPECT_EQ(inputLength3, decryptedLength3); +}; + + //#define AES_TESTS + +#ifdef AES_TESTS +TEST(KeyLengthsAPI, KeyLength128_ECB) +{ + testEncryptionDecryptionAPI(AESChainingMode::ECB, AESKeyLength::AES_128); +} + +TEST(KeyLengthsAPI, KeyLength128_CBC) +{ + testEncryptionDecryptionAPI(AESChainingMode::CBC, AESKeyLength::AES_128); +} + +TEST(KeyLengthsAPI, KeyLength128_CFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::CFB, AESKeyLength::AES_128); +} + +TEST(KeyLengthsAPI, KeyLength128_OFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::OFB, AESKeyLength::AES_128); +} + +TEST(KeyLengthsAPI, KeyLength128_CTR) +{ + testEncryptionDecryptionAPI(AESChainingMode::CTR, AESKeyLength::AES_128); +} + +TEST(KeyLengthsAPI, KeyLength192_ECB) +{ + testEncryptionDecryptionAPI(AESChainingMode::ECB, AESKeyLength::AES_192); +} + +TEST(KeyLengthsAPI, KeyLength192_CBC) +{ + testEncryptionDecryptionAPI(AESChainingMode::CBC, AESKeyLength::AES_192); +} + +TEST(KeyLengthsAPI, KeyLength192_CFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::CFB, AESKeyLength::AES_192); +} + +TEST(KeyLengthsAPI, KeyLength192_OFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::OFB, AESKeyLength::AES_192); +} + +TEST(KeyLengthsAPI, KeyLength192_CTR) +{ + testEncryptionDecryptionAPI(AESChainingMode::CTR, AESKeyLength::AES_192); +} + +TEST(KeyLengthsAPI, KeyLength256_ECB) +{ + testEncryptionDecryptionAPI(AESChainingMode::ECB, AESKeyLength::AES_256); +} + +TEST(KeyLengthsAPI, KeyLength256_CBC) +{ + testEncryptionDecryptionAPI(AESChainingMode::CBC, AESKeyLength::AES_256); +} + +TEST(KeyLengthsAPI, KeyLength256_CFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::CFB, AESKeyLength::AES_256); +} + +TEST(KeyLengthsAPI, KeyLength256_OFB) +{ + testEncryptionDecryptionAPI(AESChainingMode::OFB, AESKeyLength::AES_256); +} + +TEST(KeyLengthsAPI, KeyLength256_CTR) +{ + testEncryptionDecryptionAPI(AESChainingMode::CTR, AESKeyLength::AES_256); +} +#endif +void GenericEncryptionDecryptionTest(CryptoConfig config) +{ + try { + int user1 = 1; + int user2 = 2; + + std::vector permissions = { + KeyPermission::DECRYPT, KeyPermission::ENCRYPT, KeyPermission::SIGN, + KeyPermission::VERIFY, KeyPermission::EXPORTABLE}; + + configure(user1, config); //give encrypt-decrypt behavior + configure(user2, config); //give encrypt-decrypt behavior + bootSystem({{user1, permissions}, + {user2, permissions}}); //generate keys with permissions + + size_t inputLength1 = 32; + unsigned char inputData1[inputLength1]; + memset(inputData1, 0x01, inputLength1); + size_t inputLength2 = 32; + unsigned char inputData2[inputLength2]; + memset(inputData2, 0x02, inputLength2); + size_t inputLength3 = 24; + unsigned char inputData3[inputLength3]; + memset(inputData3, 0x03, inputLength3); + + size_t encryptedLength1 = getEncryptedLen(user1, inputLength1, true); + uint8_t encryptedData1[encryptedLength1]; + size_t encryptedLength2 = getEncryptedLen(user1, inputLength2, false); + uint8_t encryptedData2[encryptedLength2]; + size_t encryptedLength3 = getEncryptedLen(user1, inputLength3, false); + uint8_t encryptedData3[encryptedLength3]; + size_t counter = 3; + + size_t signatureLen = getSignatureLength(); + uint8_t *signature = new uint8_t[signatureLen]; + // Encrypt the data + CK_RV result1 = encrypt(user1, user2, (void *)inputData1, inputLength1, + encryptedData1, encryptedLength1, signature, + signatureLen, counter); + // printBufferHexa(encryptedData1, encryptedLength1, + // "Encrypted data1 aes through api"); + // Check for successful encryption + EXPECT_EQ(result1, CKR_OK); + // Encrypt the data + CK_RV result2 = encrypt(user1, user2, (void *)inputData2, inputLength2, + encryptedData2, encryptedLength2, signature, + signatureLen, counter); + // printBufferHexa(encryptedData2, encryptedLength2, + // "Encrypted data2 aes through api"); + // Check for successful encryption + EXPECT_EQ(result2, CKR_OK); // Encrypt the data + CK_RV result3 = encrypt(user1, user2, (void *)inputData3, inputLength3, + encryptedData3, encryptedLength3, signature, + signatureLen, counter); + // Check for successful encryption + EXPECT_EQ(result3, CKR_OK); + + // printBufferHexa(encryptedData3, encryptedLength3, + // "Encrypted data3 aes through api"); + // Decrypt the data + size_t decryptedLength1 = + getDecryptedLen(user1, encryptedLength1, true); + size_t decryptedLength2 = + getDecryptedLen(user1, encryptedLength2, false); + size_t decryptedLength3 = + getDecryptedLen(user1, encryptedLength3, false); + + uint8_t decryptedData1[decryptedLength1]; + uint8_t decryptedData2[decryptedLength2]; + uint8_t decryptedData3[decryptedLength3]; + + result1 = + decrypt(user1, user2, encryptedData1, encryptedLength1, signature, + signatureLen, decryptedData1, decryptedLength1, counter); + EXPECT_EQ(result1, CKR_OK); + printBufferHexa(inputData1, inputLength1, "Original Data1: "); + printBufferHexa(decryptedData1, decryptedLength1, "Decrypted Data1: "); + result2 = + decrypt(user1, user2, encryptedData2, encryptedLength2, signature, + signatureLen, decryptedData2, decryptedLength2, counter); + EXPECT_EQ(result2, CKR_OK); + printBufferHexa(inputData2, inputLength2, "Original Data2: "); + printBufferHexa(decryptedData2, decryptedLength2, "Decrypted Data2: "); + result3 = result1 = + decrypt(user1, user2, encryptedData3, encryptedLength3, signature, + signatureLen, decryptedData3, decryptedLength3, counter); + + printBufferHexa(inputData3, inputLength3, "Original Data3: "); + printBufferHexa(decryptedData3, decryptedLength3, "Decrypted Data3: "); + + // Check for successful decryption + EXPECT_EQ(result3, CKR_OK); + + // Verify the decrypted data matches the original input + EXPECT_EQ(memcmp(inputData1, decryptedData1, decryptedLength1), 0); + EXPECT_EQ(memcmp(inputData2, decryptedData2, decryptedLength2), 0); + EXPECT_EQ(memcmp(inputData3, decryptedData3, decryptedLength3), 0); + EXPECT_EQ(inputLength1, decryptedLength1); + EXPECT_EQ(inputLength2, decryptedLength2); + EXPECT_EQ(inputLength3, decryptedLength3); + } + catch (std::exception &e) { + std::cerr << "Error::::::::::: " << e.what() << std::endl; + } +} + +// Control macros to enable or disable RSA and ECC tests +//#define RUN_RSA_TESTS // Set to 1 to run RSA tests, 0 to skip +#define RUN_ECC_TESTS // Set to 1 to run ECC tests, 0 to skip + +//AES_128 combinations +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength128_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_128, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +// AES_192 combinations +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength192_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_192, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +// AES_256 combinations +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA256_KeyLength256_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_256, AESKeyLength::AES_256, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +// SHA_3_512 combinations for AES_128 +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength128_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_128, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +// SHA_3_512 combinations for AES_192 +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength192_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_192, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +// SHA_3_512 combinations for AES_256 +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_ECB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::ECB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_ECB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::ECB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CBC_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CBC, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CBC_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CBC, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_OFB_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::OFB, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_OFB_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::OFB, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_RSA_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CTR_RSA) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CTR, AsymmetricFunction::RSA); + GenericEncryptionDecryptionTest(config); +} +#endif + +#ifdef RUN_ECC_TESTS +TEST(EncryptDecryptAPI, SHA3_512_KeyLength256_CTR_ECC) +{ + CryptoConfig config(SHAAlgorithm::SHA_3_512, AESKeyLength::AES_256, + AESChainingMode::CTR, AsymmetricFunction::ECC); + GenericEncryptionDecryptionTest(config); +} +#endif \ No newline at end of file diff --git a/hsm-server/tests/crypto_api_tests.cpp:Zone.Identifier b/hsm-server/tests/crypto_api_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/ecc_tests.cpp b/hsm-server/tests/ecc_tests.cpp new file mode 100644 index 00000000..d2b1a6f1 --- /dev/null +++ b/hsm-server/tests/ecc_tests.cpp @@ -0,0 +1,18 @@ +#include "gtest/gtest.h" +#include "../include/ecc.h" + +// This test case checks the encryption and decryption functionality of the ECC class. +TEST(ECCTest, EncryptDecrypt) +{ + mpz_class privateKey = generatePrivateKey(); + Point publicKey = generatePublicKey(privateKey); + std::vector messageBytes(16, 1); + // Encrypt the message + auto cipher = encryptECC(messageBytes, publicKey); + + // Decrypt the message + auto decryptedMessage = decryptECC(cipher, privateKey); + + // Check if the decrypted message matches the original message + EXPECT_EQ(messageBytes, decryptedMessage); +} \ No newline at end of file diff --git a/hsm-server/tests/ecc_tests.cpp:Zone.Identifier b/hsm-server/tests/ecc_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/hash_tests.cpp b/hsm-server/tests/hash_tests.cpp new file mode 100644 index 00000000..ac8c9cbb --- /dev/null +++ b/hsm-server/tests/hash_tests.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include "../include/IHash.h" +#include "../include/hash_factory.h" + +// Helper function to convert vector to a hex string for comparison +std::string to_hex_string(const std::vector &data) +{ + std::ostringstream oss; + for (auto byte : data) { + oss << std::hex << std::setw(2) << std::setfill('0') + << static_cast(byte); + } + return oss.str(); +} + +// Test fixture class for SHA256 +class HashTest : public ::testing::Test { + protected: + void SetUp() override + { + // Get the FactoryManager instance + factoryManager = &HashFactory::getInstance(); + CK_RV result; + // Create SHA256 object using FactoryManager + result = factoryManager->create(SHA_256, sha256); + if (!sha256 || result != CKR_OK) { + FAIL() << "Failed to create SHA256 instance"; + } + + result = factoryManager->create(SHA_3_512, sha512); + if (!sha512 || result != CKR_OK) { + FAIL() << "Failed to create SHA512 instance"; + } + } + // Utility to hash a string and return the hex string of the result + std::string hashStringSHA256(const std::string &input) + { + std::vector output; + std::vector data(input.begin(), input.end()); + sha256->update(data); + sha256->finalize(output); + return to_hex_string(output); + } + + void hashStringSHA512(const std::vector> &chunks, + const std::string &expectedHash) + { + std::vector output; + for (const auto &chunk : chunks) { + sha512->update(chunk); + } + sha512->finalize(output); + std::string res = std::string(output.begin(), output.end()); + + ASSERT_EQ(res, expectedHash); + } + HashFactory *factoryManager; + std::unique_ptr sha256; + std::unique_ptr sha512; +}; + +// Test hashing an empty string +TEST_F(HashTest, HashEmptyString) +{ + std::string expectedHash = + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + std::string hash = hashStringSHA256(""); + EXPECT_EQ(hash, expectedHash); +} + +// Test hashing "abc" +TEST_F(HashTest, HashABC) +{ + std::string expectedHash = + "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; + std::string hash = hashStringSHA256("abc"); + EXPECT_EQ(hash, expectedHash); +} + +// Test hashing "hello world" +TEST_F(HashTest, HashHelloWorld) +{ + std::string expectedHash = + "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"; + std::string hash = hashStringSHA256("hello world"); + EXPECT_EQ(hash, expectedHash); +} + +// Test hashing a string with special characters +TEST_F(HashTest, HashSpecialCharacters) +{ + std::string specialChars = "!@#$%^&*()_+-={}[]|:;<>,.?/~`"; + std::string expectedHash = + "64192e06fd03a054a8f7a478adfed5b15effe6f3ecc24df06df143cc1d45b7" + "ab"; // Replace with the actual expected hash value + std::string hash = hashStringSHA256(specialChars); + EXPECT_EQ(hash, expectedHash); +} + +// Test for hash of an empty string +TEST_F(HashTest, EmptyStringHash) +{ + std::vector> data = {{}}; + std::string expectedHash = + "a69f73cca23a9ac5c8b567dc185a756e97c98216" + "4fe25859e0d1dcc1475c80a615b2123af1f5f94" + "c11e3e9402c3ac558f500199d95b6d3e3017585" + "86281dcd26"; + hashStringSHA512(data, expectedHash); +} + +// Test for hash of the string "abc" +TEST_F(HashTest, ABCStringHash) +{ + std::vector> data = {{'a', 'b', 'c'}}; + std::string expectedHash = + "b751850b1a57168a5693cd924b6b096e08f621827" + "444f70d884f5d0240d2712e10e116e9192af3c91" + "a7ec57647e3934057340b4cf408d5a56592f8274" + "eec53f0"; + hashStringSHA512(data, expectedHash); +} + +// Test for hash of a string longer than 64 bytes +TEST_F(HashTest, StringLongerThan64BytesHash) +{ + std::string longString = "The quick brown fox jumps over the lazy dog"; + std::vector> data = { + std::vector(longString.begin(), longString.end())}; + std::string expectedHash = + "01dedd5de4ef14642445ba5f5b97c15e47b9ad931" + "326e4b0727cd94cefc44fff23f07bf543139939b" + "49128caf436dc1bdee54fcb24023a08d9403f9b4" + "bf0d450"; + hashStringSHA512(data, expectedHash); +} + +// Test for hash of a string containing special characters +TEST_F(HashTest, SpecialCharsHash) +{ + std::string specialString = "!@#$%^&*()"; + std::vector> data = { + std::vector(specialString.begin(), specialString.end())}; + std::string expectedHash = + "fbbcb3e21184dd4061de0b85c4756f74e36a36112" + "5733e2c7470232fc66f71c902d1e6ff7eb60cfe6" + "b47e8b72e1429b4ff21de0fa150a2b3e8d8e29e2" + "64d56ab"; + hashStringSHA512(data, expectedHash); +} + +// Test for multiple updates +TEST_F(HashTest, MultipleUpdatesHash) +{ + std::vector> data = { + {'a', 'b'}, // First update with two bytes + {'c', 'd'} // Second update with two more bytes + }; + std::string expectedHash = + "6eb7b86765bf96a8467b72401231539cbb830f6c641" + "20954c4567272f613f1364d6a80084234fa3400d30" + "6b9f5e10c341bbdc5894d9b484a8c7deea9cbe4e265"; + hashStringSHA512(data, expectedHash); +} \ No newline at end of file diff --git a/hsm-server/tests/hash_tests.cpp:Zone.Identifier b/hsm-server/tests/hash_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/keys_tests.cpp b/hsm-server/tests/keys_tests.cpp new file mode 100644 index 00000000..7f8e1317 --- /dev/null +++ b/hsm-server/tests/keys_tests.cpp @@ -0,0 +1,107 @@ +// #include "hsm.h" // כלול את הקובץ שבו נמצאת הפונקציה generateKey +// #include +// #include +// #include +// #include +// // using json = nlohmann::json; + +// // פונקציה מדומה ליצירת מפתח +// std::string mockEncryption(int userId) { +// return "mockedKeyForUser" + std::to_string(userId); +// } + +// // בדיקה לפונקציה generateKey +// TEST(GenerateKeyTest, GeneratesCorrectJsonFile) { +// int userId = 123; +// KeyPermission permission = KeyPermission::READ; +// Hsm h; +// // קריאה לפונקציה כדי ליצור את קובץ המפתח +// h.generateKey(userId, permission, mockEncryption); + +// // יצירת שם הקובץ כדי לבדוק אם נוצר כהלכה +// std::string fileName = "../keys/key_" + std::to_string(userId) + ".json"; + +// // בדיקה שהקובץ נוצר +// ASSERT_TRUE(std::filesystem::exists(fileName)) << "Key file was not created!"; + +// // קריאת תוכן הקובץ +// std::ifstream file(fileName); +// ASSERT_TRUE(file.is_open()) << "Failed to open the key file!"; + +// // קריאת תוכן הקובץ ל-json +// nlohmann::json jsonData; +// file >> jsonData; +// file.close(); + +// // בדיקה שהמפתח, ההרשאה וה-userId נכונים +// EXPECT_EQ(jsonData["userId"], userId); +// EXPECT_EQ(jsonData["permission"], "Read"); +// EXPECT_EQ(jsonData["key"], "mockedKeyForUser123"); +// } + +// int main(int argc, char **argv) { +// ::testing::InitGoogleTest(&argc, argv); +// return RUN_ALL_TESTS(); +// } +// #include "hsm.h" // Include your HSM header file +// #include +// #include +// #include +// #include + +// using json = nlohmann::json; + +// // Utility function to read file content +// std::string readFileContent(const std::string &filePath) { +// std::ifstream file(filePath); +// if (!file.is_open()) { +// throw std::runtime_error("Failed to open file: " + filePath); +// } +// std::string content((std::istreambuf_iterator(file)), +// std::istreambuf_iterator()); +// return content; +// } + +// // Test the key generation function against a data file +// TEST(HsmTests, CompareWithDataFileTest) { +// Hsm hsm; +// int userId = 1; +// std::string keyId = "key_1726490958462"; +// std::vector permissions = {KeyPermission::VERIFY, +// KeyPermission::SIGN}; + +// // Setup: Generate a key and save it +// auto keyIds = hsm.generateAESKey(userId, permissions); +// std::string keyFilePath = "../keys/" + keyIds + ".key"; + +// // Path to the data file for comparison +// std::string dataFilePath = "../keys/key_1726490958462.key"; + +// // Read content from the generated key file +// std::string generatedKeyContent; +// try { +// generatedKeyContent = readFileContent(keyFilePath); +// } catch (const std::exception &ex) { +// FAIL() << "Exception while reading generated key file: " << ex.what(); +// } + +// // Read content from the expected data file +// std::string expectedKeyContent; +// try { +// expectedKeyContent = readFileContent(dataFilePath); +// } catch (const std::exception &ex) { +// FAIL() << "Exception while reading data file: " << ex.what(); +// } + +// // Compare the contents +// ASSERT_EQ(generatedKeyContent, expectedKeyContent) +// << "Key content does not match expected data"; + +// // Clean up: remove the key file after the test +// // std::filesystem::remove(keyFilePath); +// } + +// int main(int argc, char **argv) { +// ::testing::InitGoogleTest(&argc, argv); +// return RUN_ALL_TESTS(); +// } diff --git a/hsm-server/tests/keys_tests.cpp:Zone.Identifier b/hsm-server/tests/keys_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/rsa_tests.cpp b/hsm-server/tests/rsa_tests.cpp new file mode 100644 index 00000000..fa67530d --- /dev/null +++ b/hsm-server/tests/rsa_tests.cpp @@ -0,0 +1,125 @@ +#include +#include +#include "rsa.h" +using namespace std; + +TEST(RSATest, EncryptDecrypt_1024) +{ + const int KEY_SIZE = 1024; + + size_t pubLen = rsaGetPublicKeyLen(KEY_SIZE); + size_t priLen = rsaGetPrivateKeyLen(KEY_SIZE); + uint8_t *pubBuff = new uint8_t[pubLen]; + uint8_t *priBuff = new uint8_t[priLen]; + + CK_RV rv1 = rsaGenerateKeys(KEY_SIZE, pubBuff, pubLen, priBuff, priLen); + EXPECT_EQ(CKR_OK, rv1); + + const uint8_t plaintext[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + size_t plaintextLen = sizeof(plaintext); + + size_t ciphertextLen = rsaGetEncryptedLen(KEY_SIZE); + uint8_t *ciphertext = new uint8_t[ciphertextLen]; + CK_RV rv2 = rsaEncrypt(plaintext, plaintextLen, pubBuff, pubLen, ciphertext, + ciphertextLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv2); + + size_t decryptedLen = rsaGetDecryptedLen(KEY_SIZE); + uint8_t *decrypted = new uint8_t[decryptedLen]; + CK_RV rv3 = rsaDecrypt(ciphertext, ciphertextLen, priBuff, priLen, + decrypted, &decryptedLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv3); + EXPECT_EQ(plaintextLen, decryptedLen); + EXPECT_EQ(memcmp(plaintext, decrypted, plaintextLen), 0); + + delete[] pubBuff; + delete[] priBuff; + delete[] ciphertext; + delete[] decrypted; +} + +TEST(RSATest, EncryptDecrypt_2048) +{ + const int KEY_SIZE = 2048; + + size_t pubLen = rsaGetPublicKeyLen(KEY_SIZE); + size_t priLen = rsaGetPrivateKeyLen(KEY_SIZE); + uint8_t *pubBuff = new uint8_t[pubLen]; + uint8_t *priBuff = new uint8_t[priLen]; + + CK_RV rv1 = rsaGenerateKeys(KEY_SIZE, pubBuff, pubLen, priBuff, priLen); + EXPECT_EQ(CKR_OK, rv1); + + const uint8_t plaintext[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + size_t plaintextLen = sizeof(plaintext); + + size_t ciphertextLen = rsaGetEncryptedLen(KEY_SIZE); + uint8_t *ciphertext = new uint8_t[ciphertextLen]; + CK_RV rv2 = rsaEncrypt(plaintext, plaintextLen, pubBuff, pubLen, ciphertext, + ciphertextLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv2); + + size_t decryptedLen = rsaGetDecryptedLen(KEY_SIZE); + uint8_t *decrypted = new uint8_t[decryptedLen]; + CK_RV rv3 = rsaDecrypt(ciphertext, ciphertextLen, priBuff, priLen, + decrypted, &decryptedLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv3); + EXPECT_EQ(plaintextLen, decryptedLen); + EXPECT_EQ(memcmp(plaintext, decrypted, plaintextLen), 0); + + delete[] pubBuff; + delete[] priBuff; + delete[] ciphertext; + delete[] decrypted; +} + +TEST(RSATest, EncryptDecrypt_4096) +{ + const int KEY_SIZE = 4096; + + size_t pubLen = rsaGetPublicKeyLen(KEY_SIZE); + size_t priLen = rsaGetPrivateKeyLen(KEY_SIZE); + uint8_t *pubBuff = new uint8_t[pubLen]; + uint8_t *priBuff = new uint8_t[priLen]; + + CK_RV rv1 = rsaGenerateKeys(KEY_SIZE, pubBuff, pubLen, priBuff, priLen); + EXPECT_EQ(CKR_OK, rv1); + + const uint8_t plaintext[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + size_t plaintextLen = sizeof(plaintext); + + size_t ciphertextLen = rsaGetEncryptedLen(KEY_SIZE); + uint8_t *ciphertext = new uint8_t[ciphertextLen]; + CK_RV rv2 = rsaEncrypt(plaintext, plaintextLen, pubBuff, pubLen, ciphertext, + ciphertextLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv2); + + size_t decryptedLen = rsaGetDecryptedLen(KEY_SIZE); + uint8_t *decrypted = new uint8_t[decryptedLen]; + CK_RV rv3 = rsaDecrypt(ciphertext, ciphertextLen, priBuff, priLen, + decrypted, &decryptedLen, KEY_SIZE); + EXPECT_EQ(CKR_OK, rv3); + + EXPECT_EQ(plaintextLen, decryptedLen); + EXPECT_EQ(memcmp(plaintext, decrypted, plaintextLen), 0); + + delete[] pubBuff; + delete[] priBuff; + delete[] ciphertext; + delete[] decrypted; +} \ No newline at end of file diff --git a/hsm-server/tests/rsa_tests.cpp:Zone.Identifier b/hsm-server/tests/rsa_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/hsm-server/tests/sha256_tests.cpp b/hsm-server/tests/sha256_tests.cpp new file mode 100644 index 00000000..938932be --- /dev/null +++ b/hsm-server/tests/sha256_tests.cpp @@ -0,0 +1,63 @@ +// #include +// #include +// #include "sha256.h" + +// std::string bytesToHexString(const std::vector& bytes) { +// std::stringstream ss; +// ss << std::hex << std::setfill('0'); +// for (const auto& byte : bytes) { +// ss << std::setw(2) << static_cast(byte); +// } +// return ss.str(); +// } + +// // Test for hash of an empty string +// TEST(SHA256Test, EmptyStringHash) { +// std::vector data = {}; +// std::vector hash = sha256_compute(data); + +// // Expected hash value for an empty string +// std::string expectedHash = +// "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; +// ASSERT_EQ(bytesToHexString(hash), expectedHash); +// } + +// // Test for hash of the string "abc" +// TEST(SHA256Test, ABCStringHash) { +// std::vector data = {'a', 'b', 'c'}; +// std::vector hash = sha256_compute(data); + +// // Expected hash value for the string "abc" +// std::string expectedHash = +// "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; +// ASSERT_EQ(bytesToHexString(hash), expectedHash); +// } + +// // Test for hash of a string longer than 64 bytes +// TEST(SHA256Test, StringLongerThan64BytesHash) { +// std::string longString = "The quick brown fox jumps over the lazy dog"; +// std::vector data(longString.begin(), longString.end()); +// std::vector hash = sha256_compute(data); + +// // Expected hash value for the string "The quick brown fox jumps over the +// lazy dog" std::string expectedHash = +// "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"; +// ASSERT_EQ(bytesToHexString(hash), expectedHash); +// } + +// // Test for hash of a string containing special characters +// TEST(SHA256Test, SpecialCharsHash) { +// std::string specialString = "!@#$%^&*()"; +// std::vector data(specialString.begin(), specialString.end()); +// std::vector hash = sha256_compute(data); + +// // Expected hash value for the string containing special characters +// std::string expectedHash = +// "95ce789c5c9d18490972709838ca3a9719094bca3ac16332cfec0652b0236141"; +// ASSERT_EQ(bytesToHexString(hash), expectedHash); +// } + +// int main(int argc, char **argv) { +// ::testing::InitGoogleTest(&argc, argv); +// return RUN_ALL_TESTS(); +// } \ No newline at end of file diff --git a/hsm-server/tests/sha256_tests.cpp:Zone.Identifier b/hsm-server/tests/sha256_tests.cpp:Zone.Identifier new file mode 100644 index 00000000..e69de29b