Convert Figma logo to code with AI

keybase logosaltpack

a modern crypto messaging format

1,000
63
1,000
10

Top Related Projects

A dead simple tool to sign files and verify digital signatures.

18,759

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

A high-level OpenPGP library

13,531

Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Quick Overview

Saltpack is a modern cryptographic messaging format developed by Keybase. It provides a secure way to encrypt, sign, and authenticate messages, designed to be simple, flexible, and resistant to traffic analysis. Saltpack aims to improve upon existing standards like PGP and GPG.

Pros

  • Simple and easy-to-implement protocol
  • Resistant to traffic analysis and metadata leakage
  • Supports both symmetric and asymmetric encryption
  • Designed with future compatibility in mind

Cons

  • Relatively new compared to established standards like PGP
  • Limited adoption outside of Keybase ecosystem
  • Lack of widespread tooling and integration support

Code Examples

  1. Encrypting a message:
import saltpack

message = b"Hello, world!"
recipients = [public_key1, public_key2]
encrypted = saltpack.encrypt(message, recipients)
  1. Decrypting a message:
import saltpack

decrypted = saltpack.decrypt(encrypted, private_key)
print(decrypted.decode())
  1. Signing a message:
import saltpack

message = b"This is a signed message."
signed = saltpack.sign(message, signing_key)
  1. Verifying a signed message:
import saltpack

verified_message, signer = saltpack.verify(signed)
print(f"Message: {verified_message.decode()}")
print(f"Signer: {signer}")

Getting Started

To use Saltpack in your Python project, first install it using pip:

pip install saltpack

Then, import the library and use its functions:

import saltpack

# Generate a keypair
public_key, private_key = saltpack.generate_keypair()

# Encrypt a message
message = b"Secret message"
encrypted = saltpack.encrypt(message, [public_key])

# Decrypt the message
decrypted = saltpack.decrypt(encrypted, private_key)

print(decrypted.decode())  # Output: Secret message

This example demonstrates generating a keypair, encrypting a message, and then decrypting it using Saltpack.

Competitor Comparisons

A dead simple tool to sign files and verify digital signatures.

Pros of minisign

  • Simpler and more lightweight, focusing solely on file signing and verification
  • Easier to integrate into existing workflows due to its minimalistic approach
  • Faster execution for basic signing tasks

Cons of minisign

  • Limited functionality compared to Saltpack's broader feature set
  • Lacks advanced features like encryption and streaming support
  • Not designed for multi-recipient scenarios or complex key management

Code comparison

minisign:

unsigned char pk[crypto_sign_PUBLICKEYBYTES];
unsigned char sk[crypto_sign_SECRETKEYBYTES];
crypto_sign_keypair(pk, sk);

Saltpack:

keyring, err := keyring.NewKeyring()
if err != nil {
    return err
}

Summary

minisign is a lightweight tool focused on simple file signing and verification, making it easy to integrate and use for basic tasks. Saltpack, on the other hand, offers a more comprehensive suite of cryptographic operations, including encryption and multi-recipient support. While minisign excels in simplicity and speed for straightforward signing tasks, Saltpack provides greater flexibility and advanced features for more complex cryptographic needs.

18,759

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

Pros of age

  • Simpler and more lightweight design, focusing on file encryption
  • Supports multiple key types (X25519, SSH keys) for flexibility
  • Actively maintained and developed

Cons of age

  • Less feature-rich compared to Saltpack (e.g., no signing or detached signatures)
  • Newer project with potentially less battle-testing and ecosystem support
  • Limited to file encryption, while Saltpack offers a broader range of operations

Code Comparison

age:

recipient, err := age.ParseX25519Recipient(pubKey)
file, err := age.Encrypt(output, recipient)
_, err = io.Copy(file, input)

Saltpack:

mki := saltpack.NewMsgpackKeyIdentifier()
signer := saltpack.NewSigningPublicKey(publicKey)
stream, err := saltpack.NewEncryptStream(output, mki, signer, recipients)
_, err = io.Copy(stream, input)

Summary

age is a more focused and lightweight tool for file encryption, while Saltpack offers a broader range of cryptographic operations. age supports multiple key types and is actively maintained, but it lacks some features present in Saltpack, such as signing capabilities. The choice between the two depends on specific use cases and required features.

A high-level OpenPGP library

Pros of gopenpgp

  • Implements the widely-used OpenPGP standard, ensuring broad compatibility
  • Actively maintained by ProtonMail, a reputable privacy-focused company
  • Provides a comprehensive set of cryptographic operations beyond just encryption

Cons of gopenpgp

  • More complex API compared to Saltpack's streamlined approach
  • Larger codebase and potentially steeper learning curve
  • OpenPGP standard has known limitations and complexities

Code Comparison

gopenpgp:

