• Stars
    star
    253
  • Rank 159,874 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a command line tool for playing with NaCl

clinacl

A command line tool for playing with the NaCl cryptography library, with support for Keybase-style signatures. This is a toy, so please don't feed it any private data or rely on it in production.

Use pip to install it:

pip install clinacl

Note that depending on how Python is set up on your machine, you might need to use sudo with that.

Examples

NaCl Symmetric Encryption

$ plaintext="Release the hounds."
$ key=$(clinacl secretgen)
$ echo $key
5c6f65e7a9c2a8cb8107dcd0601a02285895e7c9dd60450f682003f82bd3aa39
$ nonce="deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
$ ciphertext=$(echo $plaintext | clinacl encrypt $key --nonce $nonce)
$ echo $ciphertext
deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef52ab40194806e3c4dec342a6aebf456bde3d50773ec977b8bcd3db3f07c86391d778ba97
$ echo $ciphertext | clinacl decrypt $key
Release the hounds.

NaCl Public Key Signatures

$ message="The truth, the whole truth, and nothing but the truth."
$ signingkey=$(clinacl signinggen)
$ echo $signingkey
95faf19820c827aae2959e01beb81195a14d23d70018d79c26976f027fc405ec
$ verifykey=$(clinacl verifygen $signingkey)
$ echo $verifykey
b83e67e7b5c2b35e09745bf559392e17dc960e18a39bec2adae8b97b5ab02fd9
$ echo message | clinacl sign $signingkey
ec94d3a3c3aeac1d8361c4be719314f396815c7852706252698091034b42f75416bfafe203f61876d2f6185fd495ca656fe6fdb4a0b86ba9323efe77a8410c006d6573736167650a
$ echo $message | clinacl sign $signingkey | clinacl verify $verifykey
The truth, the whole truth, and nothing but the truth.

Verify a Keybase Signature

$ link="g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgb0QEGch1mSRBwXnmm+ElpwHWSpGF4Y5wGq9Wz1BEOsYKp3BheWxvYWTFA5x7ImJvZHkiOnsiZGV2aWNl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2ZjZhMjVmNDZhMiIsInNlcW5vIjoyNTd9LCJwcmV2IjoiNTgwOGQ2OTRlOWFjNDFhMDEwZjMwNTk5YmRmNGM4MDdlNzc4Mjg2YWYyMmZkNWY0NWExMmJjZWM3NDBjMGEzNiIsInNlcW5vIjoxNSwidGFnIjoic2lnbmF0dXJlIn2jc2lnxEAaomeO/0vh2uEtIo1HQ6lQW07IKoSqfLyYnpbbks3tYxo+a7VXMC/NgzdUExivyhira4cUzk43Q7EboDF2EDEMqHNpZ190eXBlIKN0YWfNAgKndmVyc2lvbgE="
$ echo $link | clinacl keybase
{"body":{"device":{"id":"f4fe3d1f0c813d130bd5059e1ad32818","status":2,"type":"desktop"},"key":{"eldest_kid":"010104e724362e7ba6633980a6257f043f7c3d8733550594a792aacf6c6d4677dd940a","host":"keybase.io","kid":"01206f440419c875992441c179e69be125a701d64a9185e18e701aaf56cf50443ac60a","uid":"bf65266d0d8df3ad5d1b367f578e6819","username":"ralph"},"revoke":{"kids":["01205edc00a173a54324ad5237c939a6abbf9ff61210946689da1d721329acdab9de0a","0121a53c23710e1850a3282a1aad6f538673d078c112f1f23e2b1711941be1c3dd4b0a"]},"type":"revoke","version":1},"client":{"name":"keybase.io go client","version":"0.1.7"},"ctime":1429651499,"expire_in":315360000,"merkle_root":{"ctime":1429651392,"hash":"2dea88c23bb749f9dd99ceb02c460c6581c7865a2abe54cfd45ffe69fe8041acce29bf8c0371f80dfeec05f86f91eac317dacbc2e50366b14bd986f6a25f46a2","seqno":257},"prev":"5808d694e9ac41a010f30599bdf4c807e778286af22fd5f45a12bcec740c0a36","seqno":15,"tag":"signature"}

More Repositories

1

duct.rs

a Rust library for running child processes
Rust
807
star
2

sha256_project

The SHA-256 Project, developed for NYU Tandon's Applied Cryptography course
Python
533
star
3

bao

an implementation of BLAKE3 verified streaming
Rust
465
star
4

blake3-py

Python bindings for the BLAKE3 cryptographic hash function
Python
139
star
5

blake2_simd

high-performance implementations of BLAKE2b/s/bp/sp in pure Rust with dynamic SIMD
C
126
star
6

duct.py

a Python library for running child processes
Python
113
star
7

fbmessenger

[deprecated] a PyQt clone of Facebook Messenger for Windows
Python
102
star
8

os_pipe.rs

a cross-platform library for opening OS pipes in Rust
Rust
97
star
9

blake3-6502

the BLAKE3 hash function implemented in 6502 assembly
Assembly
56
star
10

