2017-02-01 12:52:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-02-01 17:14:52 +00:00
|
|
|
#include "libp2p/crypto/key.h"
|
2017-02-02 19:10:12 +00:00
|
|
|
#include "libp2p/crypto/rsa.h"
|
2017-03-19 12:42:52 +00:00
|
|
|
#include "libp2p/conn/session.h"
|
2017-07-31 21:36:08 +00:00
|
|
|
#include "libp2p/peer/peerstore.h"
|
2017-08-09 13:03:40 +00:00
|
|
|
#include "libp2p/net/protocol.h"
|
2017-02-01 17:14:52 +00:00
|
|
|
|
2017-02-01 12:52:09 +00:00
|
|
|
/**
|
2017-03-19 12:42:52 +00:00
|
|
|
* Handling of a secure connection
|
2017-02-01 12:52:09 +00:00
|
|
|
*/
|
|
|
|
|
2017-02-02 19:10:12 +00:00
|
|
|
|
2017-08-09 13:03:40 +00:00
|
|
|
struct Libp2pProtocolHandler* libp2p_secio_build_protocol_handler(struct RsaPrivateKey* private_key, struct Peerstore* peer_store);
|
|
|
|
|
2017-02-02 19:10:12 +00:00
|
|
|
/***
|
|
|
|
* performs initial communication over an insecure channel to share
|
|
|
|
* keys, IDs, and initiate connection. This is a framed messaging system
|
|
|
|
* @param session the secure session to be filled
|
2017-03-07 00:03:04 +00:00
|
|
|
* @param private_key the local private key to use
|
|
|
|
* @param remote_requested the other side is who asked for the upgrade
|
2017-02-02 19:10:12 +00:00
|
|
|
* @returns true(1) on success, false(0) otherwise
|
|
|
|
*/
|
2017-08-09 14:12:16 +00:00
|
|
|
int libp2p_secio_handshake(struct SessionContext* session, struct RsaPrivateKey* private_key, struct Peerstore* peerstore, const uint8_t* buffer, size_t buffer_size);
|