Ejemplo n.º 1
0
		size_t dh_key::compute_key(void* out, size_t out_len, bn::bignum pub_key) const
		{
			assert(out_len >= size());

			if (out_len < size())
			{
				throw std::invalid_argument("out_len");
			}

			int result = DH_compute_key(static_cast<unsigned char*>(out), pub_key.raw(), ptr().get());

			throw_error_if_not(result >= 0);

			return result;
		}
Ejemplo n.º 2
0
		inline buffer dh_key::compute_key(bn::bignum pub_key) const
		{
			buffer result(size());

			result.data().resize(compute_key(buffer_cast<uint8_t*>(result), buffer_size(result), pub_key.raw()));

			return result;
		}