shared_child.rs

a wrapper around std::process::Child that lets multiple threads wait or kill at once
Rust
39
star
11

applied_crypto_2021_fall

problem sets for CS-GY 6903 Applied Cryptography
Python
39
star
12

bessie

an authenticated, chunked cipher based on BLAKE3
Rust
21
star
13

pure_python_blake3

a pure Python implementation of BLAKE3
Python
15
star
14

dotfiles

Jack's config files
Shell
12
star
15

blake3_reference_impl_c

a C port of the BLAKE3 Rust reference implementation
C
10
star
16

blake2_c.rs

a safe wrapper around the BLAKE2 C implementation (deprecated in favor of blake2b_simd and blake2s_simd)
Rust
7
star
17

riddance

a reservable, retiring, recyclable slotmap/arena (WIP)
Rust
6
star
18

kangarootwelve_xkcp.rs

A Rust wrapper around the XKCP implementation of the KangarooTwelve hash function
C
6
star
19

unsafe_rust_is_not_c_talk

6
star
20

founder

A wrapper around fzf and fd, which keeps track of files you've opened before
Rust
6
star
21

arch

Jack's install scripts for Arch Linux.
Shell
5
star
22

bao_presentation

HTML
5
star
23

bao_experiments

benchmarks for various design changes to github.com/oconnor663/bao
HTML
4
star
24

avx512_test

Rust
4
star
25

rust-examples

scary things that Rust keeps you safe from
Rust
4
star
26

mersenne_breaker

Rust
4
star
27

copy_in_place

[deprecated] a single-function Rust crate providing a safe wrapper around ptr::copy for efficient copying within slices
Rust
4
star
28

jacko.io

source files for my personal website
Rust
4
star
29

blake3_aead

experimental
Rust
4
star
30

chacha20_simd

experimental
Rust
4
star
31

pure_python_salsa_chacha

pure Python implementations of Salsa20, XSalsa20, ChaCha20 (IETF), and XChaCha20
Python
4
star
32

simd_examples

Rust
3
star
33

happy_eyeballs

A demo comparison between futures in Rust and in Python's Trio
Rust
3
star
34

thread_tester

dummy project
Rust
3
star
35

blake2s_simd

DEPRECATED
Rust
3
star
36

keybase_validator

Rust
3
star
37

zsh-sensible

zsh defaults that everyone can agree on
Shell
3
star
38

atomic_examples

Rust
3
star
39

async_demo

teaching examples for async Rust
Rust
3
star
40

baokeshed

Rust
3
star
41

easy_steps_chinese_vocab

Python
3
star
42

test

funny filenames
3
star
43

cpp_rust_talk

https://youtu.be/IPmRDS0OSxM
JavaScript
3
star
44

tosqlite

Python
3
star
45

cooper_pair_box

Jack's physics senior project. A model of the inductively-shunted Cooper pair box.
Python
2
star
46

cell_talk

JavaScript
2
star
47

dungeon_of_despair

a great text-based dungeon crawler from our undergraduate years
Scheme
2
star
48

qol-armor

Lua
2
star
49

rust_blake3_c_bindings

C
2
star
50

supercop

Jack's working copy of the SUPERCOP source tree, for BLAKE3 submissions (see crypto_hash/blake3/)
C
2
star
51

scratch

2
star
52

unsound_helpers

Rust
2
star
53

incremental_messagepack

Example implementation of an incremental MessagePack decoder.
Python
2
star
54

appveyor-exec-py

reproducing a bug where python scripts don't execute on AppVeyor
Python
2
star
55

cryptopals-rust

HTML
2
star
56

pooter

for Mi
Objective-C
2
star
57

basex_gmp

C
2
star
58

clap_unicode_test

exercising a bug in the Rust Clap library
Rust
2
star
59

palindrompit

A palindromic tip calculator for Android
Scala
2
star
60

pyo3_pybuffer_repro

repro code for a memory corruption issue with PyO3 + PyPy
Rust
1
star
61

broken-make

a demo of a broken Make build
C
1
star
62

blog_os

Rust
1
star
63

actions-test

messing around with GitHub Actions
Rust
1
star
64

curve25519

code from an interview, not interesting :)
Python
1
star
65

rust-practice

Rust
1
star
66

cell_utils

EXPERIMENTAL CODE, not published on crates.io
Rust
1
star
67

fsanitize_example

Rust
1
star
68

ttt

Tic-Tac-Toe
Python
1
star
69

codingexamples

Python
1
star
70

yalie

Yet Another Lisp Interpreting Experiment: Jack's comp sci senior project. An interpreter for an object-oriented Lisp.
Python
1
star
71

go_calling_rust_example

Go
1
star
72

find_xor_collisions

Rust
1
star
73

peru-server

a Flask web site that can host peru modules and generate a peru.yaml for you
Python
1
star
74

peru-pygit2-example

an example project using peru and make to build against pygit2
Makefile
1
star
75

cc_hello_world

minimal demo project for testing `cc` changes
Rust
1
star