JOSE-JWE-ENC(1)
π jose-jwe-enc(1) π
okay so bestie, welcome to jose-jwe-enc β the jose manual page that's gonna teach you how to lock your secrets in a cryptographic vault πβ¨
β¨ NAME β¨
jose-jwe-enc β encrypts plaintext using one or more JWK/password π
π SYNOPSIS π
jose jwe enc [-i JWE] -I PT -k JWK [-p] [-r RCP] [-o JWE] [-O CT] [-c]
π¦ OVERVIEW π¦
So the jose jwe enc command encrypts your data using one or more JWK (-k) or a password (-p). And here's the slay part: when you give it more than one JWK or password, decryption will succeed with any one of the provided keys β so every recipient gets in with their own key, no sharing required. iconic behavior, honestly π
You can also make a detached JWE by specifying the -O option. In that case the decoded ciphertext gets written to the output you specified and it is not included in the JWE. detached, mysterious, main character energy π΅οΈββοΈ
And if you're only using one key (-k or -p), the resulting JWE may be output in JWE Compact Serialization by using the -c option. short, sweet, compact π
okay now the fun part β this command uses a template based approach for constructing a JWE. you can specify templates of the JWE itself (-i) or for the JWE Recipient Object (-r). attributes specified in either of these templates will appear unmodified in the output. the one exception? the JWE Protected Header should be specified in its decoded form in the template β this command will automatically encode it as part of the encryption process. don't worry about it, it's handled π
If you specify a JOSE Header Parameter (via either the -i or -r options) that affects the construction of the JWE, this command will attempt to behave according to that parameter as if it were configuration. for example, specifying the "zip" parameter in the JWE Protected Header will cause the plaintext to be compressed before encryption. currently, jose will modify its behavior for the "alg", "enc" and "zip" JOSE Header Parameters (see RFC 7516 Section 4.1.3), as well as the algorithm-specific parameters for the algorithms we support (see RFC 7518 Section 4). no cap, it just knows π§
That said β it is not necessary to provide any templates!jose jwe encwill automatically fill in the"alg"and"enc"parameters by inferring the correct algorithms from the provided input keys (JWK or password). so like, the-iand-roptions should generally be used for providing extended JWE metadata. optional, but cute π«Ά
π OPTIONS π
-iJSON,--input=JSONβ parse JWE from JSON πΈ-iFILE,--input=FILEβ read JWE from FILE π-i -,--input=-β read JWE from standard input π«-IFILE,--detached=FILEβ read decoded ciphertext from FILE π¦-I -,--detached=-β read decoded ciphertext from standard input β¨-rFILE,--recipient=FILEβ read JWE recipient template from FILE π-r -,--recipient=-β read JWE recipient template from standard input π₯-kFILE,--key=FILEβ read JWK(Set) from FILE π-k -,--key=-β read JWK(Set) from standard input ποΈ-p,--passwordβ prompt for an encryption password π€«-oFILE,--output=FILEβ write JWE to FILE π-o -,--output=-β write JWE to stdout (default) π₯οΈ-OFILE,--detach=FILEβ detach ciphertext and decode to FILE βοΈ-O -,--detach=-β detach ciphertext and decode to standard output π€-c,--compactβ output JWE using compact serialization π
π₯ EXAMPLES π₯
Encrypt data with a symmetric key using JWE JSON Serialization:
$ jose jwk gen -i '{"alg":"A128GCM"}' -o key.jwk
$ jose jwe enc -I msg.txt -k key.jwk -o msg.jwe
Encrypt data with a password using JWE Compact Serialization:
$ jose jwe enc -I msg.txt -p -c -o msg.jwe
Please enter an encryption password:
Please re-enter the previous password:
Compress plaintext before encryption:
$ jose jwe enc -i '{"protected":{"zip":"DEF"}}' ...
Encrypt with two keys and two passwords:
$ jose jwk gen -i '{"alg":"ECDH-ES+A128KW"}' -o ec.jwk
$ jose jwk gen -i '{"alg":"RSA1_5"}' -o rsa.jwk
$ jose jwe enc -I msg.txt -p -k ec.jwk -p -k rsa.jwk -o msg.jwe
Please enter a password:
Please re-enter the previous password:
Please enter a password:
Please re-enter the previous password:
π AUTHOR π
Nathaniel McCallum <npmccallum@redhat.com> β the legend who made this happen, we stan π«Ά
π SEE ALSO π
jose-jwe-dec(1), jose-jwe-fmt(1) β go read these next, bestie, they're literally the siblings of this page π
and that's the whole page! this little beauty comes to you from the JOSE-JWE-ENC(1) source, dated 06/09/2026 β write it in your notes, put it on your fridge, tattoo it on your arm, whatever works πβ¨π
π¦ where this page comes from
- arch rolling: jose 15-2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms