42 #ifndef _DWMAUTHSYMCRYPTOMESSAGE_HH_ 43 #define _DWMAUTHSYMCRYPTOMESSAGE_HH_ 47 #include <cryptopp/aes.h> 49 #include "DwmSocket.hh" 50 #include "DwmDescriptorIOCapable.hh" 51 #include "DwmFileIOCapable.hh" 52 #include "DwmStreamIOCapable.hh" 53 #include "DwmStreamedLengthCapable.hh" 65 :
public DescriptorIOCapable,
public FileIOCapable,
66 public StreamIOCapable,
public StreamedLengthCapable
72 Message(
const std::string & secret,
const std::string & value =
"");
82 std::string
Value()
const;
87 const std::string &
Value(
const std::string & value);
92 std::istream &
Read(std::istream & is)
override;
97 std::ostream &
Write(std::ostream & os)
const override;
103 ssize_t
Read(
int fd)
override;
109 ssize_t
Write(
int fd)
const override;
115 size_t Read(FILE *f)
override;
121 size_t Write(FILE *f)
const override;
129 ssize_t SendTo(Socket & s,
int flags,
130 const Ipv4Address & dstAddr, uint16_t dstPort);
131 ssize_t RecvFrom(Socket & s,
int flags,
132 Ipv4Address & srcAddr, uint16_t & srcPort);
136 uint8_t _iv[CryptoPP::AES::BLOCKSIZE];
139 ssize_t ReadMsgValue(
int fd);
140 ssize_t WriteMsgValue(
int fd)
const;
141 std::istream & ReadMsgValue(std::istream & is);
142 std::ostream & WriteMsgValue(std::ostream & os)
const;
143 size_t ReadMsgValue(FILE *f);
144 size_t WriteMsgValue(FILE *f)
const;
153 #endif // _DWMAUTHSYMCRYPTOMESSAGE_HH_ uint32_t StreamedLength() const override
Returns the number of bytes that would be written if one of the Write() members were called.
Message(const std::string &secret, const std::string &value="")
Constructor with the given secret and value.
std::string Value() const
Returns the decrypted value.
std::ostream & Write(std::ostream &os) const override
Writes the message to an ostream. Returns the ostream.
Encapsulates an encrypted message.
Definition: DwmAuthSymCryptoMessage.hh:64
std::istream & Read(std::istream &is) override
Reads the message from an istream. Returns the istream.