In this exercise, you will implement a client application that interacts with a secure server to complete a series of cryptographic challenges.
The goal is to reinforce your understanding of fundamental cryptographic concepts while simulating real-world secure communication protocols.
By the end of this challenge, you should be able to:
- Implement basic cryptographic operations (hashing and encryption)
- Interact with a RESTful API using secure protocols
- Handle and respond to time-sensitive cryptographic challenges
- Manage a simple score-based system in a competitive environment
You are tasked with creating a client application that communicates with a provided server.
The server will issue two types of cryptographic challenges: hash challenges and encryption challenges. Your client must solve these challenges correctly to earn points.
The server provides the following endpoints:
/subscribe(POST): Register your client with the server/info/{address}(GET): Retrieve your current score and information/challenge/hash/{address}(GET): Request a SHA256 hash challenge/challenge/hash/{address}/{challengeID}(POST): Submit a SHA256 hash challenge solution/challenge/encrypt/{address}(GET): Request a RSA encryption challenge/challenge/encrypt/{address}/{challengeID}(POST): Submit a RSA encryption challenge solution
-
Hash Challenge:
- The server provides a random sentence.
- Your task is to compute the SHA256 hash of the sentence and submit it back to the server.
-
Encryption Challenge:
- The server provides a random sentence and a public key.
- Your task is to encrypt the sentence using the provided RSA public key and submit the RSA ciphertext back to the server.
- Each successful challenge completion earns you 1 point.
- Each failed attempt results in a 3-point deduction.
- The first student to reach a score of 30 wins a bonus.
- Implement a client application in a programming language of your choice.
- Your client should be able to:
- Subscribe to the server with a valid Ethereum address and name
- Request and solve both hash and encryption challenges
- Handle errors gracefully and continue functioning
- Retrieve current score information
- Implement proper error handling and logging in your client application.
- Ensure your client can handle concurrent challenges and maintain a consistent state.
For extra credit, consider implementing the following features:
- A user interface to display current score and challenge status
- Automatic retrying of failed challenges with exponential backoff
- Implementation of additional cryptographic algorithms beyond those required
Submit your client application code along with a brief report describing:
- Your implementation approach
- Any challenges you faced and how you overcame them
- Potential improvements or optimizations you would make with more time
Good luck, and may the best cryptographer win!