Git Product home page Git Product logo

digitalsigner's Introduction

Build for Linux

GOOS=linux GOARCH=amd64 go build -o myprogram_linux

Build for Windows

GOOS=windows GOARCH=amd64 go build -o myprogram.exe

Build for macOS (optional, as you're already on macOS)

GOOS=darwin GOARCH=amd64 go build -o myprogram_mac

Run the program

./bin/osx/digitalsigner

digitalsigner is a CLI tool for signing and verifying digital signature.:

This application is a tool to sign and verify digital signature.
It is a CLI tool that can be used to sign and verify digital signature.

Usage:
  digitalsigner [command]

Available Commands:
  completion         Generate the autocompletion script for the specified shell
  generate-key-pair  A command to generate a key pair.
  generate-signature A command to generate a digital signature.
  help               Help about any command
  verifydata         A command to verify the integrity of a file.

Flags:
  -h, --help     help for digitalsigner
  -t, --toggle   Help message for toggle

Use "digitalsigner [command] --help" for more information about a command.

Generate Key Pair

./bin/osx/digitalsigner generate-key-pair -f example

INFO[0000] Generating key pair... example               
INFO[0000] Private key saved to example_private_key.pem 
INFO[0000] Public key saved to example_public_key.pem   

Generate Signature

./bin/osx/digitalsigner generate-signature -f testfile.txt -p example_private_key.pem -s example_signature

INFO[0000] Generating signature...                      
INFO[0000] Signature saved to example_signature

Verify Signature

./bin/osx/digitalsigner verifydata -f testfile.txt -p example_public_key.pem -s example_signature

INFO[0000] Verifying signature...                       
INFO[0000] Signature verified successfully

base64 -i example_signature -o example_signature.base64

Lk9UOVV7jgIrgugu1Iz8LtEJBQJg7EgyURDBeUtYTjMKWvrY6sCyopKgpyzjlUpiJBCOTWAnwzUho2AwAULq1gDjRVNJwEyVXSweHtfEyqXvGj4ZeA3mvUgeQlqCeG9PIy2xk9WidtsO/vC0rEmJniac8piX9p5Nu72CLs4Q4SkGW5qrS61+roUrSKgmfRuLz7Qr82Aykm1nUKDejCXVXwrOrOb7qwVHxPetWqh3aC2/ZgXiQN+FSHyqVkhF10zrp9WWnRwVu5YvTR/hlCBXINmg/D1pXnwWBxxfkqZgbmExSFe7s1jrL6fJjKosc0CrlZap11Z5m6HICS2L+GqAsQ==

attacth the signature to x-digital-signature header

curl -X GET "http://localhost:8080/api/v1/xxx" -H "accept: application/json" -H "x-digital-signature: Lk9UOVV7jgIrgugu1Iz8LtEJBQJg7EgyURDBeUtYTjMKWvrY6sCyopKgpyzjlUpiJBCOTWAnwzUho2AwAULq1gDjRVNJwEyVXSweHtfEyqXvGj4ZeA3mvUgeQlqCeG9PIy2xk9WidtsO/vC0rEmJniac8piX9p5Nu72CLs4Q4SkGW5qrS61+roUrSKgmfRuLz7Qr82Aykm1nUKDejCXVXwrOrOb7qwVHxPetWqh3aC2/ZgXiQN+FSHyqVkhF10zrp9WWnRwVu5YvTR/hlCBXINmg/D1pXnwWBxxfkqZgbmExSFe7s1jrL6fJjKosc0CrlZap11Z5m6HICS2L+GqAsQ=="

Verify Signature

base64 -D -i example_signature.base64 -o example_signature_sign

./bin/osx/digitalsigner verifydata -f testfile.txt -p example_public_key.pem -s example_signature_sign

INFO[0000] Verifying signature...                       
INFO[0000] Signature verified successfully

digitalsigner's People

Contributors

aofiee 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.