salty

package module
v0.0.0-...-2632aec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 10 Imported by: 3

README

salty

Build Status

A command-line tool using the saltpack messaging format and the keys.pub Go library.

Install

$ go install go.mills.io/salty/cmd/salty-keygen@latest
$ go install go.mills.io/salty/cmd/salty@latest

Usage

Generating Keys

Alice:

$ salty-keygen -o alice.key
Public key: kex1jszw7x5yc8509rssv9avmkjk749m5r0zjt6twtmtmtrq8wyt662q680s99

Bob:

$ salty-keygen -o bob.key
Public key: kex1gsjmjud9fpyc39hczyugxeg29ljesnxlja44lk2xlg6cu8tlpfkqdppaw4
Encrypting Messages

From Alice to Bob:

$ salty -i alice.key -r kex1gsjmjud9fpyc39hczyugxeg29ljesnxlja44lk2xlg6cu8tlpfkqdppaw4
Hello bob!
^D
BEGIN SALTPACK ENCRYPTED MESSAGE. keDIDMQWYvVR58B FTfTeDQNHuepdES xwnHuwnSTNQAils We53yO0JGG4aOeO gvFnsz1bwz8y1vY 2Qg6HCqX78YKwl1 D2QzLdY4rKG3Zd3 sHVWVs731LISwgH DTy0zz3dTmAZKHq nmwniEVfs432K38 PRlNWhp1AgvHL6h 98KtaudNLc876A3 5PMHnSlHTRVaQuX US1W4tS3R18ib0b CVIib7v9lT95jeg B6isCaISrRNgl3q VQjjgTWkG271jG3 7WwD6OJbAqdtkeF N50CcS8OLzFvcwM tCv88fBw5XJNKWB KyQXxu9kztR2nnb WtkhCNSPle4lH0E QqRkYN7lLvZieB8 mahEMNopC0vtNSa HE72KIr9wkkG13m 9bP. END SALTPACK ENCRYPTED MESSAGE.
Decrypting Messages

Bob (from Alice):

$ salty -i bob.key -d
BEGIN SALTPACK ENCRYPTED MESSAGE. keDIDMQWYvVR58B FTfTeDQNHuepdES xwnHuwnSTNQAils We53yO0JGG4aOeO gvFnsz1bwz8y1vY 2Qg6HCqX78YKwl1 D2QzLdY4rKG3Zd3 sHVWVs731LISwgH DTy0zz3dTmAZKHq nmwniEVfs432K38 PRlNWhp1AgvHL6h 98KtaudNLc876A3 5PMHnSlHTRVaQuX US1W4tS3R18ib0b CVIib7v9lT95jeg B6isCaISrRNgl3q VQjjgTWkG271jG3 7WwD6OJbAqdtkeF N50CcS8OLzFvcwM tCv88fBw5XJNKWB KyQXxu9kztR2nnb WtkhCNSPle4lH0E QqRkYN7lLvZieB8 mahEMNopC0vtNSa HE72KIr9wkkG13m 9bP. END SALTPACK ENCRYPTED MESSAGE.
^D
# signed by: kex1jszw7x5yc8509rssv9avmkjk749m5r0zjt6twtmtmtrq8wyt662q680s99
Hello bob!

License

salty is licensed under the terms of the MIT License

Documentation

Overview

Package salty is a library and set of command-line (cli) tools for working with ED25519 keys and th saltpack message format

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version release version
	Version = "0.0.1"

	// Commit will be overwritten automatically by the build system
	Commit = "HEAD"
)
View Source
var (
	// ErrProtectedKey is an error returned when a private key is protected by a password, but none was provided.
	ErrProtectedKey = errors.New("error: key protected by a password")
)

Functions

func Decrypt

func Decrypt(key *keys.EdX25519Key, input []byte) ([]byte, *keys.EdX25519PublicKey, error)

Decrypt decrypts the `input` using the Private Key `key` and returns the unencrypted bytes and the sender's public key on success, or nill bytes and a nil sender on failure.

func Encrypt

func Encrypt(key *keys.EdX25519Key, input []byte, recipients []string) ([]byte, error)

Encrypt encrypts the `input` using the Private Key `key` to the Public Keys of the `recipients`. Armour serializing is used by default. The armour bytes are returned on success or nil bytes and an error on failure.

func FullVersion

func FullVersion() string

FullVersion display the full version and build

func GenerateKeys

func GenerateKeys(pwd string, out io.Writer) (*keys.EdX25519Key, string)

GenerateKeys creates a new pair of Ed25519 keys and writes the Private Key to the `out io.Writer` and returns the Private and Public Keys. The Private Key written to `out` is Base64 encoded.

func ParseIdentity

func ParseIdentity(pwd string, r io.Reader) (*keys.EdX25519Key, error)

ParseIdentity parses the Salty Identity file given by `r io.Reader` which has a line-oriented format where comments (lines beginning with a #) and the and blank lines are ignored and the private key is the first non-comment / non-blank line. The Private Key is a Base64 decoded. This returns the parsed Ed25519 key on success or nil key and error if it fails.

func Sign

func Sign(key *keys.EdX25519Key, input []byte) ([]byte, error)

Sign signs the `input` using the Private Key `key` Armour serializing is used by default. The armour bytes are returned on success or nil bytes and an error on failure.

func Verify

func Verify(input []byte) ([]byte, keys.ID, error)

Verify verifies the `input` and returns the otput as well as the key used to sign the message on success, or nil bytes, an empty signer key and en error on failure.

Types

This section is empty.

Directories

Path Synopsis
cmd
salty
Package main is the salty command-line (cli) tool
Package main is the salty command-line (cli) tool
salty-keygen
Package main is the salty-keygen command-line (cli) tool
Package main is the salty-keygen command-line (cli) tool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL