diff --git a/third_party/securemessage/include/securemessage b/third_party/securemessage/include/securemessage new file mode 120000 index 00000000..c22c3f5d --- /dev/null +++ b/third_party/securemessage/include/securemessage @@ -0,0 +1 @@ +../securemessage/cpp/include/securemessage \ No newline at end of file diff --git a/third_party/securemessage/include/securemessage/byte_buffer.h b/third_party/securemessage/include/securemessage/byte_buffer.h deleted file mode 100644 index 9df49484..00000000 --- a/third_party/securemessage/include/securemessage/byte_buffer.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// A utility class for helping to interact with contiguous memory regions in a -// way that's both c++ friendly and works with OpenSSL's legacy C requirements. -// -// Will securely destroy enclosed data when deallocated -// - -#ifndef SECUREMESSAGE_BYTE_BUFFER_H_ -#define SECUREMESSAGE_BYTE_BUFFER_H_ - -#include -#include -#include -#include - -#include "securemessage/common.h" - -namespace securemessage { - -class ByteBuffer { - public: - // Create an empty byte buffer - ByteBuffer(); - - // Create a buffer of a certain size. Buffer will be filled with zeros. - explicit ByteBuffer(size_t size); - - // Create a buffer initialized with bytes from a string - explicit ByteBuffer(const string& source_data); - - // Create a buffer initialized with data from a const char* and a length - explicit ByteBuffer(const char* source_data, size_t length); - - // Create a buffer initialized with data from a const char* (assumes null - // termination) - explicit ByteBuffer(const char* source_data); - - // Create a buffer initialized with data from a uint8_t - explicit ByteBuffer(const uint8_t* source_data, size_t length); - - // Fill with the specified data. Any old data is discarded - void SetData(const uint8_t* source_data, size_t length); - - // Appends num_bytes of value byte to the end of the existing data - // Currently may violate secure memory guarantees by leaking some data on the - // heap - void Append(size_t num_bytes, const uint8_t byte); - - // Prepends a string to the beginning of this ByteBuffer - // Currently may violate secure memory guarantees by leaking some data on the - // heap - void Prepend(const string& str); - - // Concatenates two byte buffers. Placing a before b. If a is empty, then - // the result will be b. If b is empty, the result will be a. If both are - // empty, the result will be an empty byte buffer. - static ByteBuffer Concat(const ByteBuffer& a, const ByteBuffer& b); - - // Get size of internal buffer - size_t size() const; - - // Returns a unique pointer to new ByteBuffer of a given length starting from - // a given offset. - // Returns a unique pointer to an empty ByteBuffer if length is 0. - // Returns a nullptr if the specified parameters are invalid. - // Note that valid offset begins at 0 - std::unique_ptr SubArray(size_t offset, size_t length) const; - - // Get mutable memory as unsigned char* - unsigned char* MutableUChar(); - - // Get immutable memory as unsigned char* - unsigned const char* ImmutableUChar() const; - - // Get mutable memory as uint8_t* - uint8_t* MutableUInt8(); - - // Get immutable memory as uint8_t* - const uint8_t* ImmutableUInt8() const; - - // Get a copy of the memory in a C++ string - string String() const; - - // Get a copy of the memory in a C++ vector - std::vector Vector() const; - - // Returns true if the bytes in the other buffer are the same as in this - // buffer, false otherwise. Note: This function does NOT perform an early exit - // when it encounters a mismatching element in order to guard against timing - // attacks. - bool Equals(const ByteBuffer& other) const; - - // Returns true if the bytes in the other string are the same as in this - // buffer, false otherwise. Note: This function does NOT perform an early exit - // when it encounters a mismatching element in order to guard against timing - // attacks. - bool Equals(const string& other) const; - - // Returns a copy of the data as a printable hex string -- for easy debugging - string AsDebugHexString() const; - - // Securely resets the ByteBuffer by securely deleting any stored data. - void Clear(); - - // Securely destroys the ByteBuffer - ~ByteBuffer(); - - private: - // We rely on the fact that vectors are guaranteed to use contiguous memory - // for storing elements. - // TODO(aczeskis): define a custom version of vector that has a wiping - // deallocator. - std::vector data_; - - // Overwrites all elements in data vector one time. Does not resize data - // vector. - void Wipe(); - - // Helper function to wipe a specified buffer. - void WipeBuffer(uint8_t* buffer, size_t length); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_BYTE_BUFFER_H_ diff --git a/third_party/securemessage/include/securemessage/common.h b/third_party/securemessage/include/securemessage/common.h deleted file mode 100644 index 130925f0..00000000 --- a/third_party/securemessage/include/securemessage/common.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_COMMON_H_ -#define SECUREMESSAGE_COMMON_H_ - -#include - -#ifndef HAS_GLOBAL_STRING -using std::string; -#endif - -#endif // SECUREMESSAGE_COMMON_H_ diff --git a/third_party/securemessage/include/securemessage/crypto_ops.h b/third_party/securemessage/include/securemessage/crypto_ops.h deleted file mode 100644 index 1fb7cde3..00000000 --- a/third_party/securemessage/include/securemessage/crypto_ops.h +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_CRYPTO_OPS_H_ -#define SECUREMESSAGE_CRYPTO_OPS_H_ - -#include -#include -#include - -#include "securemessage/byte_buffer.h" -#include "securemessage/common.h" - -namespace securemessage { - -// -// Encapsulates the cryptographic operations used by the {@code SecureMessage*} -// classes. -// -class CryptoOps { - public: - // - // Enum of supported signature schemes. - // - enum SigType { - HMAC_SHA256, - ECDSA_P256_SHA256, - RSA2048_SHA256, - SIG_TYPE_END // used for testing - }; - - // - // Enum of supported encryption types - // - enum EncType { - NONE, - AES_256_CBC, - ENC_TYPE_END // used for testing - }; - - // - // Key Algorithms we support - // - enum KeyAlgorithm { - AES_256_KEY, - ECDSA_KEY, - RSA_KEY - }; - - // - // Key Types we believe to exist - // - enum KeyType { - PUBLIC, - PRIVATE, - SECRET - }; - - // - // Represents a base key class, SecretKey and PublicKey are derived from this - // class - // - class Key { - public: - // - // The default constructor is deleted so that class consumers cannot create - // a generic key class. They must use a particular key type class. - // - Key() = delete; - - ByteBuffer data() { return data_; } - const ByteBuffer& data() const { return data_; } - KeyAlgorithm algorithm() const { return algorithm_; } - KeyType type() const { return type_; } - - protected: - // - // Constructor cannot be called so that consumers can't simply create a - // generic key. Instead, they must use a particular key type class. - // - Key(const ByteBuffer& data, KeyAlgorithm algorithm, KeyType type) { - data_ = data; - algorithm_ = algorithm; - type_ = type; - } - - ByteBuffer data_; - KeyAlgorithm algorithm_; - KeyType type_; - }; - - // - // We have three key types: Public, Private, and Secret (symmetric) - // - class PublicKey : public Key { - public: - PublicKey(const string& data, KeyAlgorithm algorithm) - : Key(ByteBuffer(data), algorithm, PUBLIC) {} - PublicKey(const ByteBuffer& data, KeyAlgorithm algorithm) - : Key(data, algorithm, PUBLIC) {} - }; - - class PrivateKey : public Key { - public: - PrivateKey(const string& data, KeyAlgorithm algorithm) - : Key(ByteBuffer(data), algorithm, PRIVATE) {} - PrivateKey(const ByteBuffer& data, KeyAlgorithm algorithm) - : Key(data, algorithm, PRIVATE) {} - }; - - class SecretKey : public Key { - public: - SecretKey(const string& data, KeyAlgorithm algorithm) - : Key(ByteBuffer(data), algorithm, SECRET) {} - SecretKey(const ByteBuffer& data, KeyAlgorithm algorithm) - : Key(data, algorithm, SECRET) {} - }; - - struct KeyPair { - std::unique_ptr private_key; - std::unique_ptr public_key; - - KeyPair(std::unique_ptr pub, - std::unique_ptr priv) { - public_key = std::move(pub); - private_key = std::move(priv); - } - }; - - // - // Implements HKDF (RFC 5869) with the SHA-256 hash and a 256-bit output key - // length. - // - // @param inputKeyMaterial master key from which to derive sub-keys - // @param salt a (public) randomly generated 256-bit input that can be re-used - // @param info arbitrary information that is bound to the derived key (i.e., - // used in its creation) - // @return a std::unique_ptr holding the derived key bytes = - // HKDF-SHA256(inputKeyMaterial, salt, info) on success or nullptr on error - // - static std::unique_ptr Hkdf(const string& inputKeyMaterial, - const string& salt, - const string& info); - - // - // A key derivation function specific to this library, which accepts a {@code - // masterKey} and an arbitrary {@code purpose} describing the intended - // application of the derived sub-key, and produces a derived AES - 256 key - // safe to use as if it were independent of any other derived key which used - // a different {@code purpose}. - // - // @param masterKey any key suitable for use with HmacSHA256 - // @param purpose a UTF-8 encoded string describing the intended purpose of - // derived key - // @return a derived Key suitable for use with AES-256 - // - static std::unique_ptr DeriveAes256KeyFor( - const SecretKey& masterKey, const string& purpose); - - // - // SHA 256 length, in bytes - // - static const unsigned int kSha256DigestSize = 32; - - // - // Salt length, in bytes - // - static const unsigned int kSaltSize = 32; - - // AES 256 key length, in bytes - static const unsigned int kAesKeySize = 32; - - // - // Truncated hash output length, in bytes. - // - static const unsigned int kDigestLength = 20; - - // - // Computes a collision-resistant hash of {@link #kDigestLength} bytes - // (using a truncated SHA-256 output). - // - // @return a std::unique_ptr holding the digest or a nullptr on error - // - static std::unique_ptr Digest(const string& data); - - // - // Decrypts {@code ciphertext} using the algorithm specified in {@code - // encType}, with the specified {@code iv} and {@code decryptionKey}. - // - // @return a std::unique_ptr holding the decrypted data or a nullptr on error - // - static std::unique_ptr Decrypt(const SecretKey& decryptionKey, - EncType encType, - const string& iv, - const string& ciphertext); - - // - // Encrypts {@code plaintext} using the algorithm specified in {@code - // encType}, with the specified * {@code iv} and {@code encryptionKey}. - // - // @param rng source of randomness to be used with the specified cipher, if - // necessary - // @return a std::unique_ptr holding the encrypted data or nullptr on error - static std::unique_ptr Encrypt(const SecretKey& encryptionKey, - EncType encType, - const string& iv, - const string& plaintext); - - // - // Runs the Diffie-Hellman algorithm. - // - // @param private_key must have the same algorithm as the peer_key - // @param peer_key must be the matching public key - // @return an AES secret key created from the SHA-256 of the secret created - // here or nullptr on error. - // - static std::unique_ptr KeyAgreementSha256( - const PrivateKey& private_key, - const PublicKey& peer_key); - - // - // Generate a random IV appropriate for use with the algorithm specified in - // {@code encType}. - // - // @return a freshly generated IV (a random byte sequence of appropriate - // length) - // - static std::unique_ptr GenerateIv(EncType encType); - - // - // Signs {@code data} using the algorithm specified by {@code sigType} with - // {@code signingKey}. - // - // @param rng is required for public key signature schemes - // @return a std::unique_ptr holding a string that represents the raw - // signature or a nullptr on error - // - static std::unique_ptr Sign(SigType sigType, - const Key& signingKey, - const string& data); - - // - // Verifies the {@code signature} on {@code data} using the algorithm - // specified by {@code sigType} with {@code verificationKey}. - // - // @return true iff the signature is verified - // - static bool Verify(SigType sigType, - const Key& verificationKey, - const string& signature, - const string& data); - - // - // Imports a P256 EC Public Key using the x and y coordinates of the curve. - // - // @return nullptr if the point is invalid - // - static std::unique_ptr ImportEcP256Key(const string& x, - const string& y); - - // - // Exports the x and y coordinates of a P256 EC Public Key. - // - // @return false iff the key cannot be exported (for example, incorrect type) - // - static bool ExportEcP256Key(const PublicKey& key, string *x, string *y); - - // - // Imports a 2048 bit RSA Public Key using the modulus {@code n} and exponent - // {@code e}. - // - // @return nullptr if the parameters are invalid - // - static std::unique_ptr ImportRsa2048Key(const string& n, - int32_t e); - - // - // Exports the modulus and exponent of a 2048 bit RSA Public Key. - // - // @return false iff the key cannot be exported (for example, incorrect type) - // - static bool ExportRsa2048Key(const PublicKey& key, string* n, int32_t* e); - - // - // Returns true if a sigType is a public key scheme - // - static bool IsPublicKeyScheme(SigType sigType); - - // - // Indicates whether a "tag" is needed next to the plaintext body inside the - // ciphertext, to prevent the same ciphertext from being reused with someone - // else's signature on it. - // - static bool TaggedPlaintextRequired(const Key& signing_key, - SigType sig_type, - const Key& encryption_key); - - // Generates a 256 bit AES secret key - static std::unique_ptr GenerateAes256SecretKey(); - - // Generates a P256 EC key pair - static std::unique_ptr GenerateEcP256KeyPair(); - - // Generates a 2048 bit RSA key pair - static std::unique_ptr GenerateRsa2048KeyPair(); - - // - // @return SHA-256(UTF-8 encoded input) - // - // Will return a 32 byte ByteBuffer representing the SHA256 of the input bytes - // Will return a nullptr if an internal error occurs - // - static std::unique_ptr Sha256(const ByteBuffer& message); - - // - // @return SHA-512(UTF-8 encoded input) - // - // Will return a 64 byte ByteBuffer representing the SHA512 of the input bytes - // Will return a nullptr if an internal error occurs - // - static std::unique_ptr Sha512(const ByteBuffer& message); - - // Returns a ByteBuffer of |length|, which is filled with securely generated - // random values. - static std::unique_ptr SecureRandom(size_t length); - - private: - // - // @return SHA256HMAC of specified message using provided key or nullptr on - // error - static std::unique_ptr Sha256hmac(const ByteBuffer& key, - const ByteBuffer& message); - - // - // A salt value specific to this library, generated as - // SHA-256("SecureMessage") - // - // We have to initialize salt in crypto_ops.cc because C++ doesn't allow - // initialization and declaration in the same place. - // - static const uint8_t kSalt[kSaltSize]; - - // - // The HKDF (RFC 5869) extraction function, using the SHA-256 hash - // function. This function is used to pre-process the inputKeyMaterial and mix - // it with the salt, producing output suitable for use with HKDF expansion - // function (which produces the actual derived key). - // - // @see #hkdfSha256Expand(ByteBuffer, ByteBuffer) - // @return a std::unique_ptr with HMAC-SHA256(salt, - // inputKeyMaterial) (salt is the "key" for the HMAC) on success or a nullptr - // on error - // - static std::unique_ptr HkdfSha256Extract( - const ByteBuffer& inputKeyMaterial, const ByteBuffer& salt); - - // - // Special case of HKDF (RFC 5869) expansion function, using the SHA-256 - // hash function and allowing for a maximum output length of 256 bits. - // - // @param pseudoRandomKey should be generated by - // {@link #hkdfSha256Expand(ByteBuffer, ByteBuffer} - // @param info arbitrary information the derived key should be bound to - // @return a std::unique_ptr holding derived key bytes = - // HMAC-SHA256(pseudoRandomKey, info | 0x01) on success or a nullptr on - // error - // - static std::unique_ptr HkdfSha256Expand( - const ByteBuffer& pseudoRandomKey, const ByteBuffer& info); - - // - // Performs AES 256 CBC decryption of {@code ciphertext} with the specified - // {@code iv} and {@code decryptionKey}. Assumes PKCS#5 padding is used - // - // @return a std::unique_ptr holding the plaintext (decrypted) data or a - // nullptr on error - // - static std::unique_ptr Aes256CBCDecrypt( - const SecretKey& decryptionKey, - const ByteBuffer& iv, - const ByteBuffer& ciphertext); - - // - // Performs AES 256 CBC encryption of {@code plaintext} with the specified - // {@code iv} and {@code encryptionKey}. PKCS#5 is used. - // - // @return a std::unique_ptr holding the ciphertext (encrypted) data or a - // nullptr on error - // - static std::unique_ptr Aes256CBCEncrypt( - const SecretKey& encryptionKey, - const ByteBuffer& iv, - const ByteBuffer& ciphertext); - - // - // Get the purpose of an encryption scheme. Basically a string representation - // of the enum. - // - static string GetPurpose(EncType encType); - - // - // Get the purpose of a signature scheme. Basically a string representation - // of the enum. - // - static string GetPurpose(SigType sigType); - - // Computes the ECDSA P256 SHA 256 MAC - // - // @param data the data to be signed - // @param signingKey the ECDSA private key used for signing. - // @return std::unique_ptr holding string that represents the MAC or nullptr - // on error - // - static std::unique_ptr EcdsaP256Sha256Sign( - const PrivateKey& private_key, - const ByteBuffer& data); - - // Verifies the ECDSA P256 SHA 256 signature - // - // @param signature to be verified - // @param data the data over which the signature was computed - // @param verificationKey the ECDSA public key used for verification. - // @return bool true if signature is valid, false otherwise - // - static bool EcdsaP256Sha256Verify(const PublicKey& public_key, - const ByteBuffer& signature, - const ByteBuffer& data); - - // - // Runs the Elliptic Curve variant of the Diffie-Hellman algorithm. - // - // @param private_key must have the algorithm ECDSA_KEY - // @param peer_key must have the algorithm ECDSA_KEY - // @return an AES secret key created from the SHA-256 of the secret created - // by applying ECDH to the private_key and the peer_key. - // - static std::unique_ptr EcdhKeyAgreement( - const PrivateKey& private_key, - const PublicKey& peer_key); - - - // Computes the RSA 2048 SHA 256 signature - // - // @param data the data to be signed - // @param signingKey the RSA Private key used to sign the data. The key - // should be in DER form. - // @return std::unique_ptr holding string that represents the MAC or nullptr - // on error - // - // TODO(aczeskis): refactor sign and verify to be virtual functions of key - // objects - // - static std::unique_ptr Rsa2048Sha256Sign( - const PrivateKey& private_key, const ByteBuffer& data); - - // Verifies the RSA 2048 SHA 256 MAC - // - // @param signature to be verified - // @param data the data over which the signature was computed - // @param verificationKey the RSA public key used for verification - // @return bool true if signature is valid, false otherwise - // - static bool Rsa2048Sha256Verify(const PublicKey& public_key, - const ByteBuffer& signature, - const ByteBuffer& data); - - static bool IsValidEcP256CoordinateEncoding(const string& bytes); - - static bool IsValidRsa2048ModulusEncoding(const string& bytes); - - // - // Converts int32 value to an array of bytes represented as a string. The - // bytes are in big-endian order. - // - static string Int32BytesToString(int32_t value); - - // - // Converts a string of bytes to an int32 value. Fails if the bytes do not fit - // in the int32 type. The bytes are in big-endian order. - // - static bool StringToInt32Bytes(const string& value, int32_t* result); - - // For testing private helper functions - friend class CryptoOpsTest; - - virtual ~CryptoOps(); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_CRYPTO_OPS_H_ diff --git a/third_party/securemessage/include/securemessage/proto/securemessage.pb.h b/third_party/securemessage/include/securemessage/proto/securemessage.pb.h deleted file mode 100644 index de0cf362..00000000 --- a/third_party/securemessage/include/securemessage/proto/securemessage.pb.h +++ /dev/null @@ -1,3069 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/securemessage.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_proto_2fsecuremessage_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_proto_2fsecuremessage_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3019000 -#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 3019004 < 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 // IWYU pragma: export -#include // IWYU pragma: export -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_proto_2fsecuremessage_2eproto -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct TableStruct_proto_2fsecuremessage_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[8] - 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 uint32_t offsets[]; -}; -namespace securemessage { -class DhPublicKey; -struct DhPublicKeyDefaultTypeInternal; -extern DhPublicKeyDefaultTypeInternal _DhPublicKey_default_instance_; -class EcP256PublicKey; -struct EcP256PublicKeyDefaultTypeInternal; -extern EcP256PublicKeyDefaultTypeInternal _EcP256PublicKey_default_instance_; -class GenericPublicKey; -struct GenericPublicKeyDefaultTypeInternal; -extern GenericPublicKeyDefaultTypeInternal _GenericPublicKey_default_instance_; -class Header; -struct HeaderDefaultTypeInternal; -extern HeaderDefaultTypeInternal _Header_default_instance_; -class HeaderAndBody; -struct HeaderAndBodyDefaultTypeInternal; -extern HeaderAndBodyDefaultTypeInternal _HeaderAndBody_default_instance_; -class HeaderAndBodyInternal; -struct HeaderAndBodyInternalDefaultTypeInternal; -extern HeaderAndBodyInternalDefaultTypeInternal _HeaderAndBodyInternal_default_instance_; -class SecureMessage; -struct SecureMessageDefaultTypeInternal; -extern SecureMessageDefaultTypeInternal _SecureMessage_default_instance_; -class SimpleRsaPublicKey; -struct SimpleRsaPublicKeyDefaultTypeInternal; -extern SimpleRsaPublicKeyDefaultTypeInternal _SimpleRsaPublicKey_default_instance_; -} // namespace securemessage -PROTOBUF_NAMESPACE_OPEN -template<> ::securemessage::DhPublicKey* Arena::CreateMaybeMessage<::securemessage::DhPublicKey>(Arena*); -template<> ::securemessage::EcP256PublicKey* Arena::CreateMaybeMessage<::securemessage::EcP256PublicKey>(Arena*); -template<> ::securemessage::GenericPublicKey* Arena::CreateMaybeMessage<::securemessage::GenericPublicKey>(Arena*); -template<> ::securemessage::Header* Arena::CreateMaybeMessage<::securemessage::Header>(Arena*); -template<> ::securemessage::HeaderAndBody* Arena::CreateMaybeMessage<::securemessage::HeaderAndBody>(Arena*); -template<> ::securemessage::HeaderAndBodyInternal* Arena::CreateMaybeMessage<::securemessage::HeaderAndBodyInternal>(Arena*); -template<> ::securemessage::SecureMessage* Arena::CreateMaybeMessage<::securemessage::SecureMessage>(Arena*); -template<> ::securemessage::SimpleRsaPublicKey* Arena::CreateMaybeMessage<::securemessage::SimpleRsaPublicKey>(Arena*); -PROTOBUF_NAMESPACE_CLOSE -namespace securemessage { - -enum SigScheme : int { - HMAC_SHA256 = 1, - ECDSA_P256_SHA256 = 2, - RSA2048_SHA256 = 3 -}; -bool SigScheme_IsValid(int value); -constexpr SigScheme SigScheme_MIN = HMAC_SHA256; -constexpr SigScheme SigScheme_MAX = RSA2048_SHA256; -constexpr int SigScheme_ARRAYSIZE = SigScheme_MAX + 1; - -const std::string& SigScheme_Name(SigScheme value); -template -inline const std::string& SigScheme_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function SigScheme_Name."); - return SigScheme_Name(static_cast(enum_t_value)); -} -bool SigScheme_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SigScheme* value); -enum EncScheme : int { - NONE = 1, - AES_256_CBC = 2 -}; -bool EncScheme_IsValid(int value); -constexpr EncScheme EncScheme_MIN = NONE; -constexpr EncScheme EncScheme_MAX = AES_256_CBC; -constexpr int EncScheme_ARRAYSIZE = EncScheme_MAX + 1; - -const std::string& EncScheme_Name(EncScheme value); -template -inline const std::string& EncScheme_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function EncScheme_Name."); - return EncScheme_Name(static_cast(enum_t_value)); -} -bool EncScheme_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, EncScheme* value); -enum PublicKeyType : int { - EC_P256 = 1, - RSA2048 = 2, - DH2048_MODP = 3 -}; -bool PublicKeyType_IsValid(int value); -constexpr PublicKeyType PublicKeyType_MIN = EC_P256; -constexpr PublicKeyType PublicKeyType_MAX = DH2048_MODP; -constexpr int PublicKeyType_ARRAYSIZE = PublicKeyType_MAX + 1; - -const std::string& PublicKeyType_Name(PublicKeyType value); -template -inline const std::string& PublicKeyType_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function PublicKeyType_Name."); - return PublicKeyType_Name(static_cast(enum_t_value)); -} -bool PublicKeyType_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, PublicKeyType* value); -// =================================================================== - -class SecureMessage final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.SecureMessage) */ { - public: - inline SecureMessage() : SecureMessage(nullptr) {} - ~SecureMessage() override; - explicit constexpr SecureMessage(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SecureMessage(const SecureMessage& from); - SecureMessage(SecureMessage&& from) noexcept - : SecureMessage() { - *this = ::std::move(from); - } - - inline SecureMessage& operator=(const SecureMessage& from) { - CopyFrom(from); - return *this; - } - inline SecureMessage& operator=(SecureMessage&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const SecureMessage& default_instance() { - return *internal_default_instance(); - } - static inline const SecureMessage* internal_default_instance() { - return reinterpret_cast( - &_SecureMessage_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - friend void swap(SecureMessage& a, SecureMessage& b) { - a.Swap(&b); - } - inline void Swap(SecureMessage* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SecureMessage* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SecureMessage* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const SecureMessage& from); - void MergeFrom(const SecureMessage& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(SecureMessage* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.SecureMessage"; - } - protected: - explicit SecureMessage(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kHeaderAndBodyFieldNumber = 1, - kSignatureFieldNumber = 2, - }; - // required bytes header_and_body = 1; - bool has_header_and_body() const; - private: - bool _internal_has_header_and_body() const; - public: - void clear_header_and_body(); - const std::string& header_and_body() const; - template - void set_header_and_body(ArgT0&& arg0, ArgT... args); - std::string* mutable_header_and_body(); - PROTOBUF_NODISCARD std::string* release_header_and_body(); - void set_allocated_header_and_body(std::string* header_and_body); - private: - const std::string& _internal_header_and_body() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_header_and_body(const std::string& value); - std::string* _internal_mutable_header_and_body(); - public: - - // required bytes signature = 2; - bool has_signature() const; - private: - bool _internal_has_signature() const; - public: - void clear_signature(); - const std::string& signature() const; - template - void set_signature(ArgT0&& arg0, ArgT... args); - std::string* mutable_signature(); - PROTOBUF_NODISCARD 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:securemessage.SecureMessage) - private: - class _Internal; - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr header_and_body_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr signature_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class Header final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.Header) */ { - public: - inline Header() : Header(nullptr) {} - ~Header() override; - explicit constexpr Header(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Header(const Header& from); - Header(Header&& from) noexcept - : Header() { - *this = ::std::move(from); - } - - inline Header& operator=(const Header& from) { - CopyFrom(from); - return *this; - } - inline Header& operator=(Header&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const Header& default_instance() { - return *internal_default_instance(); - } - static inline const Header* internal_default_instance() { - return reinterpret_cast( - &_Header_default_instance_); - } - static constexpr int kIndexInFileMessages = - 1; - - friend void swap(Header& a, Header& b) { - a.Swap(&b); - } - inline void Swap(Header* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Header* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Header* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage
(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const Header& from); - void MergeFrom(const Header& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(Header* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.Header"; - } - protected: - explicit Header(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kVerificationKeyIdFieldNumber = 3, - kDecryptionKeyIdFieldNumber = 4, - kIvFieldNumber = 5, - kPublicMetadataFieldNumber = 6, - kAssociatedDataLengthFieldNumber = 7, - kSignatureSchemeFieldNumber = 1, - kEncryptionSchemeFieldNumber = 2, - }; - // optional bytes verification_key_id = 3; - bool has_verification_key_id() const; - private: - bool _internal_has_verification_key_id() const; - public: - void clear_verification_key_id(); - const std::string& verification_key_id() const; - template - void set_verification_key_id(ArgT0&& arg0, ArgT... args); - std::string* mutable_verification_key_id(); - PROTOBUF_NODISCARD std::string* release_verification_key_id(); - void set_allocated_verification_key_id(std::string* verification_key_id); - private: - const std::string& _internal_verification_key_id() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_verification_key_id(const std::string& value); - std::string* _internal_mutable_verification_key_id(); - public: - - // optional bytes decryption_key_id = 4; - bool has_decryption_key_id() const; - private: - bool _internal_has_decryption_key_id() const; - public: - void clear_decryption_key_id(); - const std::string& decryption_key_id() const; - template - void set_decryption_key_id(ArgT0&& arg0, ArgT... args); - std::string* mutable_decryption_key_id(); - PROTOBUF_NODISCARD std::string* release_decryption_key_id(); - void set_allocated_decryption_key_id(std::string* decryption_key_id); - private: - const std::string& _internal_decryption_key_id() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_decryption_key_id(const std::string& value); - std::string* _internal_mutable_decryption_key_id(); - public: - - // optional bytes iv = 5; - bool has_iv() const; - private: - bool _internal_has_iv() const; - public: - void clear_iv(); - const std::string& iv() const; - template - void set_iv(ArgT0&& arg0, ArgT... args); - std::string* mutable_iv(); - PROTOBUF_NODISCARD std::string* release_iv(); - void set_allocated_iv(std::string* iv); - private: - const std::string& _internal_iv() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_iv(const std::string& value); - std::string* _internal_mutable_iv(); - public: - - // optional bytes public_metadata = 6; - bool has_public_metadata() const; - private: - bool _internal_has_public_metadata() const; - public: - void clear_public_metadata(); - const std::string& public_metadata() const; - template - void set_public_metadata(ArgT0&& arg0, ArgT... args); - std::string* mutable_public_metadata(); - PROTOBUF_NODISCARD std::string* release_public_metadata(); - void set_allocated_public_metadata(std::string* public_metadata); - private: - const std::string& _internal_public_metadata() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_public_metadata(const std::string& value); - std::string* _internal_mutable_public_metadata(); - public: - - // optional uint32 associated_data_length = 7 [default = 0]; - bool has_associated_data_length() const; - private: - bool _internal_has_associated_data_length() const; - public: - void clear_associated_data_length(); - uint32_t associated_data_length() const; - void set_associated_data_length(uint32_t value); - private: - uint32_t _internal_associated_data_length() const; - void _internal_set_associated_data_length(uint32_t value); - public: - - // required .securemessage.SigScheme signature_scheme = 1; - bool has_signature_scheme() const; - private: - bool _internal_has_signature_scheme() const; - public: - void clear_signature_scheme(); - ::securemessage::SigScheme signature_scheme() const; - void set_signature_scheme(::securemessage::SigScheme value); - private: - ::securemessage::SigScheme _internal_signature_scheme() const; - void _internal_set_signature_scheme(::securemessage::SigScheme value); - public: - - // required .securemessage.EncScheme encryption_scheme = 2; - bool has_encryption_scheme() const; - private: - bool _internal_has_encryption_scheme() const; - public: - void clear_encryption_scheme(); - ::securemessage::EncScheme encryption_scheme() const; - void set_encryption_scheme(::securemessage::EncScheme value); - private: - ::securemessage::EncScheme _internal_encryption_scheme() const; - void _internal_set_encryption_scheme(::securemessage::EncScheme value); - public: - - // @@protoc_insertion_point(class_scope:securemessage.Header) - private: - class _Internal; - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr verification_key_id_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr decryption_key_id_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr iv_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr public_metadata_; - uint32_t associated_data_length_; - int signature_scheme_; - int encryption_scheme_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class HeaderAndBody final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.HeaderAndBody) */ { - public: - inline HeaderAndBody() : HeaderAndBody(nullptr) {} - ~HeaderAndBody() override; - explicit constexpr HeaderAndBody(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - HeaderAndBody(const HeaderAndBody& from); - HeaderAndBody(HeaderAndBody&& from) noexcept - : HeaderAndBody() { - *this = ::std::move(from); - } - - inline HeaderAndBody& operator=(const HeaderAndBody& from) { - CopyFrom(from); - return *this; - } - inline HeaderAndBody& operator=(HeaderAndBody&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const HeaderAndBody& default_instance() { - return *internal_default_instance(); - } - static inline const HeaderAndBody* internal_default_instance() { - return reinterpret_cast( - &_HeaderAndBody_default_instance_); - } - static constexpr int kIndexInFileMessages = - 2; - - friend void swap(HeaderAndBody& a, HeaderAndBody& b) { - a.Swap(&b); - } - inline void Swap(HeaderAndBody* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(HeaderAndBody* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - HeaderAndBody* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const HeaderAndBody& from); - void MergeFrom(const HeaderAndBody& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(HeaderAndBody* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.HeaderAndBody"; - } - protected: - explicit HeaderAndBody(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kBodyFieldNumber = 2, - kHeaderFieldNumber = 1, - }; - // required bytes body = 2; - bool has_body() const; - private: - bool _internal_has_body() const; - public: - void clear_body(); - const std::string& body() const; - template - void set_body(ArgT0&& arg0, ArgT... args); - std::string* mutable_body(); - PROTOBUF_NODISCARD std::string* release_body(); - void set_allocated_body(std::string* body); - private: - const std::string& _internal_body() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_body(const std::string& value); - std::string* _internal_mutable_body(); - public: - - // required .securemessage.Header header = 1; - bool has_header() const; - private: - bool _internal_has_header() const; - public: - void clear_header(); - const ::securemessage::Header& header() const; - PROTOBUF_NODISCARD ::securemessage::Header* release_header(); - ::securemessage::Header* mutable_header(); - void set_allocated_header(::securemessage::Header* header); - private: - const ::securemessage::Header& _internal_header() const; - ::securemessage::Header* _internal_mutable_header(); - public: - void unsafe_arena_set_allocated_header( - ::securemessage::Header* header); - ::securemessage::Header* unsafe_arena_release_header(); - - // @@protoc_insertion_point(class_scope:securemessage.HeaderAndBody) - private: - class _Internal; - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr body_; - ::securemessage::Header* header_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class HeaderAndBodyInternal final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.HeaderAndBodyInternal) */ { - public: - inline HeaderAndBodyInternal() : HeaderAndBodyInternal(nullptr) {} - ~HeaderAndBodyInternal() override; - explicit constexpr HeaderAndBodyInternal(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - HeaderAndBodyInternal(const HeaderAndBodyInternal& from); - HeaderAndBodyInternal(HeaderAndBodyInternal&& from) noexcept - : HeaderAndBodyInternal() { - *this = ::std::move(from); - } - - inline HeaderAndBodyInternal& operator=(const HeaderAndBodyInternal& from) { - CopyFrom(from); - return *this; - } - inline HeaderAndBodyInternal& operator=(HeaderAndBodyInternal&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const HeaderAndBodyInternal& default_instance() { - return *internal_default_instance(); - } - static inline const HeaderAndBodyInternal* internal_default_instance() { - return reinterpret_cast( - &_HeaderAndBodyInternal_default_instance_); - } - static constexpr int kIndexInFileMessages = - 3; - - friend void swap(HeaderAndBodyInternal& a, HeaderAndBodyInternal& b) { - a.Swap(&b); - } - inline void Swap(HeaderAndBodyInternal* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(HeaderAndBodyInternal* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - HeaderAndBodyInternal* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const HeaderAndBodyInternal& from); - void MergeFrom(const HeaderAndBodyInternal& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(HeaderAndBodyInternal* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.HeaderAndBodyInternal"; - } - protected: - explicit HeaderAndBodyInternal(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kHeaderFieldNumber = 1, - kBodyFieldNumber = 2, - }; - // required bytes header = 1; - bool has_header() const; - private: - bool _internal_has_header() const; - public: - void clear_header(); - const std::string& header() const; - template - void set_header(ArgT0&& arg0, ArgT... args); - std::string* mutable_header(); - PROTOBUF_NODISCARD std::string* release_header(); - void set_allocated_header(std::string* header); - private: - const std::string& _internal_header() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_header(const std::string& value); - std::string* _internal_mutable_header(); - public: - - // required bytes body = 2; - bool has_body() const; - private: - bool _internal_has_body() const; - public: - void clear_body(); - const std::string& body() const; - template - void set_body(ArgT0&& arg0, ArgT... args); - std::string* mutable_body(); - PROTOBUF_NODISCARD std::string* release_body(); - void set_allocated_body(std::string* body); - private: - const std::string& _internal_body() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_body(const std::string& value); - std::string* _internal_mutable_body(); - public: - - // @@protoc_insertion_point(class_scope:securemessage.HeaderAndBodyInternal) - private: - class _Internal; - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr header_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr body_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class EcP256PublicKey final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.EcP256PublicKey) */ { - public: - inline EcP256PublicKey() : EcP256PublicKey(nullptr) {} - ~EcP256PublicKey() override; - explicit constexpr EcP256PublicKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - EcP256PublicKey(const EcP256PublicKey& from); - EcP256PublicKey(EcP256PublicKey&& from) noexcept - : EcP256PublicKey() { - *this = ::std::move(from); - } - - inline EcP256PublicKey& operator=(const EcP256PublicKey& from) { - CopyFrom(from); - return *this; - } - inline EcP256PublicKey& operator=(EcP256PublicKey&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const EcP256PublicKey& default_instance() { - return *internal_default_instance(); - } - static inline const EcP256PublicKey* internal_default_instance() { - return reinterpret_cast( - &_EcP256PublicKey_default_instance_); - } - static constexpr int kIndexInFileMessages = - 4; - - friend void swap(EcP256PublicKey& a, EcP256PublicKey& b) { - a.Swap(&b); - } - inline void Swap(EcP256PublicKey* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(EcP256PublicKey* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - EcP256PublicKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const EcP256PublicKey& from); - void MergeFrom(const EcP256PublicKey& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(EcP256PublicKey* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.EcP256PublicKey"; - } - protected: - explicit EcP256PublicKey(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kXFieldNumber = 1, - kYFieldNumber = 2, - }; - // required bytes x = 1; - bool has_x() const; - private: - bool _internal_has_x() const; - public: - void clear_x(); - const std::string& x() const; - template - void set_x(ArgT0&& arg0, ArgT... args); - std::string* mutable_x(); - PROTOBUF_NODISCARD std::string* release_x(); - void set_allocated_x(std::string* x); - private: - const std::string& _internal_x() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_x(const std::string& value); - std::string* _internal_mutable_x(); - public: - - // required bytes y = 2; - bool has_y() const; - private: - bool _internal_has_y() const; - public: - void clear_y(); - const std::string& y() const; - template - void set_y(ArgT0&& arg0, ArgT... args); - std::string* mutable_y(); - PROTOBUF_NODISCARD std::string* release_y(); - void set_allocated_y(std::string* y); - private: - const std::string& _internal_y() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_y(const std::string& value); - std::string* _internal_mutable_y(); - public: - - // @@protoc_insertion_point(class_scope:securemessage.EcP256PublicKey) - private: - class _Internal; - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr x_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr y_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class SimpleRsaPublicKey final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.SimpleRsaPublicKey) */ { - public: - inline SimpleRsaPublicKey() : SimpleRsaPublicKey(nullptr) {} - ~SimpleRsaPublicKey() override; - explicit constexpr SimpleRsaPublicKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SimpleRsaPublicKey(const SimpleRsaPublicKey& from); - SimpleRsaPublicKey(SimpleRsaPublicKey&& from) noexcept - : SimpleRsaPublicKey() { - *this = ::std::move(from); - } - - inline SimpleRsaPublicKey& operator=(const SimpleRsaPublicKey& from) { - CopyFrom(from); - return *this; - } - inline SimpleRsaPublicKey& operator=(SimpleRsaPublicKey&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const SimpleRsaPublicKey& default_instance() { - return *internal_default_instance(); - } - static inline const SimpleRsaPublicKey* internal_default_instance() { - return reinterpret_cast( - &_SimpleRsaPublicKey_default_instance_); - } - static constexpr int kIndexInFileMessages = - 5; - - friend void swap(SimpleRsaPublicKey& a, SimpleRsaPublicKey& b) { - a.Swap(&b); - } - inline void Swap(SimpleRsaPublicKey* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SimpleRsaPublicKey* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SimpleRsaPublicKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const SimpleRsaPublicKey& from); - void MergeFrom(const SimpleRsaPublicKey& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(SimpleRsaPublicKey* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.SimpleRsaPublicKey"; - } - protected: - explicit SimpleRsaPublicKey(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kNFieldNumber = 1, - kEFieldNumber = 2, - }; - // required bytes n = 1; - bool has_n() const; - private: - bool _internal_has_n() const; - public: - void clear_n(); - const std::string& n() const; - template - void set_n(ArgT0&& arg0, ArgT... args); - std::string* mutable_n(); - PROTOBUF_NODISCARD std::string* release_n(); - void set_allocated_n(std::string* n); - private: - const std::string& _internal_n() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_n(const std::string& value); - std::string* _internal_mutable_n(); - public: - - // optional int32 e = 2 [default = 65537]; - bool has_e() const; - private: - bool _internal_has_e() const; - public: - void clear_e(); - int32_t e() const; - void set_e(int32_t value); - private: - int32_t _internal_e() const; - void _internal_set_e(int32_t value); - public: - - // @@protoc_insertion_point(class_scope:securemessage.SimpleRsaPublicKey) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr n_; - int32_t e_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class DhPublicKey final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.DhPublicKey) */ { - public: - inline DhPublicKey() : DhPublicKey(nullptr) {} - ~DhPublicKey() override; - explicit constexpr DhPublicKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - DhPublicKey(const DhPublicKey& from); - DhPublicKey(DhPublicKey&& from) noexcept - : DhPublicKey() { - *this = ::std::move(from); - } - - inline DhPublicKey& operator=(const DhPublicKey& from) { - CopyFrom(from); - return *this; - } - inline DhPublicKey& operator=(DhPublicKey&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const DhPublicKey& default_instance() { - return *internal_default_instance(); - } - static inline const DhPublicKey* internal_default_instance() { - return reinterpret_cast( - &_DhPublicKey_default_instance_); - } - static constexpr int kIndexInFileMessages = - 6; - - friend void swap(DhPublicKey& a, DhPublicKey& b) { - a.Swap(&b); - } - inline void Swap(DhPublicKey* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(DhPublicKey* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - DhPublicKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const DhPublicKey& from); - void MergeFrom(const DhPublicKey& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(DhPublicKey* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.DhPublicKey"; - } - protected: - explicit DhPublicKey(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kYFieldNumber = 1, - }; - // required bytes y = 1; - bool has_y() const; - private: - bool _internal_has_y() const; - public: - void clear_y(); - const std::string& y() const; - template - void set_y(ArgT0&& arg0, ArgT... args); - std::string* mutable_y(); - PROTOBUF_NODISCARD std::string* release_y(); - void set_allocated_y(std::string* y); - private: - const std::string& _internal_y() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_y(const std::string& value); - std::string* _internal_mutable_y(); - public: - - // @@protoc_insertion_point(class_scope:securemessage.DhPublicKey) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr y_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// ------------------------------------------------------------------- - -class GenericPublicKey final : - public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:securemessage.GenericPublicKey) */ { - public: - inline GenericPublicKey() : GenericPublicKey(nullptr) {} - ~GenericPublicKey() override; - explicit constexpr GenericPublicKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - GenericPublicKey(const GenericPublicKey& from); - GenericPublicKey(GenericPublicKey&& from) noexcept - : GenericPublicKey() { - *this = ::std::move(from); - } - - inline GenericPublicKey& operator=(const GenericPublicKey& from) { - CopyFrom(from); - return *this; - } - inline GenericPublicKey& operator=(GenericPublicKey&& 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; - } - - inline const std::string& unknown_fields() const { - return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); - } - inline std::string* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const GenericPublicKey& default_instance() { - return *internal_default_instance(); - } - static inline const GenericPublicKey* internal_default_instance() { - return reinterpret_cast( - &_GenericPublicKey_default_instance_); - } - static constexpr int kIndexInFileMessages = - 7; - - friend void swap(GenericPublicKey& a, GenericPublicKey& b) { - a.Swap(&b); - } - inline void Swap(GenericPublicKey* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(GenericPublicKey* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - GenericPublicKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; - void CopyFrom(const GenericPublicKey& from); - void MergeFrom(const GenericPublicKey& from); - 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; - uint8_t* _InternalSerialize( - uint8_t* 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; - void InternalSwap(GenericPublicKey* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "securemessage.GenericPublicKey"; - } - protected: - explicit GenericPublicKey(::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: - - std::string GetTypeName() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kEcP256PublicKeyFieldNumber = 2, - kRsa2048PublicKeyFieldNumber = 3, - kDh2048PublicKeyFieldNumber = 4, - kTypeFieldNumber = 1, - }; - // optional .securemessage.EcP256PublicKey ec_p256_public_key = 2; - bool has_ec_p256_public_key() const; - private: - bool _internal_has_ec_p256_public_key() const; - public: - void clear_ec_p256_public_key(); - const ::securemessage::EcP256PublicKey& ec_p256_public_key() const; - PROTOBUF_NODISCARD ::securemessage::EcP256PublicKey* release_ec_p256_public_key(); - ::securemessage::EcP256PublicKey* mutable_ec_p256_public_key(); - void set_allocated_ec_p256_public_key(::securemessage::EcP256PublicKey* ec_p256_public_key); - private: - const ::securemessage::EcP256PublicKey& _internal_ec_p256_public_key() const; - ::securemessage::EcP256PublicKey* _internal_mutable_ec_p256_public_key(); - public: - void unsafe_arena_set_allocated_ec_p256_public_key( - ::securemessage::EcP256PublicKey* ec_p256_public_key); - ::securemessage::EcP256PublicKey* unsafe_arena_release_ec_p256_public_key(); - - // optional .securemessage.SimpleRsaPublicKey rsa2048_public_key = 3; - bool has_rsa2048_public_key() const; - private: - bool _internal_has_rsa2048_public_key() const; - public: - void clear_rsa2048_public_key(); - const ::securemessage::SimpleRsaPublicKey& rsa2048_public_key() const; - PROTOBUF_NODISCARD ::securemessage::SimpleRsaPublicKey* release_rsa2048_public_key(); - ::securemessage::SimpleRsaPublicKey* mutable_rsa2048_public_key(); - void set_allocated_rsa2048_public_key(::securemessage::SimpleRsaPublicKey* rsa2048_public_key); - private: - const ::securemessage::SimpleRsaPublicKey& _internal_rsa2048_public_key() const; - ::securemessage::SimpleRsaPublicKey* _internal_mutable_rsa2048_public_key(); - public: - void unsafe_arena_set_allocated_rsa2048_public_key( - ::securemessage::SimpleRsaPublicKey* rsa2048_public_key); - ::securemessage::SimpleRsaPublicKey* unsafe_arena_release_rsa2048_public_key(); - - // optional .securemessage.DhPublicKey dh2048_public_key = 4; - bool has_dh2048_public_key() const; - private: - bool _internal_has_dh2048_public_key() const; - public: - void clear_dh2048_public_key(); - const ::securemessage::DhPublicKey& dh2048_public_key() const; - PROTOBUF_NODISCARD ::securemessage::DhPublicKey* release_dh2048_public_key(); - ::securemessage::DhPublicKey* mutable_dh2048_public_key(); - void set_allocated_dh2048_public_key(::securemessage::DhPublicKey* dh2048_public_key); - private: - const ::securemessage::DhPublicKey& _internal_dh2048_public_key() const; - ::securemessage::DhPublicKey* _internal_mutable_dh2048_public_key(); - public: - void unsafe_arena_set_allocated_dh2048_public_key( - ::securemessage::DhPublicKey* dh2048_public_key); - ::securemessage::DhPublicKey* unsafe_arena_release_dh2048_public_key(); - - // required .securemessage.PublicKeyType type = 1; - bool has_type() const; - private: - bool _internal_has_type() const; - public: - void clear_type(); - ::securemessage::PublicKeyType type() const; - void set_type(::securemessage::PublicKeyType value); - private: - ::securemessage::PublicKeyType _internal_type() const; - void _internal_set_type(::securemessage::PublicKeyType value); - public: - - // @@protoc_insertion_point(class_scope:securemessage.GenericPublicKey) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::securemessage::EcP256PublicKey* ec_p256_public_key_; - ::securemessage::SimpleRsaPublicKey* rsa2048_public_key_; - ::securemessage::DhPublicKey* dh2048_public_key_; - int type_; - friend struct ::TableStruct_proto_2fsecuremessage_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// SecureMessage - -// required bytes header_and_body = 1; -inline bool SecureMessage::_internal_has_header_and_body() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool SecureMessage::has_header_and_body() const { - return _internal_has_header_and_body(); -} -inline void SecureMessage::clear_header_and_body() { - header_and_body_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& SecureMessage::header_and_body() const { - // @@protoc_insertion_point(field_get:securemessage.SecureMessage.header_and_body) - return _internal_header_and_body(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void SecureMessage::set_header_and_body(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - header_and_body_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.SecureMessage.header_and_body) -} -inline std::string* SecureMessage::mutable_header_and_body() { - std::string* _s = _internal_mutable_header_and_body(); - // @@protoc_insertion_point(field_mutable:securemessage.SecureMessage.header_and_body) - return _s; -} -inline const std::string& SecureMessage::_internal_header_and_body() const { - return header_and_body_.Get(); -} -inline void SecureMessage::_internal_set_header_and_body(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - header_and_body_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* SecureMessage::_internal_mutable_header_and_body() { - _has_bits_[0] |= 0x00000001u; - return header_and_body_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* SecureMessage::release_header_and_body() { - // @@protoc_insertion_point(field_release:securemessage.SecureMessage.header_and_body) - if (!_internal_has_header_and_body()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = header_and_body_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (header_and_body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - header_and_body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void SecureMessage::set_allocated_header_and_body(std::string* header_and_body) { - if (header_and_body != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - header_and_body_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), header_and_body, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (header_and_body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - header_and_body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.SecureMessage.header_and_body) -} - -// required bytes signature = 2; -inline bool SecureMessage::_internal_has_signature() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SecureMessage::has_signature() const { - return _internal_has_signature(); -} -inline void SecureMessage::clear_signature() { - signature_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000002u; -} -inline const std::string& SecureMessage::signature() const { - // @@protoc_insertion_point(field_get:securemessage.SecureMessage.signature) - return _internal_signature(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void SecureMessage::set_signature(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000002u; - signature_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.SecureMessage.signature) -} -inline std::string* SecureMessage::mutable_signature() { - std::string* _s = _internal_mutable_signature(); - // @@protoc_insertion_point(field_mutable:securemessage.SecureMessage.signature) - return _s; -} -inline const std::string& SecureMessage::_internal_signature() const { - return signature_.Get(); -} -inline void SecureMessage::_internal_set_signature(const std::string& value) { - _has_bits_[0] |= 0x00000002u; - signature_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* SecureMessage::_internal_mutable_signature() { - _has_bits_[0] |= 0x00000002u; - return signature_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* SecureMessage::release_signature() { - // @@protoc_insertion_point(field_release:securemessage.SecureMessage.signature) - if (!_internal_has_signature()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000002u; - auto* p = signature_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (signature_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - signature_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void SecureMessage::set_allocated_signature(std::string* signature) { - if (signature != nullptr) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - signature_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), signature, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (signature_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - signature_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.SecureMessage.signature) -} - -// ------------------------------------------------------------------- - -// Header - -// required .securemessage.SigScheme signature_scheme = 1; -inline bool Header::_internal_has_signature_scheme() const { - bool value = (_has_bits_[0] & 0x00000020u) != 0; - return value; -} -inline bool Header::has_signature_scheme() const { - return _internal_has_signature_scheme(); -} -inline void Header::clear_signature_scheme() { - signature_scheme_ = 1; - _has_bits_[0] &= ~0x00000020u; -} -inline ::securemessage::SigScheme Header::_internal_signature_scheme() const { - return static_cast< ::securemessage::SigScheme >(signature_scheme_); -} -inline ::securemessage::SigScheme Header::signature_scheme() const { - // @@protoc_insertion_point(field_get:securemessage.Header.signature_scheme) - return _internal_signature_scheme(); -} -inline void Header::_internal_set_signature_scheme(::securemessage::SigScheme value) { - assert(::securemessage::SigScheme_IsValid(value)); - _has_bits_[0] |= 0x00000020u; - signature_scheme_ = value; -} -inline void Header::set_signature_scheme(::securemessage::SigScheme value) { - _internal_set_signature_scheme(value); - // @@protoc_insertion_point(field_set:securemessage.Header.signature_scheme) -} - -// required .securemessage.EncScheme encryption_scheme = 2; -inline bool Header::_internal_has_encryption_scheme() const { - bool value = (_has_bits_[0] & 0x00000040u) != 0; - return value; -} -inline bool Header::has_encryption_scheme() const { - return _internal_has_encryption_scheme(); -} -inline void Header::clear_encryption_scheme() { - encryption_scheme_ = 1; - _has_bits_[0] &= ~0x00000040u; -} -inline ::securemessage::EncScheme Header::_internal_encryption_scheme() const { - return static_cast< ::securemessage::EncScheme >(encryption_scheme_); -} -inline ::securemessage::EncScheme Header::encryption_scheme() const { - // @@protoc_insertion_point(field_get:securemessage.Header.encryption_scheme) - return _internal_encryption_scheme(); -} -inline void Header::_internal_set_encryption_scheme(::securemessage::EncScheme value) { - assert(::securemessage::EncScheme_IsValid(value)); - _has_bits_[0] |= 0x00000040u; - encryption_scheme_ = value; -} -inline void Header::set_encryption_scheme(::securemessage::EncScheme value) { - _internal_set_encryption_scheme(value); - // @@protoc_insertion_point(field_set:securemessage.Header.encryption_scheme) -} - -// optional bytes verification_key_id = 3; -inline bool Header::_internal_has_verification_key_id() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool Header::has_verification_key_id() const { - return _internal_has_verification_key_id(); -} -inline void Header::clear_verification_key_id() { - verification_key_id_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& Header::verification_key_id() const { - // @@protoc_insertion_point(field_get:securemessage.Header.verification_key_id) - return _internal_verification_key_id(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Header::set_verification_key_id(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - verification_key_id_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.Header.verification_key_id) -} -inline std::string* Header::mutable_verification_key_id() { - std::string* _s = _internal_mutable_verification_key_id(); - // @@protoc_insertion_point(field_mutable:securemessage.Header.verification_key_id) - return _s; -} -inline const std::string& Header::_internal_verification_key_id() const { - return verification_key_id_.Get(); -} -inline void Header::_internal_set_verification_key_id(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - verification_key_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* Header::_internal_mutable_verification_key_id() { - _has_bits_[0] |= 0x00000001u; - return verification_key_id_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* Header::release_verification_key_id() { - // @@protoc_insertion_point(field_release:securemessage.Header.verification_key_id) - if (!_internal_has_verification_key_id()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = verification_key_id_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (verification_key_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - verification_key_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Header::set_allocated_verification_key_id(std::string* verification_key_id) { - if (verification_key_id != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - verification_key_id_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), verification_key_id, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (verification_key_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - verification_key_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.Header.verification_key_id) -} - -// optional bytes decryption_key_id = 4; -inline bool Header::_internal_has_decryption_key_id() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool Header::has_decryption_key_id() const { - return _internal_has_decryption_key_id(); -} -inline void Header::clear_decryption_key_id() { - decryption_key_id_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000002u; -} -inline const std::string& Header::decryption_key_id() const { - // @@protoc_insertion_point(field_get:securemessage.Header.decryption_key_id) - return _internal_decryption_key_id(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Header::set_decryption_key_id(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000002u; - decryption_key_id_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.Header.decryption_key_id) -} -inline std::string* Header::mutable_decryption_key_id() { - std::string* _s = _internal_mutable_decryption_key_id(); - // @@protoc_insertion_point(field_mutable:securemessage.Header.decryption_key_id) - return _s; -} -inline const std::string& Header::_internal_decryption_key_id() const { - return decryption_key_id_.Get(); -} -inline void Header::_internal_set_decryption_key_id(const std::string& value) { - _has_bits_[0] |= 0x00000002u; - decryption_key_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* Header::_internal_mutable_decryption_key_id() { - _has_bits_[0] |= 0x00000002u; - return decryption_key_id_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* Header::release_decryption_key_id() { - // @@protoc_insertion_point(field_release:securemessage.Header.decryption_key_id) - if (!_internal_has_decryption_key_id()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000002u; - auto* p = decryption_key_id_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (decryption_key_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - decryption_key_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Header::set_allocated_decryption_key_id(std::string* decryption_key_id) { - if (decryption_key_id != nullptr) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - decryption_key_id_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), decryption_key_id, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (decryption_key_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - decryption_key_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.Header.decryption_key_id) -} - -// optional bytes iv = 5; -inline bool Header::_internal_has_iv() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool Header::has_iv() const { - return _internal_has_iv(); -} -inline void Header::clear_iv() { - iv_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000004u; -} -inline const std::string& Header::iv() const { - // @@protoc_insertion_point(field_get:securemessage.Header.iv) - return _internal_iv(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Header::set_iv(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000004u; - iv_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.Header.iv) -} -inline std::string* Header::mutable_iv() { - std::string* _s = _internal_mutable_iv(); - // @@protoc_insertion_point(field_mutable:securemessage.Header.iv) - return _s; -} -inline const std::string& Header::_internal_iv() const { - return iv_.Get(); -} -inline void Header::_internal_set_iv(const std::string& value) { - _has_bits_[0] |= 0x00000004u; - iv_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* Header::_internal_mutable_iv() { - _has_bits_[0] |= 0x00000004u; - return iv_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* Header::release_iv() { - // @@protoc_insertion_point(field_release:securemessage.Header.iv) - if (!_internal_has_iv()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000004u; - auto* p = iv_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (iv_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - iv_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Header::set_allocated_iv(std::string* iv) { - if (iv != nullptr) { - _has_bits_[0] |= 0x00000004u; - } else { - _has_bits_[0] &= ~0x00000004u; - } - iv_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), iv, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (iv_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - iv_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.Header.iv) -} - -// optional bytes public_metadata = 6; -inline bool Header::_internal_has_public_metadata() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool Header::has_public_metadata() const { - return _internal_has_public_metadata(); -} -inline void Header::clear_public_metadata() { - public_metadata_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000008u; -} -inline const std::string& Header::public_metadata() const { - // @@protoc_insertion_point(field_get:securemessage.Header.public_metadata) - return _internal_public_metadata(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Header::set_public_metadata(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000008u; - public_metadata_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.Header.public_metadata) -} -inline std::string* Header::mutable_public_metadata() { - std::string* _s = _internal_mutable_public_metadata(); - // @@protoc_insertion_point(field_mutable:securemessage.Header.public_metadata) - return _s; -} -inline const std::string& Header::_internal_public_metadata() const { - return public_metadata_.Get(); -} -inline void Header::_internal_set_public_metadata(const std::string& value) { - _has_bits_[0] |= 0x00000008u; - public_metadata_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* Header::_internal_mutable_public_metadata() { - _has_bits_[0] |= 0x00000008u; - return public_metadata_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* Header::release_public_metadata() { - // @@protoc_insertion_point(field_release:securemessage.Header.public_metadata) - if (!_internal_has_public_metadata()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000008u; - auto* p = public_metadata_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (public_metadata_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - public_metadata_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Header::set_allocated_public_metadata(std::string* public_metadata) { - if (public_metadata != nullptr) { - _has_bits_[0] |= 0x00000008u; - } else { - _has_bits_[0] &= ~0x00000008u; - } - public_metadata_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), public_metadata, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (public_metadata_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - public_metadata_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.Header.public_metadata) -} - -// optional uint32 associated_data_length = 7 [default = 0]; -inline bool Header::_internal_has_associated_data_length() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; - return value; -} -inline bool Header::has_associated_data_length() const { - return _internal_has_associated_data_length(); -} -inline void Header::clear_associated_data_length() { - associated_data_length_ = 0u; - _has_bits_[0] &= ~0x00000010u; -} -inline uint32_t Header::_internal_associated_data_length() const { - return associated_data_length_; -} -inline uint32_t Header::associated_data_length() const { - // @@protoc_insertion_point(field_get:securemessage.Header.associated_data_length) - return _internal_associated_data_length(); -} -inline void Header::_internal_set_associated_data_length(uint32_t value) { - _has_bits_[0] |= 0x00000010u; - associated_data_length_ = value; -} -inline void Header::set_associated_data_length(uint32_t value) { - _internal_set_associated_data_length(value); - // @@protoc_insertion_point(field_set:securemessage.Header.associated_data_length) -} - -// ------------------------------------------------------------------- - -// HeaderAndBody - -// required .securemessage.Header header = 1; -inline bool HeaderAndBody::_internal_has_header() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - PROTOBUF_ASSUME(!value || header_ != nullptr); - return value; -} -inline bool HeaderAndBody::has_header() const { - return _internal_has_header(); -} -inline void HeaderAndBody::clear_header() { - if (header_ != nullptr) header_->Clear(); - _has_bits_[0] &= ~0x00000002u; -} -inline const ::securemessage::Header& HeaderAndBody::_internal_header() const { - const ::securemessage::Header* p = header_; - return p != nullptr ? *p : reinterpret_cast( - ::securemessage::_Header_default_instance_); -} -inline const ::securemessage::Header& HeaderAndBody::header() const { - // @@protoc_insertion_point(field_get:securemessage.HeaderAndBody.header) - return _internal_header(); -} -inline void HeaderAndBody::unsafe_arena_set_allocated_header( - ::securemessage::Header* header) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(header_); - } - header_ = header; - if (header) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:securemessage.HeaderAndBody.header) -} -inline ::securemessage::Header* HeaderAndBody::release_header() { - _has_bits_[0] &= ~0x00000002u; - ::securemessage::Header* temp = header_; - header_ = 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 ::securemessage::Header* HeaderAndBody::unsafe_arena_release_header() { - // @@protoc_insertion_point(field_release:securemessage.HeaderAndBody.header) - _has_bits_[0] &= ~0x00000002u; - ::securemessage::Header* temp = header_; - header_ = nullptr; - return temp; -} -inline ::securemessage::Header* HeaderAndBody::_internal_mutable_header() { - _has_bits_[0] |= 0x00000002u; - if (header_ == nullptr) { - auto* p = CreateMaybeMessage<::securemessage::Header>(GetArenaForAllocation()); - header_ = p; - } - return header_; -} -inline ::securemessage::Header* HeaderAndBody::mutable_header() { - ::securemessage::Header* _msg = _internal_mutable_header(); - // @@protoc_insertion_point(field_mutable:securemessage.HeaderAndBody.header) - return _msg; -} -inline void HeaderAndBody::set_allocated_header(::securemessage::Header* header) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete header_; - } - if (header) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::securemessage::Header>::GetOwningArena(header); - if (message_arena != submessage_arena) { - header = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, header, submessage_arena); - } - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - header_ = header; - // @@protoc_insertion_point(field_set_allocated:securemessage.HeaderAndBody.header) -} - -// required bytes body = 2; -inline bool HeaderAndBody::_internal_has_body() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool HeaderAndBody::has_body() const { - return _internal_has_body(); -} -inline void HeaderAndBody::clear_body() { - body_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& HeaderAndBody::body() const { - // @@protoc_insertion_point(field_get:securemessage.HeaderAndBody.body) - return _internal_body(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void HeaderAndBody::set_body(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - body_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.HeaderAndBody.body) -} -inline std::string* HeaderAndBody::mutable_body() { - std::string* _s = _internal_mutable_body(); - // @@protoc_insertion_point(field_mutable:securemessage.HeaderAndBody.body) - return _s; -} -inline const std::string& HeaderAndBody::_internal_body() const { - return body_.Get(); -} -inline void HeaderAndBody::_internal_set_body(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - body_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* HeaderAndBody::_internal_mutable_body() { - _has_bits_[0] |= 0x00000001u; - return body_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* HeaderAndBody::release_body() { - // @@protoc_insertion_point(field_release:securemessage.HeaderAndBody.body) - if (!_internal_has_body()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = body_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void HeaderAndBody::set_allocated_body(std::string* body) { - if (body != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - body_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), body, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.HeaderAndBody.body) -} - -// ------------------------------------------------------------------- - -// HeaderAndBodyInternal - -// required bytes header = 1; -inline bool HeaderAndBodyInternal::_internal_has_header() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool HeaderAndBodyInternal::has_header() const { - return _internal_has_header(); -} -inline void HeaderAndBodyInternal::clear_header() { - header_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& HeaderAndBodyInternal::header() const { - // @@protoc_insertion_point(field_get:securemessage.HeaderAndBodyInternal.header) - return _internal_header(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void HeaderAndBodyInternal::set_header(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - header_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.HeaderAndBodyInternal.header) -} -inline std::string* HeaderAndBodyInternal::mutable_header() { - std::string* _s = _internal_mutable_header(); - // @@protoc_insertion_point(field_mutable:securemessage.HeaderAndBodyInternal.header) - return _s; -} -inline const std::string& HeaderAndBodyInternal::_internal_header() const { - return header_.Get(); -} -inline void HeaderAndBodyInternal::_internal_set_header(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - header_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* HeaderAndBodyInternal::_internal_mutable_header() { - _has_bits_[0] |= 0x00000001u; - return header_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* HeaderAndBodyInternal::release_header() { - // @@protoc_insertion_point(field_release:securemessage.HeaderAndBodyInternal.header) - if (!_internal_has_header()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = header_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (header_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - header_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void HeaderAndBodyInternal::set_allocated_header(std::string* header) { - if (header != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - header_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), header, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (header_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - header_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.HeaderAndBodyInternal.header) -} - -// required bytes body = 2; -inline bool HeaderAndBodyInternal::_internal_has_body() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool HeaderAndBodyInternal::has_body() const { - return _internal_has_body(); -} -inline void HeaderAndBodyInternal::clear_body() { - body_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000002u; -} -inline const std::string& HeaderAndBodyInternal::body() const { - // @@protoc_insertion_point(field_get:securemessage.HeaderAndBodyInternal.body) - return _internal_body(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void HeaderAndBodyInternal::set_body(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000002u; - body_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.HeaderAndBodyInternal.body) -} -inline std::string* HeaderAndBodyInternal::mutable_body() { - std::string* _s = _internal_mutable_body(); - // @@protoc_insertion_point(field_mutable:securemessage.HeaderAndBodyInternal.body) - return _s; -} -inline const std::string& HeaderAndBodyInternal::_internal_body() const { - return body_.Get(); -} -inline void HeaderAndBodyInternal::_internal_set_body(const std::string& value) { - _has_bits_[0] |= 0x00000002u; - body_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* HeaderAndBodyInternal::_internal_mutable_body() { - _has_bits_[0] |= 0x00000002u; - return body_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* HeaderAndBodyInternal::release_body() { - // @@protoc_insertion_point(field_release:securemessage.HeaderAndBodyInternal.body) - if (!_internal_has_body()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000002u; - auto* p = body_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void HeaderAndBodyInternal::set_allocated_body(std::string* body) { - if (body != nullptr) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - body_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), body, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (body_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - body_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.HeaderAndBodyInternal.body) -} - -// ------------------------------------------------------------------- - -// EcP256PublicKey - -// required bytes x = 1; -inline bool EcP256PublicKey::_internal_has_x() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool EcP256PublicKey::has_x() const { - return _internal_has_x(); -} -inline void EcP256PublicKey::clear_x() { - x_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& EcP256PublicKey::x() const { - // @@protoc_insertion_point(field_get:securemessage.EcP256PublicKey.x) - return _internal_x(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void EcP256PublicKey::set_x(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - x_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.EcP256PublicKey.x) -} -inline std::string* EcP256PublicKey::mutable_x() { - std::string* _s = _internal_mutable_x(); - // @@protoc_insertion_point(field_mutable:securemessage.EcP256PublicKey.x) - return _s; -} -inline const std::string& EcP256PublicKey::_internal_x() const { - return x_.Get(); -} -inline void EcP256PublicKey::_internal_set_x(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - x_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* EcP256PublicKey::_internal_mutable_x() { - _has_bits_[0] |= 0x00000001u; - return x_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* EcP256PublicKey::release_x() { - // @@protoc_insertion_point(field_release:securemessage.EcP256PublicKey.x) - if (!_internal_has_x()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = x_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (x_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - x_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void EcP256PublicKey::set_allocated_x(std::string* x) { - if (x != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - x_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), x, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (x_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - x_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.EcP256PublicKey.x) -} - -// required bytes y = 2; -inline bool EcP256PublicKey::_internal_has_y() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool EcP256PublicKey::has_y() const { - return _internal_has_y(); -} -inline void EcP256PublicKey::clear_y() { - y_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000002u; -} -inline const std::string& EcP256PublicKey::y() const { - // @@protoc_insertion_point(field_get:securemessage.EcP256PublicKey.y) - return _internal_y(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void EcP256PublicKey::set_y(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000002u; - y_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.EcP256PublicKey.y) -} -inline std::string* EcP256PublicKey::mutable_y() { - std::string* _s = _internal_mutable_y(); - // @@protoc_insertion_point(field_mutable:securemessage.EcP256PublicKey.y) - return _s; -} -inline const std::string& EcP256PublicKey::_internal_y() const { - return y_.Get(); -} -inline void EcP256PublicKey::_internal_set_y(const std::string& value) { - _has_bits_[0] |= 0x00000002u; - y_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* EcP256PublicKey::_internal_mutable_y() { - _has_bits_[0] |= 0x00000002u; - return y_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* EcP256PublicKey::release_y() { - // @@protoc_insertion_point(field_release:securemessage.EcP256PublicKey.y) - if (!_internal_has_y()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000002u; - auto* p = y_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (y_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - y_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void EcP256PublicKey::set_allocated_y(std::string* y) { - if (y != nullptr) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - y_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), y, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (y_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - y_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.EcP256PublicKey.y) -} - -// ------------------------------------------------------------------- - -// SimpleRsaPublicKey - -// required bytes n = 1; -inline bool SimpleRsaPublicKey::_internal_has_n() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool SimpleRsaPublicKey::has_n() const { - return _internal_has_n(); -} -inline void SimpleRsaPublicKey::clear_n() { - n_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& SimpleRsaPublicKey::n() const { - // @@protoc_insertion_point(field_get:securemessage.SimpleRsaPublicKey.n) - return _internal_n(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void SimpleRsaPublicKey::set_n(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - n_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.SimpleRsaPublicKey.n) -} -inline std::string* SimpleRsaPublicKey::mutable_n() { - std::string* _s = _internal_mutable_n(); - // @@protoc_insertion_point(field_mutable:securemessage.SimpleRsaPublicKey.n) - return _s; -} -inline const std::string& SimpleRsaPublicKey::_internal_n() const { - return n_.Get(); -} -inline void SimpleRsaPublicKey::_internal_set_n(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - n_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* SimpleRsaPublicKey::_internal_mutable_n() { - _has_bits_[0] |= 0x00000001u; - return n_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* SimpleRsaPublicKey::release_n() { - // @@protoc_insertion_point(field_release:securemessage.SimpleRsaPublicKey.n) - if (!_internal_has_n()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = n_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (n_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - n_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void SimpleRsaPublicKey::set_allocated_n(std::string* n) { - if (n != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - n_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), n, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (n_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - n_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.SimpleRsaPublicKey.n) -} - -// optional int32 e = 2 [default = 65537]; -inline bool SimpleRsaPublicKey::_internal_has_e() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SimpleRsaPublicKey::has_e() const { - return _internal_has_e(); -} -inline void SimpleRsaPublicKey::clear_e() { - e_ = 65537; - _has_bits_[0] &= ~0x00000002u; -} -inline int32_t SimpleRsaPublicKey::_internal_e() const { - return e_; -} -inline int32_t SimpleRsaPublicKey::e() const { - // @@protoc_insertion_point(field_get:securemessage.SimpleRsaPublicKey.e) - return _internal_e(); -} -inline void SimpleRsaPublicKey::_internal_set_e(int32_t value) { - _has_bits_[0] |= 0x00000002u; - e_ = value; -} -inline void SimpleRsaPublicKey::set_e(int32_t value) { - _internal_set_e(value); - // @@protoc_insertion_point(field_set:securemessage.SimpleRsaPublicKey.e) -} - -// ------------------------------------------------------------------- - -// DhPublicKey - -// required bytes y = 1; -inline bool DhPublicKey::_internal_has_y() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool DhPublicKey::has_y() const { - return _internal_has_y(); -} -inline void DhPublicKey::clear_y() { - y_.ClearToEmpty(); - _has_bits_[0] &= ~0x00000001u; -} -inline const std::string& DhPublicKey::y() const { - // @@protoc_insertion_point(field_get:securemessage.DhPublicKey.y) - return _internal_y(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void DhPublicKey::set_y(ArgT0&& arg0, ArgT... args) { - _has_bits_[0] |= 0x00000001u; - y_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:securemessage.DhPublicKey.y) -} -inline std::string* DhPublicKey::mutable_y() { - std::string* _s = _internal_mutable_y(); - // @@protoc_insertion_point(field_mutable:securemessage.DhPublicKey.y) - return _s; -} -inline const std::string& DhPublicKey::_internal_y() const { - return y_.Get(); -} -inline void DhPublicKey::_internal_set_y(const std::string& value) { - _has_bits_[0] |= 0x00000001u; - y_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); -} -inline std::string* DhPublicKey::_internal_mutable_y() { - _has_bits_[0] |= 0x00000001u; - return y_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); -} -inline std::string* DhPublicKey::release_y() { - // @@protoc_insertion_point(field_release:securemessage.DhPublicKey.y) - if (!_internal_has_y()) { - return nullptr; - } - _has_bits_[0] &= ~0x00000001u; - auto* p = y_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (y_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - y_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void DhPublicKey::set_allocated_y(std::string* y) { - if (y != nullptr) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - y_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), y, - GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (y_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { - y_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:securemessage.DhPublicKey.y) -} - -// ------------------------------------------------------------------- - -// GenericPublicKey - -// required .securemessage.PublicKeyType type = 1; -inline bool GenericPublicKey::_internal_has_type() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool GenericPublicKey::has_type() const { - return _internal_has_type(); -} -inline void GenericPublicKey::clear_type() { - type_ = 1; - _has_bits_[0] &= ~0x00000008u; -} -inline ::securemessage::PublicKeyType GenericPublicKey::_internal_type() const { - return static_cast< ::securemessage::PublicKeyType >(type_); -} -inline ::securemessage::PublicKeyType GenericPublicKey::type() const { - // @@protoc_insertion_point(field_get:securemessage.GenericPublicKey.type) - return _internal_type(); -} -inline void GenericPublicKey::_internal_set_type(::securemessage::PublicKeyType value) { - assert(::securemessage::PublicKeyType_IsValid(value)); - _has_bits_[0] |= 0x00000008u; - type_ = value; -} -inline void GenericPublicKey::set_type(::securemessage::PublicKeyType value) { - _internal_set_type(value); - // @@protoc_insertion_point(field_set:securemessage.GenericPublicKey.type) -} - -// optional .securemessage.EcP256PublicKey ec_p256_public_key = 2; -inline bool GenericPublicKey::_internal_has_ec_p256_public_key() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || ec_p256_public_key_ != nullptr); - return value; -} -inline bool GenericPublicKey::has_ec_p256_public_key() const { - return _internal_has_ec_p256_public_key(); -} -inline void GenericPublicKey::clear_ec_p256_public_key() { - if (ec_p256_public_key_ != nullptr) ec_p256_public_key_->Clear(); - _has_bits_[0] &= ~0x00000001u; -} -inline const ::securemessage::EcP256PublicKey& GenericPublicKey::_internal_ec_p256_public_key() const { - const ::securemessage::EcP256PublicKey* p = ec_p256_public_key_; - return p != nullptr ? *p : reinterpret_cast( - ::securemessage::_EcP256PublicKey_default_instance_); -} -inline const ::securemessage::EcP256PublicKey& GenericPublicKey::ec_p256_public_key() const { - // @@protoc_insertion_point(field_get:securemessage.GenericPublicKey.ec_p256_public_key) - return _internal_ec_p256_public_key(); -} -inline void GenericPublicKey::unsafe_arena_set_allocated_ec_p256_public_key( - ::securemessage::EcP256PublicKey* ec_p256_public_key) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(ec_p256_public_key_); - } - ec_p256_public_key_ = ec_p256_public_key; - if (ec_p256_public_key) { - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:securemessage.GenericPublicKey.ec_p256_public_key) -} -inline ::securemessage::EcP256PublicKey* GenericPublicKey::release_ec_p256_public_key() { - _has_bits_[0] &= ~0x00000001u; - ::securemessage::EcP256PublicKey* temp = ec_p256_public_key_; - ec_p256_public_key_ = 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 ::securemessage::EcP256PublicKey* GenericPublicKey::unsafe_arena_release_ec_p256_public_key() { - // @@protoc_insertion_point(field_release:securemessage.GenericPublicKey.ec_p256_public_key) - _has_bits_[0] &= ~0x00000001u; - ::securemessage::EcP256PublicKey* temp = ec_p256_public_key_; - ec_p256_public_key_ = nullptr; - return temp; -} -inline ::securemessage::EcP256PublicKey* GenericPublicKey::_internal_mutable_ec_p256_public_key() { - _has_bits_[0] |= 0x00000001u; - if (ec_p256_public_key_ == nullptr) { - auto* p = CreateMaybeMessage<::securemessage::EcP256PublicKey>(GetArenaForAllocation()); - ec_p256_public_key_ = p; - } - return ec_p256_public_key_; -} -inline ::securemessage::EcP256PublicKey* GenericPublicKey::mutable_ec_p256_public_key() { - ::securemessage::EcP256PublicKey* _msg = _internal_mutable_ec_p256_public_key(); - // @@protoc_insertion_point(field_mutable:securemessage.GenericPublicKey.ec_p256_public_key) - return _msg; -} -inline void GenericPublicKey::set_allocated_ec_p256_public_key(::securemessage::EcP256PublicKey* ec_p256_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete ec_p256_public_key_; - } - if (ec_p256_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::securemessage::EcP256PublicKey>::GetOwningArena(ec_p256_public_key); - if (message_arena != submessage_arena) { - ec_p256_public_key = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, ec_p256_public_key, submessage_arena); - } - _has_bits_[0] |= 0x00000001u; - } else { - _has_bits_[0] &= ~0x00000001u; - } - ec_p256_public_key_ = ec_p256_public_key; - // @@protoc_insertion_point(field_set_allocated:securemessage.GenericPublicKey.ec_p256_public_key) -} - -// optional .securemessage.SimpleRsaPublicKey rsa2048_public_key = 3; -inline bool GenericPublicKey::_internal_has_rsa2048_public_key() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; - PROTOBUF_ASSUME(!value || rsa2048_public_key_ != nullptr); - return value; -} -inline bool GenericPublicKey::has_rsa2048_public_key() const { - return _internal_has_rsa2048_public_key(); -} -inline void GenericPublicKey::clear_rsa2048_public_key() { - if (rsa2048_public_key_ != nullptr) rsa2048_public_key_->Clear(); - _has_bits_[0] &= ~0x00000002u; -} -inline const ::securemessage::SimpleRsaPublicKey& GenericPublicKey::_internal_rsa2048_public_key() const { - const ::securemessage::SimpleRsaPublicKey* p = rsa2048_public_key_; - return p != nullptr ? *p : reinterpret_cast( - ::securemessage::_SimpleRsaPublicKey_default_instance_); -} -inline const ::securemessage::SimpleRsaPublicKey& GenericPublicKey::rsa2048_public_key() const { - // @@protoc_insertion_point(field_get:securemessage.GenericPublicKey.rsa2048_public_key) - return _internal_rsa2048_public_key(); -} -inline void GenericPublicKey::unsafe_arena_set_allocated_rsa2048_public_key( - ::securemessage::SimpleRsaPublicKey* rsa2048_public_key) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(rsa2048_public_key_); - } - rsa2048_public_key_ = rsa2048_public_key; - if (rsa2048_public_key) { - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:securemessage.GenericPublicKey.rsa2048_public_key) -} -inline ::securemessage::SimpleRsaPublicKey* GenericPublicKey::release_rsa2048_public_key() { - _has_bits_[0] &= ~0x00000002u; - ::securemessage::SimpleRsaPublicKey* temp = rsa2048_public_key_; - rsa2048_public_key_ = 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 ::securemessage::SimpleRsaPublicKey* GenericPublicKey::unsafe_arena_release_rsa2048_public_key() { - // @@protoc_insertion_point(field_release:securemessage.GenericPublicKey.rsa2048_public_key) - _has_bits_[0] &= ~0x00000002u; - ::securemessage::SimpleRsaPublicKey* temp = rsa2048_public_key_; - rsa2048_public_key_ = nullptr; - return temp; -} -inline ::securemessage::SimpleRsaPublicKey* GenericPublicKey::_internal_mutable_rsa2048_public_key() { - _has_bits_[0] |= 0x00000002u; - if (rsa2048_public_key_ == nullptr) { - auto* p = CreateMaybeMessage<::securemessage::SimpleRsaPublicKey>(GetArenaForAllocation()); - rsa2048_public_key_ = p; - } - return rsa2048_public_key_; -} -inline ::securemessage::SimpleRsaPublicKey* GenericPublicKey::mutable_rsa2048_public_key() { - ::securemessage::SimpleRsaPublicKey* _msg = _internal_mutable_rsa2048_public_key(); - // @@protoc_insertion_point(field_mutable:securemessage.GenericPublicKey.rsa2048_public_key) - return _msg; -} -inline void GenericPublicKey::set_allocated_rsa2048_public_key(::securemessage::SimpleRsaPublicKey* rsa2048_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete rsa2048_public_key_; - } - if (rsa2048_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::securemessage::SimpleRsaPublicKey>::GetOwningArena(rsa2048_public_key); - if (message_arena != submessage_arena) { - rsa2048_public_key = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, rsa2048_public_key, submessage_arena); - } - _has_bits_[0] |= 0x00000002u; - } else { - _has_bits_[0] &= ~0x00000002u; - } - rsa2048_public_key_ = rsa2048_public_key; - // @@protoc_insertion_point(field_set_allocated:securemessage.GenericPublicKey.rsa2048_public_key) -} - -// optional .securemessage.DhPublicKey dh2048_public_key = 4; -inline bool GenericPublicKey::_internal_has_dh2048_public_key() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; - PROTOBUF_ASSUME(!value || dh2048_public_key_ != nullptr); - return value; -} -inline bool GenericPublicKey::has_dh2048_public_key() const { - return _internal_has_dh2048_public_key(); -} -inline void GenericPublicKey::clear_dh2048_public_key() { - if (dh2048_public_key_ != nullptr) dh2048_public_key_->Clear(); - _has_bits_[0] &= ~0x00000004u; -} -inline const ::securemessage::DhPublicKey& GenericPublicKey::_internal_dh2048_public_key() const { - const ::securemessage::DhPublicKey* p = dh2048_public_key_; - return p != nullptr ? *p : reinterpret_cast( - ::securemessage::_DhPublicKey_default_instance_); -} -inline const ::securemessage::DhPublicKey& GenericPublicKey::dh2048_public_key() const { - // @@protoc_insertion_point(field_get:securemessage.GenericPublicKey.dh2048_public_key) - return _internal_dh2048_public_key(); -} -inline void GenericPublicKey::unsafe_arena_set_allocated_dh2048_public_key( - ::securemessage::DhPublicKey* dh2048_public_key) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dh2048_public_key_); - } - dh2048_public_key_ = dh2048_public_key; - if (dh2048_public_key) { - _has_bits_[0] |= 0x00000004u; - } else { - _has_bits_[0] &= ~0x00000004u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:securemessage.GenericPublicKey.dh2048_public_key) -} -inline ::securemessage::DhPublicKey* GenericPublicKey::release_dh2048_public_key() { - _has_bits_[0] &= ~0x00000004u; - ::securemessage::DhPublicKey* temp = dh2048_public_key_; - dh2048_public_key_ = 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 ::securemessage::DhPublicKey* GenericPublicKey::unsafe_arena_release_dh2048_public_key() { - // @@protoc_insertion_point(field_release:securemessage.GenericPublicKey.dh2048_public_key) - _has_bits_[0] &= ~0x00000004u; - ::securemessage::DhPublicKey* temp = dh2048_public_key_; - dh2048_public_key_ = nullptr; - return temp; -} -inline ::securemessage::DhPublicKey* GenericPublicKey::_internal_mutable_dh2048_public_key() { - _has_bits_[0] |= 0x00000004u; - if (dh2048_public_key_ == nullptr) { - auto* p = CreateMaybeMessage<::securemessage::DhPublicKey>(GetArenaForAllocation()); - dh2048_public_key_ = p; - } - return dh2048_public_key_; -} -inline ::securemessage::DhPublicKey* GenericPublicKey::mutable_dh2048_public_key() { - ::securemessage::DhPublicKey* _msg = _internal_mutable_dh2048_public_key(); - // @@protoc_insertion_point(field_mutable:securemessage.GenericPublicKey.dh2048_public_key) - return _msg; -} -inline void GenericPublicKey::set_allocated_dh2048_public_key(::securemessage::DhPublicKey* dh2048_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete dh2048_public_key_; - } - if (dh2048_public_key) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::securemessage::DhPublicKey>::GetOwningArena(dh2048_public_key); - if (message_arena != submessage_arena) { - dh2048_public_key = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, dh2048_public_key, submessage_arena); - } - _has_bits_[0] |= 0x00000004u; - } else { - _has_bits_[0] &= ~0x00000004u; - } - dh2048_public_key_ = dh2048_public_key; - // @@protoc_insertion_point(field_set_allocated:securemessage.GenericPublicKey.dh2048_public_key) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace securemessage - -PROTOBUF_NAMESPACE_OPEN - -template <> struct is_proto_enum< ::securemessage::SigScheme> : ::std::true_type {}; -template <> struct is_proto_enum< ::securemessage::EncScheme> : ::std::true_type {}; -template <> struct is_proto_enum< ::securemessage::PublicKeyType> : ::std::true_type {}; - -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) - -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_proto_2fsecuremessage_2eproto diff --git a/third_party/securemessage/include/securemessage/public_key_proto_util.h b/third_party/securemessage/include/securemessage/public_key_proto_util.h deleted file mode 100644 index 3947462f..00000000 --- a/third_party/securemessage/include/securemessage/public_key_proto_util.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_PUBLIC_KEY_PROTO_UTIL_H_ -#define SECUREMESSAGE_PUBLIC_KEY_PROTO_UTIL_H_ - -#include -#include "securemessage/common.h" -#include "securemessage/crypto_ops.h" -#include "proto/securemessage.pb.h" - -namespace securemessage { - -class PublicKeyProtoUtil { - public: - // - // Encodes the internal implementation of the PublicKey into the appropriate - // protobuf format. - // - // @return nullptr if the PublicKey is not supported - // - static std::unique_ptr EncodePublicKey( - const CryptoOps::PublicKey& key); - - // - // Transforms the protobuf format into a internal representation of a - // PublicKey. - // - // @return nullptr if the GenericPublicKey protobuf type is not supported - // - static std::unique_ptr ParsePublicKey( - const GenericPublicKey& key); - - private: - virtual ~PublicKeyProtoUtil() {} - - // @return nullptr if the PublicKey is not supported - static std::unique_ptr EncodeEcPublicKey( - const CryptoOps::PublicKey& key); - - // @return nullptr if the EcP256PublicKey is invalid - static std::unique_ptr ParseEcPublicKey( - const EcP256PublicKey& key); - - // @return nullptr if the PublicKey is not supported - static std::unique_ptr EncodeRsaPublicKey( - const CryptoOps::PublicKey& key); - - // @return nullptr if the SimpleRsaPublicKey is invalid - static std::unique_ptr ParseRsaPublicKey( - const SimpleRsaPublicKey& key); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_PUBLIC_KEY_PROTO_UTIL_H_ diff --git a/third_party/securemessage/include/securemessage/raw_secure_message_parser.h b/third_party/securemessage/include/securemessage/raw_secure_message_parser.h deleted file mode 100644 index eef4becd..00000000 --- a/third_party/securemessage/include/securemessage/raw_secure_message_parser.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_RAW_SECURE_MESSAGE_PARSER_H_ -#define SECUREMESSAGE_RAW_SECURE_MESSAGE_PARSER_H_ - -#include - -#include "securemessage/common.h" -#include "securemessage/crypto_ops.h" - -namespace securemessage { - -// Utility class to parse and verify raw byte {@link SecureMessage} protos. -// Verifies the signature on the message, and decrypts "signcrypted" messages -// (while simultaneously verifying the signature). -// -// @see RawSecureMessageBuilder -class RawSecureMessageParser { - public: - // - // Parses a raw {@link SecureMessage} that is already separated out into - // signature and headerAndBody, containing a cleartext payload body, and - // verifies the signature. - // - // @param associated_data optional associated data bound to the signature (but - // not in the message). Send an empty string when not using. - // @return a string to the raw {@link HeaderAndBody} pair (which - // is fully verified) or a nullptr on error @see - // SecureMessageBuilder#BuildSignedCleartextMessage - // - static std::unique_ptr ParseSignedCleartextMessage( - const string& signature, - const string& header_and_body, - const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type, - const string& associated_data); - - // - // Parses a raw {@link SecureMessage} that is already separated out into - // signature and headerAndBody, containing an encrypted payload body, - // extracting a decryption of the payload body and verifying the signature. - // - // @return a string to the the raw {@link HeaderAndBody} pair - // (which is fully verified and decrypted or a nullptr on error - // @see SecureMessageBuilder#BuildSignCryptedMessage - // - static std::unique_ptr ParseSignCryptedMessage( - const string& signature, - const string& header_and_body, - const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type, - const CryptoOps::SecretKey& decryption_key, - CryptoOps::EncType enc_type, - const string& associated_data); - - private: - RawSecureMessageParser(); // Do not instantiate - ~RawSecureMessageParser(); - - // - // Verifies the components of a raw {@link HeaderAndBody}. - // - // @return true if the header_and_body can be verified. - // - static bool VerifyHeaderAndBody( - const string& signature, - const string& header_and_body, - const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type, - CryptoOps::EncType enc_type, - const string& associated_data, - bool suppress_associated_data); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_RAW_SECURE_MESSAGE_PARSER_H_ diff --git a/third_party/securemessage/include/securemessage/secure_message_builder.h b/third_party/securemessage/include/securemessage/secure_message_builder.h deleted file mode 100644 index 3b4053e7..00000000 --- a/third_party/securemessage/include/securemessage/secure_message_builder.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_SECURE_MESSAGE_BUILDER_H_ -#define SECUREMESSAGE_SECURE_MESSAGE_BUILDER_H_ - -#include - -#include "proto/securemessage.pb.h" - -#include "securemessage/byte_buffer.h" -#include "securemessage/common.h" -#include "securemessage/crypto_ops.h" - -namespace securemessage { - -// -// Builder for {@link SecureMessage} protos. Can be used to create either signed -// messages, or "signcrypted" (encrypted then signed) messages that include a -// tight binding between the ciphertext portion and a verification key identity. -// -// All the language non-specific work is done from within the -// {@link RawSecureMessageBuilder} class. -// -// @see SecureMessageParser -// @see RawSecureMessageBuilder -// -class SecureMessageBuilder { - public: - SecureMessageBuilder(); - - virtual ~SecureMessageBuilder(); - - // - // Resets this {@link SecureMessageBuilder} instance to a blank configuration - // (and returns it). - // - SecureMessageBuilder* Reset(); - - // - // Optional metadata to be sent along with the header information in this - // {@link SecureMessage}. - //

- // Note that this value will be sent UNENCRYPTED in all cases. - //

- // Can be used with either cleartext or signcrypted messages, but is intended - // primarily for use with signcrypted messages. - // - SecureMessageBuilder* SetPublicMetadata(const std::string& public_metadata); - - // - // The recipient of the {@link SecureMessage} should be able to uniquely - // determine the correct verification key, given only this value. - //

- // Can be used with either cleartext or signcrypted messages. Setting this is - // mandatory for signcrypted messages using a public key CryptoOps::SigType, - // in order to bind the encrypted body to a specific verification key. - //

- // Note that this value is sent UNENCRYPTED in all cases. - // - SecureMessageBuilder* SetVerificationKeyId( - const std::string& verification_key_id); - - // - // To be used only with {@link #BuildSignCryptedMessage(CryptoOps::Key, - // CryptoOps::SigType, CryptoOps::Key, CryptoOps::EncType, string)}, - // this value is sent UNENCRYPTED as part of the header. It should be - // used by the recipient of the {@link SecureMessage} to identify an - // appropriate key to use for decrypting the message body. - // - SecureMessageBuilder* SetDecryptionKeyId( - const std::string& decryption_key_id); - - // - // Additional data is "associated" with this {@link SecureMessage}, but will - // not be sent as part of it. The recipient of the {@link SecureMessage} will - // need to provide the same data in order to verify the message body. Setting - // this to {@code null} is equivalent to using an empty array (unlike the - // behavior of {@code VerificationKeyId} and {@code DecryptionKeyId}). - //

- // Note that the size (length in bytes) of the associated data will - // be sent in the UNENCRYPTED header information, even if you are - // using encryption. - //

- // If you will be using {@link #BuildSignedCleartextMessage(CryptoOps::Key, - // CryptoOps::SigType, string)}, then anyone observing the - // {@link SecureMessage} may be able to infer this associated data via an - // "offline dictionary attack". That is, when no encryption is used, you will - // not be hiding this data simply because it is not being sent over the wire. - // - SecureMessageBuilder* SetAssociatedData(const std::string& associated_data); - - // - // Generates a signed {@link SecureMessage} with the payload {@code body} left - // UNENCRYPTED. - //

- // Note that if you have used {@link #SetAssociatedData(string)}, the - // associated data will - // be subject to offline dictionary attacks if you use a public key {@link - // CryptoOps::SigType}. - //

- // Doesn't currently support symmetric keys stored in a TPM - //

- // Can return nullptr on error - // - // @see SecureMessageParser#ParseSignedCleartextMessage - // - std::unique_ptr BuildSignedCleartextMessage( - const CryptoOps::Key& signing_key, CryptoOps::SigType sig_type, - const std::string& body); - - // - // Generates a signed and encrypted {@link SecureMessage}. If the signature - // type requires a public key, such as with ECDSA_P256_SHA256, then the caller - // must set a verification id using the - // {@link #SetVerificationKeyId(string)} method. The verification key - // id will be bound to the encrypted {@code body}, preventing attacks that - // involve stripping the signature and then re-signing the encrypted - // {@code body} as if it was originally sent by the attacker. - // - //

It is safe to re-use one {@link SecretKey} as both - // {@code signingKey} and {@code encryptionKey}, even if that key is also used - // for {@link #buildSignedCleartextMessage(Key, SigType, byte[])}. In fact, - // the resulting output encoding will be more compact when the same symmetric - // key is used for both. - // - //

Note that PublicMetadata and other header fields are left - // UNENCRYPTED. - // - //

Doesn't currently support symmetric keys stored in a TPM - // - //

Can return nullptr on error - // - // @param encType must not be set to {@link EncType#NONE} - // @see SecureMessageParser#parseSignCryptedMessage(SecureMessage, - // CryptoOps::Key, CryptoOps::SigType, CryptoOps::Key, - // CryptoOps::EncType) - // - std::unique_ptr BuildSignCryptedMessage( - const CryptoOps::Key& signing_key, CryptoOps::SigType sig_type, - const CryptoOps::SecretKey& encryption_key, CryptoOps::EncType enc_type, - const std::string& body); - - private: - std::unique_ptr public_metadata_; - std::unique_ptr decryption_key_id_; - std::unique_ptr verification_key_id_; - std::unique_ptr associated_data_; - - // @param iv IV or {@code null} if IV to be left unset in the Header - std::unique_ptr

BuildHeader(CryptoOps::SigType sig_type, - CryptoOps::EncType enc_type, - const std::unique_ptr& iv); - - ByteBuffer SerializeHeaderAndBody(const std::string& header, - const std::string& body); - - std::unique_ptr CreateSignedResult( - const CryptoOps::Key& signing_key, const CryptoOps::SigType& sig_type, - const ByteBuffer& header_and_body, const ByteBuffer& associated_data); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_SECURE_MESSAGE_BUILDER_H_ diff --git a/third_party/securemessage/include/securemessage/secure_message_parser.h b/third_party/securemessage/include/securemessage/secure_message_parser.h deleted file mode 100644 index a827a99d..00000000 --- a/third_party/securemessage/include/securemessage/secure_message_parser.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_SECURE_MESSAGE_PARSER_H_ -#define SECUREMESSAGE_SECURE_MESSAGE_PARSER_H_ - -#include - -#include "proto/securemessage.pb.h" - -#include "securemessage/common.h" -#include "securemessage/crypto_ops.h" - -namespace securemessage { - -// This is a light wrapper on {@link RawSecureMessageParser} that binds to -// the c++ protobuf implementation. -// Utility class to parse and verify {@link SecureMessage} protos. Verifies the -// signature on the message, and decrypts "signcrypted" messages (while -// simultaneously verifying the signature). -// -// @see SecureMessageBuilder -class SecureMessageParser { - public: - // Extracts the {@link Header} component from a {@link SecureMessage} but - // DOES NOT VERIFY the signature when doing so. Callers should not - // trust the resulting output until after a subsequent {@code parse*()} call - // has succeeded. - // - //

The intention is to allow the caller to determine the type of the - // protocol message and which keys are in use, prior to attempting to verify - // (and possibly decrypt) the payload body. - // - //

The call will return a std::unique_ptr on success and a nullptr on error - static std::unique_ptr

GetUnverifiedHeader( - const SecureMessage& secmsg); - - // - // Parses a {@link SecureMessage} containing a cleartext payload body, and - // verifies the signature. - // - // @return a std::unique_ptr to the parsed {@link HeaderAndBody} pair (which - // is fully verified) or a nullptr on error @see - // SecureMessageBuilder#BuildSignedCleartextMessage - // - static std::unique_ptr ParseSignedCleartextMessage( - const SecureMessage& secmsg, const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type); - - // - // Parses a {@link SecureMessage} containing a cleartext payload body, and - // verifies the signature. - // - // @param assocaited_data optional associated data bound to the signature (but - // not in the message). Pass an empty string when not using. - // @return a std::unique_ptr to the parsed {@link HeaderAndBody} pair (which - // is fully verified) or a nullptr on error @see - // SecureMessageBuilder#BuildSignedCleartextMessage - // - static std::unique_ptr ParseSignedCleartextMessage( - const SecureMessage& secmsg, const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type, const string& associated_data); - - // - // Parses a {@link SecureMessage} containing an encrypted payload body, - // extracting a decryption of the payload body and verifying the signature. - // - // @param associated_data optional associated data bound to the signature - // (but not in the message). Pass an empty string when not using. - // @return a std::unique_ptr to the the parsed {@link HeaderAndBody} pair - // (which is fully verified and decrypted or a nullptr on error - // @see SecureMessageBuilder#BuildSignCryptedMessage - // - static std::unique_ptr ParseSignCryptedMessage( - const SecureMessage& secmsg, const CryptoOps::Key& verification_key, - CryptoOps::SigType sig_type, const CryptoOps::SecretKey& decryption_key, - CryptoOps::EncType enc_type, const string& associated_data); - - private: - SecureMessageParser(); // Do not instantiate - - ~SecureMessageParser(); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_SECURE_MESSAGE_PARSER_H_ diff --git a/third_party/securemessage/include/securemessage/secure_message_wrapper.h b/third_party/securemessage/include/securemessage/secure_message_wrapper.h deleted file mode 100644 index 24df25a3..00000000 --- a/third_party/securemessage/include/securemessage/secure_message_wrapper.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_SECURE_MESSAGE_WRAPPER_H_ -#define SECUREMESSAGE_SECURE_MESSAGE_WRAPPER_H_ - -#include - -#include "securemessage/common.h" -#include "securemessage/crypto_ops.h" - -namespace securemessage { - -// Utility class to allow alternate implementations of the securemessage -// protobuf to be used (for example, an objective-c implementation). -// -// @see SecureMessage -class SecureMessageWrapper { - public: - // Takes the byte representation of the {@link HeaderAndBody} and returns - // the iv field from the {@link Header}. If this does not exist, this - // function will return nullptr. - static std::unique_ptr ParseHeaderIv( - const string& header_and_body_bytes); - - // Takes the byte representation of the {@link HeaderAndBody} and returns the - // byte representation of the {@link Header}. If this does not exist, this - // function will return nullptr. - static std::unique_ptr ParseHeader( - const string& header_and_body_bytes); - - // Takes the byte representation of the {@link HeaderAndBodyInternal} and - // returns the byte representation of the {@link Header}. If this does not - // exist, this function will return nullptr. - static std::unique_ptr ParseInternalHeader( - const string& header_and_body_bytes); - - // Takes the byte representation of the {@link HeaderAndBody} and returns - // the {@link Body}. If this does not exist, this function will return - // nullptr. - static std::unique_ptr ParseBody(const string& header_and_body_bytes); - - // Takes the byte representation of the {@link Header} and {@link Body} and - // returns the byte representation of {@link HeaderAndBody}. - static std::unique_ptr BuildHeaderAndBody( - const string& header_bytes, const string& body_bytes); - - // Takes the byte representation of the header and returns the int value - // for the SigScheme enum - static int GetSignatureScheme(const string& header_bytes); - - // Takes the byte representation of the header and returns the int value - // for the EncScheme enum - static int GetEncryptionScheme(const string& header_bytes); - - // Takes the byte representation of the header and returns the length of the - // associated data stored in the header - static uint32_t GetAssociatedDataLength(const string& header_bytes); - - // Tests if the byte representation of the header has a decryption key id - static bool HasDecryptionKeyId(const string& header_bytes); - - // Tests if the byte representation of the header has a verification key id - static bool HasVerificationKeyId(const string& header_bytes); - - // - // Returns the constant exposed enums that are found in the - // {@link SecureMessage} protobuf. - // - // A return value of 0 would be considered an error. - // - // @see SigScheme - static int GetSigScheme(CryptoOps::SigType sig_type); - - // - // Returns the constant exposed enums that are found in the - // {@link SecureMessage} protobuf. - // - // A return value of 0 would be considered an error. - // - // @see EncScheme - static int GetEncScheme(CryptoOps::EncType enc_type); - - private: - SecureMessageWrapper(); // Do not instantiate - ~SecureMessageWrapper(); -}; - -} // namespace securemessage -#endif // SECUREMESSAGE_SECURE_MESSAGE_WRAPPER_H_ diff --git a/third_party/securemessage/include/securemessage/util.h b/third_party/securemessage/include/securemessage/util.h deleted file mode 100644 index 3eaf974b..00000000 --- a/third_party/securemessage/include/securemessage/util.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SECUREMESSAGE_UTIL_H_ -#define SECUREMESSAGE_UTIL_H_ - -#include -#include - -#include "securemessage/common.h" - -namespace securemessage { - -class Util { - public: - // - // Makes a new std::unique_ptr by taking input data and a length - // - static std::unique_ptr MakeUniquePtrString(const void* data, - size_t length); - - // - // Providing a level of indirection when logging error message. The idea - // being that this can be swapped out in platforms that log error messages in - // some more useful way. - // - static void LogError(const std::string& error_message); - - // - // Provides a level of indirection for managing really bad errors. A call of - // this function indicates that an unrecoverable error happened -- perhaps - // because of an attack or a bug in an underlying crypto provider. The - // invocation of this function indicates that any subsequent behavior will be - // undefined. This level of indirection is meant to let users of this library - // figure out how they want to deal with such bad errors. - // - // This function should never return. - // - static void LogErrorAndAbort [[noreturn]] (const std::string& error_message); - - private: - virtual ~Util(); -}; - -} // namespace securemessage - -#endif // SECUREMESSAGE_UTIL_H_