https://github.com/mlesniak/go-keyz
Poor man's CLI public key encryption using Go's standard library (RSA and AES)
https://github.com/mlesniak/go-keyz
cli golang rsa utility
Last synced: 5 months ago
JSON representation
Poor man's CLI public key encryption using Go's standard library (RSA and AES)
- Host: GitHub
- URL: https://github.com/mlesniak/go-keyz
- Owner: mlesniak
- License: apache-2.0
- Created: 2019-11-20T08:51:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-21T06:09:28.000Z (over 6 years ago)
- Last Synced: 2023-03-11T02:08:58.897Z (over 3 years ago)
- Topics: cli, golang, rsa, utility
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 13
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/mlesniak/go-keyz/actions?query=workflow%3AGo)
[](CODE_OF_CONDUCT.md)
# Overview
This is a simple example of using standard go libraries ("batteries included") to encrypt and decrypt files with
public key cryptography using [RSA](https://en.wikipedia.org/wiki/RSA_(cryptosystem)).
## Compile, Build and Test
Use the standard go commands, i.e.
go test
go build
to generate a binary named `keyz`.
## General usage
First, generate your own public and private key pair with
keyz -k
Your key pair will be saved as `private.key` and `public.key`, respectively. Note that the pair is compatible to the
standard PEM format, i.e. you could also use openssl to generate your key pair using
openssl genrsa -f4 -out private.key 4096
openssl rsa -in private.key -outform PEM -pubout -out public.key
Data is always passed from stdin to stdout, hence use pipes correcly. To **encrypt** data, execute
keyz -e -p output-file
and to **decrypt** using your private key, use
keyz -d plaintext-output-file
## Usage for submitting files over networks using public-key cryptography
`keyz` can be used to submit files over networks using [netcat](https://en.wikipedia.org/wiki/Netcat) without
the necessity to exchange passwords. On the receiving client, start a netcat server on port 1234 which redirects read
data to keyz with
nc -l 1234|keyz -d
and on the sending client submit a file to the server (here: localhost) with
keyz -e -p public.key