예제 #1
0
파일: file.cpp 프로젝트: wbenny/mini-tor
void
file::write_from_string(
  const string_ref path,
  const byte_buffer_ref content
  )
{
  io::file_stream f(path, io::file_access::write);
  f.write(content.get_buffer(), content.get_size());
}
예제 #2
0
void
circuit_node::set_shared_secret(
  const crypto::big_integer& peer_public,
  const byte_buffer_ref kh // derivative key data, for verification of derivation
  )
{
  // assert(kh.get_size() == 20)

  crypto::big_integer shared_secret = _dh.get_shared_secret(peer_public);
  auto key_material = derive_keys(shared_secret.to_bytes());

  if (memcmp(key_material.get_buffer(), kh.get_buffer(), kh.get_size()) == 0)
  {
    _crypto_state = new circuit_node_crypto_state(key_material);
  }
}
예제 #3
0
void
curve25519_public_key::import(
  const byte_buffer_ref key
  )
{
  memory::copy(_blob.X, key.get_buffer(), key_size_in_bytes);
}
예제 #4
0
void
curve25519_private_key::import(
  const byte_buffer_ref key
  )
{
  memory::copy(_blob.d, key.get_buffer(), key_size_in_bytes);
  detail::curve25519_donna(_blob.X, _blob.d, basepoint_9);
}