l8w8jwt
Loading...
Searching...
No Matches
encode.h
Go to the documentation of this file.
1/*
2 Copyright 2020 Raphael Beck
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
23#ifndef L8W8JWT_ENCODE_H
24#define L8W8JWT_ENCODE_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include "algs.h"
31#include "claim.h"
32#include "version.h"
33#include "retcodes.h"
34#include "timehelper.h"
35#include <stddef.h>
36
37#ifndef L8W8JWT_MAX_KEY_SIZE
38#define L8W8JWT_MAX_KEY_SIZE 8192
39#endif
40
44L8W8JWT_API struct l8w8jwt_encoding_params
45{
50 int alg;
51
56 char* iss;
57
61 size_t iss_length;
62
67 char* sub;
68
72 size_t sub_length;
73
79 char* aud;
80
84 size_t aud_length;
85
90 char* jti;
91
95 size_t jti_length;
96
103 l8w8jwt_time_t exp;
104
111 l8w8jwt_time_t nbf;
112
119 l8w8jwt_time_t iat;
120
127
132
139
144
149 unsigned char* secret_key;
150
155
161 unsigned char* secret_key_pw;
162
167
172 char** out;
173
177 size_t* out_length;
178};
179
185
192
200L8W8JWT_API int l8w8jwt_encode(struct l8w8jwt_encoding_params* params);
201
202#ifdef __cplusplus
203} // extern "C"
204#endif
205
206#endif // L8W8JWT_ENCODE_H
JWT algorithms as defined in https://tools.ietf.org/html/rfc7518#section-3.1.
JWT claims as described in https://auth0.com/docs/tokens/concepts/jwt-claims.
L8W8JWT_API int l8w8jwt_validate_encoding_params(struct l8w8jwt_encoding_params *params)
L8W8JWT_API void l8w8jwt_encoding_params_init(struct l8w8jwt_encoding_params *params)
L8W8JWT_API int l8w8jwt_encode(struct l8w8jwt_encoding_params *params)
Macros for possible integer codes returned by the various l8w8jwt functions.
Definition claim.h:83
Definition encode.h:45
size_t jti_length
Definition encode.h:95
size_t * out_length
Definition encode.h:177
l8w8jwt_time_t exp
Definition encode.h:103
size_t additional_payload_claims_count
Definition encode.h:143
size_t aud_length
Definition encode.h:84
unsigned char * secret_key
Definition encode.h:149
char * sub
Definition encode.h:67
int alg
Definition encode.h:50
size_t secret_key_pw_length
Definition encode.h:166
size_t secret_key_length
Definition encode.h:154
size_t additional_header_claims_count
Definition encode.h:131
char * aud
Definition encode.h:79
struct l8w8jwt_claim * additional_header_claims
Definition encode.h:126
unsigned char * secret_key_pw
Definition encode.h:161
size_t sub_length
Definition encode.h:72
size_t iss_length
Definition encode.h:61
l8w8jwt_time_t nbf
Definition encode.h:111
char * iss
Definition encode.h:56
struct l8w8jwt_claim * additional_payload_claims
Definition encode.h:138
char * jti
Definition encode.h:90
l8w8jwt_time_t iat
Definition encode.h:119
char ** out
Definition encode.h:172
l8w8jwt version checking.