• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Dec-2019-

test-keys/H16-Dec-2019-5147

README.mdH A D16-Dec-20192 KiB6037

ec.keyH A D16-Dec-2019288 76

ec.pubH A D16-Dec-2019215 65

jose-util.tH A D16-Dec-20194.2 KiB9580

main.goH A D16-Dec-20195.3 KiB190132

utils.goH A D16-Dec-20192.3 KiB10267

README.md

1# JOSE CLI
2
3The `jose-util` command line utility allows for encryption, decryption, signing
4and verification of JOSE messages. Its main purpose is to facilitate dealing
5with JOSE messages when testing or debugging.
6
7## Usage
8
9The utility includes the subcommands `encrypt`, `decrypt`, `sign`, `verify` and
10`expand`. Examples for each command can be found below.
11
12Algorithms are selected via the `--alg` and `--enc` flags, which influence the
13`alg` and `enc` headers in respectively. For JWE, `--alg` specifies the key
14management algorithm (e.g. `RSA-OAEP`) and `--enc` specifies the content
15encryption algorithm (e.g. `A128GCM`). For JWS, `--alg` specifies the
16signature algorithm (e.g. `PS256`).
17
18Input and output files can be specified via the `--in` and `--out` flags.
19Either flag can be omitted, in which case `jose-util` uses stdin/stdout for
20input/output respectively. By default each command will output a compact
21message, but it's possible to get the full serialization by supplying the
22`--full` flag.
23
24Keys are specified via the `--key` flag. Supported key types are naked RSA/EC
25keys and X.509 certificates with embedded RSA/EC keys. Keys must be in PEM
26or DER formats.
27
28## Examples
29
30### Encrypt
31
32Takes a plaintext as input, encrypts, and prints the encrypted message.
33
34    echo 'test message' | jose-util encrypt --key public-key.pem --alg RSA-OAEP --enc A128GCM
35
36### Decrypt
37
38Takes an encrypted message (JWE) as input, decrypts, and prints the plaintext.
39
40    jose-util decrypt --key private-key.pem
41
42### Sign
43
44Takes a payload as input, signs it, and prints the signed message with the embedded payload.
45
46    jose-util sign --key private-key.pem --alg PS256
47
48### Verify
49
50Reads a signed message (JWS), verifies it, and extracts the payload.
51
52    jose-util verify --key public-key.pem
53
54### Expand
55
56Expands a compact message to the full serialization format.
57
58    jose-util expand --format JWE   # Expands a compact JWE to full format
59    jose-util expand --format JWS   # Expands a compact JWS to full format
60