VFER SECURITY LAYER (VSL) SPECIFICATION

Handshake

The handshake establishes a shared secret between server and client. This secret is used in the key generation phase to generate session keys which are then used for encryption and verification of messages. The shared secret is generated using random data and has a length of VSL_KEYLEN bytes.

The following methods are available to share the secret:

SSH Starting Mode

The message has the following format:

struct ssh_msg_secret {
    char magic[P_MAGIC_SIZE];
    unsigned char secret[VSL_KEYLEN];
};
magic is a char array describing the protocoll version and has to be set to VSL1 (not zero terminated).

The message has the following format:

struct ssh_msg_port {
    char magic[P_MAGIC_SIZE];
    uint32_t port;
};
magic is a char array describing the protocoll version and has to be set to VSL1 (not zero terminated). port is in network byte order.

Note:
To prevent deadlocks, the server must not try to write anything to stderr or stdout before it has read the shared secret from stdin.
The server process has to exit with one of the following return codes:

If the server encouters an error, it can additionally write a descriptive message of up to 512 bytes to stderr. This has to be done before daemonization.

Challenge Response Mode

In challenge response mode, the entire authentication is done over an existing vfer connection. First, a shared secret is established using Diffie-Hellman key exchange. The secure channel is then used to ask the client for a username and a password. The login data is then checked by the server using a function supplied by the application developer.

Session Key Generation

The session keys are generated from the shared secret. There are 4 different session keys derived for each VSL connection:

a || b means that a and b are concatenated. All the strings are not \0 terminated.

Packet Encryption

Each VSL packet has a header with the structure:
typedef struct phead_t {
    uint64_t msgnr;             //!< Packet number
    unsigned char hash[VSL_MACLEN];      //!< MAC
    char magic[P_MAGIC_SIZE];   //!< Packet header prefix
    char type;                  //!< Packet type
    uint32_t datalen;           //!< Length of payload data
} phead_t;
followed by datalen bytes of data. VSL packets are send as VFER datagrams. All integer values are in network byte order.

Sending a Data Packet

If a message msg is to be send, the procedure is as follows:

Receiving a Data Packet

If a packet pkg has been received, the procedure to obtain the message msg is as follows (the packet is dropped if any of the assertions fail):
Generated on Tue Aug 8 16:07:22 2006 for VFER by  doxygen 1.4.7