José

jwe.h
1 /* vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80: */
2 /*
3 * Copyright 2016 Red Hat, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
136 #pragma once
137
138 #include "cfg.h"
139 #include "io.h"
140 #include <jansson.h>
141 #include <stdbool.h>
142 #include <stdint.h>
143
151 json_t *
152 jose_jwe_hdr(const json_t *jwe, const json_t *rcp);
153
170 bool
171 jose_jwe_enc(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk,
172 const void *pt, size_t ptl);
173
189 jose_io_t *
190 jose_jwe_enc_io(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk,
191 jose_io_t *next);
192
254 bool
255 jose_jwe_enc_jwk(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk,
256 json_t *cek);
257
273 bool
274 jose_jwe_enc_cek(jose_cfg_t *cfg, json_t *jwe, const json_t *cek,
275 const void *pt, size_t ptl);
276
307 jose_io_t *
308 jose_jwe_enc_cek_io(jose_cfg_t *cfg, json_t *jwe, const json_t *cek,
309 jose_io_t *next);
310
326 void *
327 jose_jwe_dec(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp,
328 const json_t *jwk, size_t *ptl);
329
345 jose_io_t *
346 jose_jwe_dec_io(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp,
347 const json_t *jwk, jose_io_t *next);
348
391 json_t *
392 jose_jwe_dec_jwk(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp,
393 const json_t *jwk);
394
409 void *
410 jose_jwe_dec_cek(jose_cfg_t *cfg, const json_t *jwe, const json_t *cek,
411 size_t *ptl);
412
442 jose_io_t *
443 jose_jwe_dec_cek_io(jose_cfg_t *cfg, const json_t *jwe, const json_t *cek,
444 jose_io_t *next);
445
jose_jwe_dec_io
jose_io_t * jose_jwe_dec_io(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp, const json_t *jwk, jose_io_t *next)
Unwraps and decrypts ciphertext using streaming.
jose_jwe_dec_jwk
json_t * jose_jwe_dec_jwk(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp, const json_t *jwk)
Unwraps a CEK with a JWK.
jose_jwe_dec
void * jose_jwe_dec(jose_cfg_t *cfg, const json_t *jwe, const json_t *rcp, const json_t *jwk, size_t *ptl)
Unwraps and decrypts ciphertext.
jose_jwe_enc_cek
bool jose_jwe_enc_cek(jose_cfg_t *cfg, json_t *jwe, const json_t *cek, const void *pt, size_t ptl)
Encrypts plaintext with the CEK.
jose_jwe_enc
bool jose_jwe_enc(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk, const void *pt, size_t ptl)
Wraps and encrypts plaintext.
jose_io_t
The interface for chained IO.
Definition: io.h:61
jose_jwe_enc_cek_io
jose_io_t * jose_jwe_enc_cek_io(jose_cfg_t *cfg, json_t *jwe, const json_t *cek, jose_io_t *next)
Encrypts plaintext with the CEK using streaming.
jose_jwe_dec_cek_io
jose_io_t * jose_jwe_dec_cek_io(jose_cfg_t *cfg, const json_t *jwe, const json_t *cek, jose_io_t *next)
Decrypts ciphertext with the CEK using streaming.
jose_jwe_dec_cek
void * jose_jwe_dec_cek(jose_cfg_t *cfg, const json_t *jwe, const json_t *cek, size_t *ptl)
Decrypts ciphertext with the CEK.
jose_jwe_enc_io
jose_io_t * jose_jwe_enc_io(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk, jose_io_t *next)
Wraps and encrypts plaintext using streaming.
jose_jwe_enc_jwk
bool jose_jwe_enc_jwk(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *jwk, json_t *cek)
Wraps a CEK with a JWK.
jose_jwe_hdr
json_t * jose_jwe_hdr(const json_t *jwe, const json_t *rcp)
Merges the JOSE headers of a JWE object and a JWE recpient object.