publicKey, err := crypto.NewKeyFromArmored(publicKeyString)
message := crypto.NewPlainMessage([]byte("Hello, World!"))
encrypted, err := publicKey.Encrypt(message, nil)

Saltpack:

encrypted, err := saltpack.Encrypt(
    []byte("Hello, World!"),
    saltpack.NewBoxKey(publicKey),
    nil,
)

Summary

gopenpgp offers a robust implementation of the OpenPGP standard with a wide range of features, backed by ProtonMail's expertise. However, it may be more complex to use compared to Saltpack's simpler approach. Saltpack, developed by Keybase, provides a more modern and streamlined encryption solution but may have less widespread adoption. The choice between the two depends on specific project requirements, desired compatibility, and ease of use preferences.

13,531

Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Pros of Tink

  • Broader cryptographic functionality, including key management, digital signatures, and more
  • Extensive language support (C++, Java, Go, Python, and JavaScript)
  • Actively maintained with regular updates and improvements

Cons of Tink

  • More complex to use due to its extensive feature set
  • Larger codebase and dependencies, potentially increasing attack surface
  • Steeper learning curve for developers new to cryptography

Code Comparison

Saltpack (encryption):

sealed_box = saltpack.encrypt(message, [recipient_public_key])

Tink (encryption):

primitive = handle.primitive(aead.Aead)
ciphertext = primitive.encrypt(plaintext, associated_data)

Additional Notes

Saltpack focuses specifically on message encryption and signing, while Tink provides a more comprehensive cryptographic toolkit. Saltpack's simplicity may be preferable for projects with narrow cryptographic needs, while Tink's extensive features make it suitable for more complex applications requiring various cryptographic operations.

Tink's active development and broader language support make it a strong choice for large-scale projects, especially those requiring cross-platform compatibility. However, Saltpack's straightforward API and focused functionality can be advantageous for developers seeking a simpler solution for secure messaging.

Pros of libsignal-protocol-c

  • Implements the Signal Protocol, which is widely recognized for its security and privacy features
  • Written in C, offering better performance and wider compatibility across platforms
  • Actively maintained and used by Signal, a popular secure messaging application

Cons of libsignal-protocol-c

  • More complex implementation, requiring deeper cryptographic knowledge to use effectively
  • Focused specifically on messaging protocols, less versatile for general-purpose encryption tasks
  • Steeper learning curve for developers not familiar with low-level C programming

Code Comparison

libsignal-protocol-c:

signal_protocol_store_context *store_context;
signal_protocol_store_context_create(&store_context, context);
signal_protocol_store_context_set_session_store(store_context, &session_store);
signal_protocol_store_context_set_pre_key_store(store_context, &pre_key_store);
signal_protocol_store_context_set_signed_pre_key_store(store_context, &signed_pre_key_store);

Saltpack:

var secretKey saltpack.SigningSecretKey
var publicKey saltpack.SigningPublicKey
secretKey, publicKey, err := saltpack.GenerateSigningKeyPair()
sealed, err := saltpack.Seal(message, secretKey, recipients...)
opened, senderKey, err := saltpack.Open(sealed, keyring)

The libsignal-protocol-c code focuses on setting up the protocol context and stores, while Saltpack's code demonstrates simpler key generation and message sealing/opening operations. Saltpack appears to have a more straightforward API for general encryption tasks, while libsignal-protocol-c is tailored for secure messaging implementations.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

saltpack

a modern crypto messaging format

https://saltpack.org/

Build Status GoDoc

saltpack is a streamlined, modern solution, designed with simplicity in mind. It is easy to implement & integrate. We've made few crypto decisions and instead leave almost all of the heavy lifting to the NaCl library.

saltpack is a binary message format, encoded using the MessagePack format. Messages are broken up into reasonable (1MB) chunks, over which regular NaCl operations are performed. We have taken pains to address many of the shortcomings of current message formats: (1) only authenticated data is output; (2) repudiable authentication is used wherever possible; (3) chunks cannot be reordered or combined with other transmissions; (4) the public keys of senders and recipients can be hidden; and (5) message truncation is detectable.

Visually speaking, a saltpack ASCII output looks a lot like PGP's.

saltpack

