José: /home/nmccallu/Projects/jose/jose/b64.h Source File

José

b64.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
24 #pragma once
25
26 #include "io.h"
27 #include <jansson.h>
28 #include <stdbool.h>
29 #include <stdint.h>
30
31 #define JOSE_B64_MAP "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
32
47 size_t
48 jose_b64_dec(const json_t *i, void *o, size_t ol);
49
59 jose_io_t *
60 jose_b64_dec_io(jose_io_t *next);
61
77 size_t
78 jose_b64_dec_buf(const void *i, size_t il, void *o, size_t ol);
79
86 json_t *
87 jose_b64_dec_load(const json_t *i);
88
96 json_t *
97 jose_b64_enc(const void *i, size_t il);
98
108 jose_io_t *
109 jose_b64_enc_io(jose_io_t *next);
110
126 size_t
127 jose_b64_enc_buf(const void *i, size_t il, void *o, size_t ol);
128
135 json_t *
136 jose_b64_enc_dump(const json_t *i);
137
jose_b64_enc_buf
size_t jose_b64_enc_buf(const void *i, size_t il, void *o, size_t ol)
Encodes data to a URL-safe Base64 buffer.
jose_b64_enc
json_t * jose_b64_enc(const void *i, size_t il)
Encodes data to a URL-safe Base64 JSON string.
jose_io_t
The interface for chained IO.
Definition: io.h:61
jose_b64_enc_io
jose_io_t * jose_b64_enc_io(jose_io_t *next)
Creates a new IO object which performs URL-safe Base64 encoding.
jose_b64_dec_load
json_t * jose_b64_dec_load(const json_t *i)
Decodes a JSON string from a URL-safe Base64 JSON string.
jose_b64_dec_io
jose_io_t * jose_b64_dec_io(jose_io_t *next)
Creates a new IO object which performs URL-safe Base64 decoding.
jose_b64_enc_dump
json_t * jose_b64_enc_dump(const json_t *i)
Encodes the input JSON as a URL-safe Base64 JSON string.
jose_b64_dec_buf
size_t jose_b64_dec_buf(const void *i, size_t il, void *o, size_t ol)
Decodes a URL-safe Base64 buffer to an output buffer.
jose_b64_dec
size_t jose_b64_dec(const json_t *i, void *o, size_t ol)
Decodes a URL-safe Base64 JSON string to a buffer.