Skip to content

Lab2Milestone1

sethnielson edited this page Apr 30, 2019 · 3 revisions

Lab 2 Milestone1: Authentication and Key Exchange

Assigned 4/17/2019
Due 4/22/2019
Points 100

Overview

The class PETF has chosen the PLS_ROAST PRFC as the draft for PRFC 2 (secure). The secure protocol is not described here. Please refer to the PRFC.

The Asyncio Protocol API should control all of these elements:

  • Creating a client and server using playground.create_server and playground.create_connection must cause the handshake to happen

  • Once a secure handshake is complete, the application layer's connection_made must be called

  • The application layer of either client or server must be able to send data securely through your protocol using transport.write

  • The application layer of either client or server must be able to end a session using transport.close

  • Once the application layer can no longer send data (as specified by the PRFC), your layer must call the application layer's connection_lost

You can test your layer using application layer protocols such as echotest. But you should also learn how to write unit tests with mock transports. See the playground network testing quickstart for more details.

Using the PRFC

YOU MUST USE THE PRFC FOR YOUR STANDARD

If you find an error, a mistake, or any other problem with the PRFC that would prevent you from completing the assignment, alert the PETF and include a proposed fix to the document. Assuming that the error is real (i.e., you didn't miss something) and your fix solves the problem, they will update the PRFC with your edits.

Cryptography

Make sure to use the Python cryptography module. Refer to the documentation page for how to use RSA encryption, AES GCM encryption, etc.

Grading

You need to submit a Playground connector module (please refer to the playground documentation about this topic). This module needs to be in your github in the following location:

<team_repository_root>/src/lab2/pls_roast/

The pls_roast directory must be the module as defined in Playground documentation. That is, the pls_roast directory must be able to be copied (or sym-linked) into the .playground/connectors directory.

The stack should be associated with two aliases:

"pls_roast" "lab2_[github name lower case]"

Also, and this is important, your pls_roast layer must be built on top of pimp. The way to do that is to pull out the connector and build your stacking factory on top of it. Here's the sample code:

import playground
from .protocol import PLSRoastClient, PLSRoastServer
from playground.network.common import StackingProtocolFactory

pimpConnector = playground.getConnector("pimp")
pimpClientType = pimpConnector.getClientStackFactory()
pimpServerType = pimpConnector.getServerStackFactory()

PlsClientFactory = StackingProtocolFactory.CreateFactoryType(pimpClientType, PLSRoastClient)
PlsServerFactory = StackingProtocolFactory.CreateFactoryType(pimpServerType, PLSRoastServer)

plsConnector = playground.Connector(protocolStack=(
    PlsClientFactory(),
    PlsServerFactory()))
playground.setConnector("pls_roast", plsConnector)

Notice that the CreateFactoryType takes a series of protocol factories. The lowest protocol factory is first. So in this example, when the factory goes to create a stack, it will first create a pimp protocol, then a pls roast protocol, and tie them together. By using the getConnector, your layer will pull pimp independently from the connectors directory without having to know where the module is directly.

This also makes it easier when I plug your code into my test framework.

Grading for this lab is as follows:

  • 50 points for correctly completing the handshake when everything is correct
  • 50 points for correctly aborting on error:
    • Unexpected packet type (e.g., expected "Finished" but got "Data")
    • No certificate
    • Random number of incorrect size
    • Incorrect RSA encryption
    • Incorrect Pre-Master Secret return value from server