BEGIN SALTPACK SIGNED MESSAGE. kXR7VktZdyH7rvq v5wcIkHbs7XwHpb
nPtLcF6vE5yY63t aHF62jiEC1zHGqD inx5YqK0nf5W9Lp TvUmM2zBwxgd3Nw
kvzZ96W7ZfDdTVg F5Y99c2l5EsCy1I xVNl0nY1TP25vsX 2cRXXPUrM2UKtWq
UK2HG2ifBSOED4w xArcORHfFeiEZxF CqestMqLSCCE6lT HFcdvt1QX9JjmWL
o5AAqPiECnoHiSA bPHhz2JnSCyDIOz ZET1BWzttbMDL4N pcyQLmsGqYpxhG6
uvdBxdt55w9xQvQ hDPuOsKF05Hsml6 z7h9TS2msJcNwtz vxGIQR7sbB19UOt
boM1hlolmMB3loP 0KexlROFBTDC6MR nBvd9sZUxA8Z7i5 a6Dk5yFU3WEYQAo
DqqjXcp0yBoHO5O KEMqkZlyMf1PKiB 2n9wE6jwxAN1xws ccthT6X3iRYk0Br
gHW6QRXzAHLy6Ib LgY6b3UcQAoDo8b XyaExxinVuM5Ftk 75BJOWoyLGFhZS7
EfKR8jQQexvyjDM rJLxYtjvaLX7joS 2q1VcUlqGfZDhAa 4vxJQAyu57beOux
oobLhI47iZf9bxK PmYrVQ5PsC6pY1J KTQQexvlvp2yicx K4su2AFCjihbzNI
yZgKM4NHN1KZapS O3iB9SlhVfTfFcR FoQoSViTkbtDtTt 6I0jrTRHkv9XVQQ
eeeuzR7qYu1Grm3 zDPyj7JgK2mDidw HchOZnfOn59QLnM nH7ErnPRXgHuWHG
DBidjQPakJHuWsk 2ftpIyZd2NLYEFS Mqcbo6QeCdk7LA1 uobl4NXzpvi8amO
Pe8xAl1OzUCoD34 MbCwtTAe1JNymvs okufV8lHU0jVnbj u4no9QB9aP2Wkjx
PfeqIH2fEtOjmFP gPMhGWslkU0M7FL QP77gPHbgjPLSD8 yIRTrbgzpAPut5R
QhIdqVlHbUOa9sI v7gSqOi0GbUlhSM 183LxZI8pIlvgn9 Ms1WNzt5Xkv0W1Q
Qf419ZmuQVPQDOk 0hffDmUk71TlfVx XZCF3voC2ysgl3g YdLz4rDRzMJgd2m
01HIbfdsoZpAMty O27WtUNRLV1iyC9 tK5ApCyekI4nWcf 2OvTHnC8ma7bloW
XAG. END SALTPACK SIGNED MESSAGE.

PGP

-----BEGIN PGP MESSAGE-----
Comment: GPGTools - https://gpgtools.org

owEBUAKv/ZANAwAKAdIkQTsc+mSQAcsgYgBWZ0C0SSBhbSBzbyBzaWNrIG9mIHRo
aXMgc2hpdAqJAhwEAAEKAAYFAlZnQLQACgkQ0iRBOxz6ZJBS9Q/+MSfWiOz5OvRt
lHTncX8Ifo7+wSKYH039vEQAUvj+rnEdlBzcJPoHDE1yZxAZT5ek5S+cxQ5bx55K
WRLvw/sAz+OU0OPHSDsqI2LjU6D+s1EvwCISkXoWlMVx5vJsEz2XGlQ8DzgBC2Jy
wPanQf1lUz0c7k0ySdCTdZ0qG1YuaYnCXsS6g/E8E7TIO++2v5EbkgYZl3Io2LcI
C9TqTHdrIc7WGTSFjwq9JIgvwfuShpccNSFQ262gSJh8rUOzzY37q81pKxDnBvEV
TMrQYY0e/JK7KMMcHDSQSeWnMxf4/v5Qex7WI55CW4++qbNvDylDi9fTpkYfXl3B
L8pbBAxMUjcJX4qVVzWcxTwSXYO29Bi4osn2klNyZHnO35kuI9XGziWCGqhVx1MW
ptNHoVjk7/Uo7k39hY0Vjltnl/SqXHq/H7YTRSgLebuhn6zqMbmFXtyHYSHGgAQ4
rcdSBta+I9tmYCnp1GmfeXff2wzsFYPUune2Hve4VghjmeU0x7OWMEl93gpznSwu
NvzyOCqFCyfEmt/R2QCXAkxwPU/Mdsd5vzEHSMkcZgW4CTr+j5YG/C3kMy7UJAGZ
ZzFAh3/Z8fCtfREF3zH48XbNh3dQXNl40bUF/AgPvLqPf35L7TCchcUAC7oiASa/
Ph/Hao4ZzCQDM76Jr/aCUJIbxyc2zco=
=eyef
-----END PGP MESSAGE-----

The changes here are small: we've reduced our characters to base62 plus some period markers, and only at the ends of words. PGP messages often get mangled by different apps, websites, and smart text processors.

Of course, saltpack can output binary, too. Either way, it's what's inside the format that matters. You can read the spec for the details.

Post issues to: https://github.com/keybase/keybase-issues