42#ifndef _DWMCREDENCENONCE_HH_
43#define _DWMCREDENCENONCE_HH_
69 randombytes_buf(_nonce,
sizeof(_nonce));
76 std::istream &
Read(std::istream & is)
79 is.read((
char *)_nonce, crypto_secretbox_NONCEBYTES);
87 std::ostream &
Write(std::ostream & os)
const
90 os.write((
const char *)_nonce, crypto_secretbox_NONCEBYTES);
103 operator const uint8_t * ()
const {
return _nonce; }
106 uint8_t _nonce[crypto_secretbox_NONCEBYTES];
Encapsulates a nonce for encryption.
Definition DwmCredenceNonce.hh:60
std::ostream & Write(std::ostream &os) const
Writes the nonce to the given ostream os. Returns os.
Definition DwmCredenceNonce.hh:87
Nonce(const Nonce &)=default
Copy constructor.
Nonce(bool init=true)
Default constructor.
Definition DwmCredenceNonce.hh:66
std::istream & Read(std::istream &is)
Reads the nonce from the given istream is. Returns is.
Definition DwmCredenceNonce.hh:76