Git Product home page Git Product logo

golang-signature-cli-task's Introduction

Signature Verifier

This is a skeleton for a CLI tool that can both sign and verify signatures of files.

Build

To build the project, run the following command:

go build -o verifier

Usage

Look at the automatically generated help text with

./verifier --help
./verifier sign --help
./verifier verify --help

Task

Part 1: Using openssl CLI tool to verify signatures

  1. Create a private key with the following command:
openssl genpkey -algorithm RSA -out private_key.pem -aes256
  1. Extract the public key from the private key with the following command:
openssl rsa -pubout -in private_key.pem -out public_key.pem
  1. Sign a file with the private key with the following command:
openssl dgst -sha256 -sign private_key.pem -out signature.sha256 secret.txt

Note

Double-check your understanding: What is SHA256? What is it's purpose in generating the signature?

  1. Verify the signature with the public key with the following command:
openssl dgst -sha256 -verify public_key.pem -signature signature.sha256 secret.txt
  1. Modify the secret.txt file and verify the signature again. What happens?

Tip

The following things aren't supposed to be particularly difficult. If you're having a rough time, come talk to me because you might be over-thinking something. Also, definitely leverage libraries to take care of this for you, you should be more glueing libraries together than re-inventing any wheel. ๐Ÿ˜„

Part 2: Code Implementation

  • Clone this repo and create a new branch off of main to work on.
  • Implement the missing parts of the verify command.
    • Testing - You can use the signature file + public/private key files generated in the previous step to test your implementation.
  • Implement the sign command. The sign command should sign a file with a private key and save the signature to a file.
  • Add a new command generate that generates a new private/public key pair and saves them to files. You'll need to modify the CLI/cobra commands to add this new command.

Important

Let me know if anything is unclear or if you need help with anything. I made this in an hour or two so there might be some mistakes or unclear instructions ๐Ÿ˜ฌ. Feel free to use any resources (CLI tools, libraries, google, ChatGPT, whatever). The main goal is to familiarize yourself with Go, signing/crypto concepts, and to make sure you understand what you're doing!

golang-signature-cli-task's People

Contributors

phillip-stephens avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.