Apache2
JSON Object Signing and Encryption

Data Structures

struct  apr_jose_data_t
 
struct  apr_jose_text_t
 
struct  apr_jose_json_t
 
struct  apr_jose_jwk_t
 
struct  apr_jose_jwks_t
 
struct  apr_jose_signature_t
 
struct  apr_jose_jws_t
 
struct  apr_jose_encryption_t
 
struct  apr_jose_recipient_t
 
struct  apr_jose_jwe_t
 
struct  apr_jose_jwt_t
 
struct  apr_jose_t
 
struct  apr_jose_cb_t
 

Macros

#define APR_JOSE_JWA_HS256   "HS256"
 
#define APR_JOSE_JWA_HS384   "HS384"
 
#define APR_JOSE_JWA_HS512   "HS512"
 
#define APR_JOSE_JWA_RS256   "RS256"
 
#define APR_JOSE_JWA_RS384   "RS384"
 
#define APR_JOSE_JWA_RS512   "RS512"
 
#define APR_JOSE_JWA_ES256   "ES256"
 
#define APR_JOSE_JWA_ES384   "ES384"
 
#define APR_JOSE_JWA_ES512   "ES512"
 
#define APR_JOSE_JWA_PS256   "PS256"
 
#define APR_JOSE_JWA_PS384   "PS384"
 
#define APR_JOSE_JWA_PS512   "PS512"
 
#define APR_JOSE_JWA_NONE   "none"
 
#define APR_JOSE_JWK_KEY_TYPE   "kty"
 
#define APR_JOSE_JWK_PUBLIC_KEY_USE   "use"
 
#define APR_JOSE_JWK_KEY_OPERATIONS   "key_ops"
 
#define APR_JOSE_JWK_KEYS   "keys"
 
#define APR_JOSE_JWKSE_ALGORITHM   "alg"
 
#define APR_JOSE_JWE_ENCRYPTION   "enc"
 
#define APR_JOSE_JWE_COMPRESSION   "zip"
 
#define APR_JOSE_JWSE_JWK_SET_URL   "jku"
 
#define APR_JOSE_JWSE_JWK   "jwk"
 
#define APR_JOSE_JWKSE_KEYID   "kid"
 
#define APR_JOSE_JWKSE_X509_URL   "x5u"
 
#define APR_JOSE_JWKSE_X509_CHAIN   "x5c"
 
#define APR_JOSE_JWKSE_X509_SHA1_THUMBPRINT   "x5t"
 
#define APR_JOSE_JWKSE_X509_SHA256_THUMBPRINT   "x5t#S256"
 
#define APR_JOSE_JWSE_TYPE   "typ"
 
#define APR_JOSE_JWSE_CONTENT_TYPE   "cty"
 
#define APR_JOSE_JWSE_CRITICAL   "crit"
 
#define APR_JOSE_JWS_PAYLOAD   "payload"
 
#define APR_JOSE_JWS_SIGNATURES   "signatures"
 
#define APR_JOSE_JWSE_PROTECTED   "protected"
 
#define APR_JOSE_JWSE_HEADER   "header"
 
#define APR_JOSE_JWS_SIGNATURE   "signature"
 
#define APR_JOSE_JWE_UNPROTECTED   "unprotected"
 
#define APR_JOSE_JWE_CIPHERTEXT   "ciphertext"
 
#define APR_JOSE_JWE_RECIPIENTS   "recipients"
 
#define APR_JOSE_JWE_EKEY   "encrypted_key"
 
#define APR_JOSE_JWE_IV   "iv"
 
#define APR_JOSE_JWE_TAG   "tag"
 
#define APR_JOSE_JWE_AAD   "aad"
 
#define APR_JOSE_JWT_ISSUER   "iss"
 
#define APR_JOSE_JWT_SUBJECT   "sub"
 
#define APR_JOSE_JWT_AUDIENCE   "aud"
 
#define APR_JOSE_JWT_EXPIRATION_TIME   "exp"
 
#define APR_JOSE_JWT_NOT_BEFORE   "nbf"
 
#define APR_JOSE_JWT_ISSUED_AT   "iat"
 
#define APR_JOSE_JWT_ID   "jti"
 
#define APR_JOSE_JWSE_TYPE_JWT   "JWT"
 
#define APR_JOSE_FLAG_NONE   0
 
#define APR_JOSE_FLAG_DECODE_ALL   1
 
#define APR_JOSE_FLAG_BREAK   2
 

Typedefs

typedef struct apr_jose_t apr_jose_t
 
typedef enum apr_jose_type_e apr_jose_type_e
 
typedef struct apr_jose_data_t apr_jose_data_t
 
typedef struct apr_jose_text_t apr_jose_text_t
 
typedef struct apr_jose_json_t apr_jose_json_t
 
typedef struct apr_jose_jwk_t apr_jose_jwk_t
 
typedef struct apr_jose_jwks_t apr_jose_jwks_t
 
typedef struct apr_jose_signature_t apr_jose_signature_t
 
typedef struct apr_jose_jws_t apr_jose_jws_t
 
typedef struct apr_jose_encryption_t apr_jose_encryption_t
 
typedef struct apr_jose_recipient_t apr_jose_recipient_t
 
typedef struct apr_jose_jwe_t apr_jose_jwe_t
 
typedef struct apr_jose_jwt_t apr_jose_jwt_t
 
typedef struct apr_jose_cb_t apr_jose_cb_t
 

Enumerations

enum  apr_jose_type_e {
  APR_JOSE_TYPE_NONE = 0 , APR_JOSE_TYPE_JWK = 1 , APR_JOSE_TYPE_JWKS , APR_JOSE_TYPE_JWS ,
  APR_JOSE_TYPE_JWS_JSON , APR_JOSE_TYPE_JWE , APR_JOSE_TYPE_JWE_JSON , APR_JOSE_TYPE_JWT ,
  APR_JOSE_TYPE_DATA , APR_JOSE_TYPE_TEXT , APR_JOSE_TYPE_JSON
}
 

Functions

apu_err_tapr_jose_error (apr_jose_t *jose) __attribute__((nonnull(1)))
 Get the result of the last operation on the jose. If the result is NULL, the operation was successful. More...
 
apr_jose_tapr_jose_make (apr_jose_t *jose, apr_jose_type_e type, apr_pool_t *pool) __attribute__((nonnull(3)))
 
apr_jose_tapr_jose_jwk_make (apr_jose_t *jose, apr_json_value_t *key, apr_pool_t *pool) __attribute__((nonnull(3)))
 
apr_jose_tapr_jose_jwks_make (apr_jose_t *jose, apr_json_value_t *keys, apr_pool_t *pool) __attribute__((nonnull(3)))
 
apr_jose_signature_tapr_jose_signature_make (apr_jose_signature_t *signature, apr_json_value_t *header, apr_json_value_t *protected, void *ctx, apr_pool_t *pool) __attribute__((nonnull(5)))
 
apr_jose_recipient_tapr_jose_recipient_make (apr_jose_recipient_t *recipient, apr_json_value_t *unprotected, void *ctx, apr_pool_t *pool) __attribute__((nonnull(4)))
 
apr_jose_encryption_tapr_jose_encryption_make (apr_jose_encryption_t *encryption, apr_json_value_t *unprotected, apr_json_value_t *protected, apr_pool_t *pool) __attribute__((nonnull(4)))
 
apr_jose_tapr_jose_jwe_make (apr_jose_t *jose, apr_jose_recipient_t *recipient, apr_array_header_t *recipients, apr_jose_encryption_t *encryption, apr_jose_t *payload, apr_pool_t *pool) __attribute__((nonnull(6)))
 
apr_jose_tapr_jose_jwe_json_make (apr_jose_t *jose, apr_jose_recipient_t *recipient, apr_array_header_t *recipients, apr_jose_encryption_t *encryption, apr_jose_t *payload, apr_pool_t *pool) __attribute__((nonnull(6)))
 
apr_jose_tapr_jose_jws_make (apr_jose_t *jose, apr_jose_signature_t *signature, apr_array_header_t *signatures, apr_jose_t *payload, apr_pool_t *pool) __attribute__((nonnull(5)))
 
apr_jose_tapr_jose_jws_json_make (apr_jose_t *jose, apr_jose_signature_t *signature, apr_array_header_t *signatures, apr_jose_t *payload, apr_pool_t *pool) __attribute__((nonnull(5)))
 
apr_jose_tapr_jose_jwt_make (apr_jose_t *jose, apr_json_value_t *claims, apr_pool_t *pool) __attribute__((nonnull(3)))
 
apr_jose_tapr_jose_data_make (apr_jose_t *jose, const char *typ, const unsigned char *in, apr_size_t inlen, apr_pool_t *pool) __attribute__((nonnull(5)))
 
apr_jose_tapr_jose_text_make (apr_jose_t *jose, const char *cty, const char *in, apr_size_t inlen, apr_pool_t *pool) __attribute__((nonnull(5)))
 
apr_jose_tapr_jose_json_make (apr_jose_t *jose, const char *cty, apr_json_value_t *json, apr_pool_t *pool) __attribute__((nonnull(4)))
 
apr_status_t apr_jose_encode (apr_bucket_brigade *brigade, apr_brigade_flush flush, void *ctx, apr_jose_t *jose, apr_jose_cb_t *cb, apr_pool_t *pool) __attribute__((nonnull(1
 
apr_status_t apr_status_t apr_jose_decode (apr_jose_t **jose, const char *typ, apr_bucket_brigade *brigade, apr_jose_cb_t *cb, int level, int flags, apr_pool_t *pool) __attribute__((nonnull(1
 

Detailed Description

The JOSE (JSON Object Signing and Encryption) library allows the encoding and decoding of JWS (JSON Web Signature), JWE (JSON Web Encryption), JWK (JSON Web Key) and JWT (JSON Web Token) objects, encoded using compact encoding, JSON encoding, or flattened JSON encoding.

The following RFCs are supported:

Encryption, decryption, signing and verification are implemented as callbacks to the caller's specification, and are not included.

When decrypting or verifying, the caller MUST verify that the 'alg' algorithm parameter in the JOSE message matches the algorithm expected by the implementation.

It is recommended that the apr_crypto library be used to implement the callbacks, however an alternatively crypto library of the caller's choice may be used instead.

Macro Definition Documentation

◆ APR_JOSE_FLAG_BREAK

#define APR_JOSE_FLAG_BREAK   2

When verifying or decrypting, break out of processing.

If the verification or decryption failed, processing will be aborted with the given error.

If the verification or decryption succeeded, processing will be considered successful and will move on to the nested structure.

◆ APR_JOSE_FLAG_DECODE_ALL

#define APR_JOSE_FLAG_DECODE_ALL   1

Return the full JOSE structure, instead of innermost nested structure.

◆ APR_JOSE_FLAG_NONE

#define APR_JOSE_FLAG_NONE   0

Default options.

◆ APR_JOSE_JWA_ES256

#define APR_JOSE_JWA_ES256   "ES256"

ECDSA using P-256 and SHA-256

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_ES384

#define APR_JOSE_JWA_ES384   "ES384"

ECDSA using P-384 and SHA-384

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_ES512

#define APR_JOSE_JWA_ES512   "ES512"

ECDSA using P-512 and SHA-512

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_HS256

#define APR_JOSE_JWA_HS256   "HS256"

◆ APR_JOSE_JWA_HS384

#define APR_JOSE_JWA_HS384   "HS384"

◆ APR_JOSE_JWA_HS512

#define APR_JOSE_JWA_HS512   "HS512"

◆ APR_JOSE_JWA_NONE

#define APR_JOSE_JWA_NONE   "none"

No digital signature or MAC performed

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_PS256

#define APR_JOSE_JWA_PS256   "PS256"

RSASSA-PSS using SHA-256 and MGF1 with SHA-256

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_PS384

#define APR_JOSE_JWA_PS384   "PS384"

RSASSA-PSS using SHA-384 and MGF1 with SHA-384

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_PS512

#define APR_JOSE_JWA_PS512   "PS512"

RSASSA-PSS using SHA-512 and MGF1 with SHA-512

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_RS256

#define APR_JOSE_JWA_RS256   "RS256"

RSASSA-PKCS1-v1_5 using SHA-256

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_RS384

#define APR_JOSE_JWA_RS384   "RS384"

RSASSA-PKCS1-v1_5 using SHA-384

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWA_RS512

#define APR_JOSE_JWA_RS512   "RS512"

RSASSA-PKCS1-v1_5 using SHA-512

https://tools.ietf.org/html/rfc7518#section-3.1

◆ APR_JOSE_JWE_AAD

#define APR_JOSE_JWE_AAD   "aad"

◆ APR_JOSE_JWE_CIPHERTEXT

#define APR_JOSE_JWE_CIPHERTEXT   "ciphertext"

◆ APR_JOSE_JWE_COMPRESSION

#define APR_JOSE_JWE_COMPRESSION   "zip"

"zip" (Compression Algorithm) Header Parameter

https://tools.ietf.org/html/rfc7516#section-4.1.3

◆ APR_JOSE_JWE_EKEY

#define APR_JOSE_JWE_EKEY   "encrypted_key"

◆ APR_JOSE_JWE_ENCRYPTION

#define APR_JOSE_JWE_ENCRYPTION   "enc"

"enc" (Encryption Algorithm) Header Parameter

https://tools.ietf.org/html/rfc7516#section-4.1.2

◆ APR_JOSE_JWE_IV

#define APR_JOSE_JWE_IV   "iv"

◆ APR_JOSE_JWE_RECIPIENTS

#define APR_JOSE_JWE_RECIPIENTS   "recipients"

◆ APR_JOSE_JWE_TAG

#define APR_JOSE_JWE_TAG   "tag"

◆ APR_JOSE_JWE_UNPROTECTED

#define APR_JOSE_JWE_UNPROTECTED   "unprotected"

◆ APR_JOSE_JWK_KEY_OPERATIONS

#define APR_JOSE_JWK_KEY_OPERATIONS   "key_ops"

"key_ops" (Key Operations) Parameter

https://tools.ietf.org/html/rfc7517#section-4.3

◆ APR_JOSE_JWK_KEY_TYPE

#define APR_JOSE_JWK_KEY_TYPE   "kty"

◆ APR_JOSE_JWK_KEYS

#define APR_JOSE_JWK_KEYS   "keys"

◆ APR_JOSE_JWK_PUBLIC_KEY_USE

#define APR_JOSE_JWK_PUBLIC_KEY_USE   "use"

"use" (Public Key Use) Parameter

https://tools.ietf.org/html/rfc7517#section-4.2

◆ APR_JOSE_JWKSE_ALGORITHM

◆ APR_JOSE_JWKSE_KEYID

#define APR_JOSE_JWKSE_KEYID   "kid"

◆ APR_JOSE_JWKSE_X509_CHAIN

#define APR_JOSE_JWKSE_X509_CHAIN   "x5c"

◆ APR_JOSE_JWKSE_X509_SHA1_THUMBPRINT

#define APR_JOSE_JWKSE_X509_SHA1_THUMBPRINT   "x5t"

◆ APR_JOSE_JWKSE_X509_SHA256_THUMBPRINT

#define APR_JOSE_JWKSE_X509_SHA256_THUMBPRINT   "x5t#S256"

"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter

https://tools.ietf.org/html/rfc7515#section-4.1.8 https://tools.ietf.org/html/rfc7516#section-4.1.10

◆ APR_JOSE_JWKSE_X509_URL

#define APR_JOSE_JWKSE_X509_URL   "x5u"

◆ APR_JOSE_JWS_PAYLOAD

#define APR_JOSE_JWS_PAYLOAD   "payload"

◆ APR_JOSE_JWS_SIGNATURE

#define APR_JOSE_JWS_SIGNATURE   "signature"

◆ APR_JOSE_JWS_SIGNATURES

#define APR_JOSE_JWS_SIGNATURES   "signatures"

◆ APR_JOSE_JWSE_CONTENT_TYPE

#define APR_JOSE_JWSE_CONTENT_TYPE   "cty"

◆ APR_JOSE_JWSE_CRITICAL

#define APR_JOSE_JWSE_CRITICAL   "crit"

◆ APR_JOSE_JWSE_HEADER

◆ APR_JOSE_JWSE_JWK

#define APR_JOSE_JWSE_JWK   "jwk"

◆ APR_JOSE_JWSE_JWK_SET_URL

#define APR_JOSE_JWSE_JWK_SET_URL   "jku"

◆ APR_JOSE_JWSE_PROTECTED

#define APR_JOSE_JWSE_PROTECTED   "protected"

◆ APR_JOSE_JWSE_TYPE

#define APR_JOSE_JWSE_TYPE   "typ"

◆ APR_JOSE_JWSE_TYPE_JWT

#define APR_JOSE_JWSE_TYPE_JWT   "JWT"

"typ" (Type) Header Parameter representing a JWT

https://tools.ietf.org/html/rfc7519#section-5.1

◆ APR_JOSE_JWT_AUDIENCE

#define APR_JOSE_JWT_AUDIENCE   "aud"

◆ APR_JOSE_JWT_EXPIRATION_TIME

#define APR_JOSE_JWT_EXPIRATION_TIME   "exp"

◆ APR_JOSE_JWT_ID

#define APR_JOSE_JWT_ID   "jti"

◆ APR_JOSE_JWT_ISSUED_AT

#define APR_JOSE_JWT_ISSUED_AT   "iat"

◆ APR_JOSE_JWT_ISSUER

#define APR_JOSE_JWT_ISSUER   "iss"

◆ APR_JOSE_JWT_NOT_BEFORE

#define APR_JOSE_JWT_NOT_BEFORE   "nbf"

◆ APR_JOSE_JWT_SUBJECT

#define APR_JOSE_JWT_SUBJECT   "sub"

Typedef Documentation

◆ apr_jose_cb_t

typedef struct apr_jose_cb_t apr_jose_cb_t

Callbacks for encryption, decryption, signing and verifying.

◆ apr_jose_data_t

Unsigned char data of a given length

◆ apr_jose_encryption_t

An encrypted payload within a a JSON web encryption.

◆ apr_jose_json_t

JSON object

◆ apr_jose_jwe_t

A JSON web encryption

◆ apr_jose_jwk_t

A JSON web key

◆ apr_jose_jwks_t

A JSON web key set

◆ apr_jose_jws_t

A JSON web signature

◆ apr_jose_jwt_t

A JSON web token

◆ apr_jose_recipient_t

A single recipient within a a JSON web encryption.

◆ apr_jose_signature_t

A single signature within a a JSON web signature.

◆ apr_jose_t

typedef struct apr_jose_t apr_jose_t

Forward declaration of the apr_jose_t structure.

◆ apr_jose_text_t

Signed char data of a given length

◆ apr_jose_type_e

Enum that represents the type of JOSE object.

Enumeration Type Documentation

◆ apr_jose_type_e

Enum that represents the type of JOSE object.

Enumerator
APR_JOSE_TYPE_NONE 

No specific type.

APR_JOSE_TYPE_JWK 

JSON Web Key (JWK)

APR_JOSE_TYPE_JWKS 

JSON Web Key Set (JWKS)

APR_JOSE_TYPE_JWS 

JSON Web Signature (JWS) - compact encoding

APR_JOSE_TYPE_JWS_JSON 

JSON Web Signature (JWS) - JSON encoding

APR_JOSE_TYPE_JWE 

JSON Web Encryption (JWE) - compact encoding

APR_JOSE_TYPE_JWE_JSON 

JSON Web Encryption (JWE) - JSON encoding

APR_JOSE_TYPE_JWT 

JSON Web Token (JWT)

APR_JOSE_TYPE_DATA 

Generic binary data

APR_JOSE_TYPE_TEXT 

Generic text data

APR_JOSE_TYPE_JSON 

Generic JSON structure

Function Documentation

◆ apr_jose_data_make()

apr_jose_t* apr_jose_data_make ( apr_jose_t jose,
const char *  typ,
const unsigned char *  in,
apr_size_t  inlen,
apr_pool_t pool 
)

Make a data buffer for encoding from the given data and length.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
typthe content type of this data.
inthe plaintext to sign.
inlenlength of the plaintext.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_decode()

apr_status_t apr_status_t apr_jose_decode ( apr_jose_t **  jose,
const char *  typ,
apr_bucket_brigade brigade,
apr_jose_cb_t cb,
int  level,
int  flags,
apr_pool_t pool 
)

Decode, decrypt and verify the utf8-encoded JOSE string into apr_jose_t.

The JOSE structure may be nested to the given limit.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
typcontent type of this object.
brigadethe JOSE structure to decode.
cbcallbacks for verify and decrypt.
leveldepth limit of JOSE and JSON nesting.
flagsAPR_JOSE_FLAG_NONE to return payload only. APR_JOSE_FLAG_DECODE_ALL to return the full JWS/JWE structure.
poolpool used to allocate the result from.

◆ apr_jose_encode()

apr_status_t apr_jose_encode ( apr_bucket_brigade brigade,
apr_brigade_flush  flush,
void *  ctx,
apr_jose_t jose,
apr_jose_cb_t cb,
apr_pool_t pool 
)

Sign or encrypt the apr_jose_t, and write it to the brigade.

Parameters
brigadebrigade the result will be appended to.
flushThe flush function to use if the brigade is full
ctxThe structure to pass to the flush function
josethe JOSE to encode.
cbcallbacks for sign and encrypt.
poolpool to be used.
Returns
APR_SUCCESS is returned if encoding was successful, otherwise an APR status code, along with an apu_err_t with an explanation allocated from jose->pool.

◆ apr_jose_encryption_make()

apr_jose_encryption_t* apr_jose_encryption_make ( apr_jose_encryption_t encryption,
apr_json_value_t unprotected,
apr_json_value_t protected,
apr_pool_t pool 
)

Make an encryption structure for JWE.

Parameters
encryptionthe result.
unprotectedthe unprotected shared header.
protectedthe protected header.
poolthe pool to use.
Returns
The apr_jose_encryption_t is returned.

◆ apr_jose_error()

apu_err_t* apr_jose_error ( apr_jose_t jose)

Get the result of the last operation on the jose. If the result is NULL, the operation was successful.

Parameters
jose- context pointer
Returns
The apu_err_t is returned.

◆ apr_jose_json_make()

apr_jose_t* apr_jose_json_make ( apr_jose_t jose,
const char *  cty,
apr_json_value_t json,
apr_pool_t pool 
)

Make a json structure for encoding.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
ctythe content type.
jsonthe json object to add.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jwe_json_make()

apr_jose_t* apr_jose_jwe_json_make ( apr_jose_t jose,
apr_jose_recipient_t recipient,
apr_array_header_t recipients,
apr_jose_encryption_t encryption,
apr_jose_t payload,
apr_pool_t pool 
)

Make a JSON encoded JWE.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
recipientthe recipient for compact / flattened JWE.
recipientsthe recipients array for general JWE.
encryptionthe encryption structure.
payloadthe JOSE payload to encrypt.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jwe_make()

apr_jose_t* apr_jose_jwe_make ( apr_jose_t jose,
apr_jose_recipient_t recipient,
apr_array_header_t recipients,
apr_jose_encryption_t encryption,
apr_jose_t payload,
apr_pool_t pool 
)

Make a compact encoded JWE.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
recipientthe recipient for compact / flattened JWE.
recipientsthe recipients array for general JWE.
encryptionthe encryption structure.
payloadthe JOSE payload to encrypt.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jwk_make()

apr_jose_t* apr_jose_jwk_make ( apr_jose_t jose,
apr_json_value_t key,
apr_pool_t pool 
)

Make a JSON Web Key for encoding or decoding.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
keythe json representing the key. May be NULL.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jwks_make()

apr_jose_t* apr_jose_jwks_make ( apr_jose_t jose,
apr_json_value_t keys,
apr_pool_t pool 
)

Make a JSON Web Key Set.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
keysthe array of keys in JSON format. May be NULL.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jws_json_make()

apr_jose_t* apr_jose_jws_json_make ( apr_jose_t jose,
apr_jose_signature_t signature,
apr_array_header_t signatures,
apr_jose_t payload,
apr_pool_t pool 
)

Make a JSON encoded JWS.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
signaturethe header / protected header / signature used with compact or flattened syntax. May be NULL.
signaturesarray of header / protected header / signature used with general JSON syntax.
payloadthe payload to be wrapped by this JWS.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jws_make()

apr_jose_t* apr_jose_jws_make ( apr_jose_t jose,
apr_jose_signature_t signature,
apr_array_header_t signatures,
apr_jose_t payload,
apr_pool_t pool 
)

Make a compact encoded JWS.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
signaturethe header / protected header / signature used with compact or flattened syntax. May be NULL.
signaturesarray of header / protected header / signature used with general JSON syntax.
payloadthe payload to be wrapped by this JWS.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_jwt_make()

apr_jose_t* apr_jose_jwt_make ( apr_jose_t jose,
apr_json_value_t claims,
apr_pool_t pool 
)

Make a JWT claims payload.

To create a useful JWT, this payload needs to be wrapped in a JWS or JWE (or both), as required by the caller.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
claimsthe claims to sign.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_make()

apr_jose_t* apr_jose_make ( apr_jose_t jose,
apr_jose_type_e  type,
apr_pool_t pool 
)

Make a generic JOSE structure.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
typethe type of structure to create.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.

◆ apr_jose_recipient_make()

apr_jose_recipient_t* apr_jose_recipient_make ( apr_jose_recipient_t recipient,
apr_json_value_t unprotected,
void *  ctx,
apr_pool_t pool 
)

Make a recipient structure for JWE.

Parameters
recipientthe result.
unprotectedthe unprotected header.
ctxuser supplied context
poolthe pool to use.
Returns
The apr_jose_recipient_t is returned.

◆ apr_jose_signature_make()

apr_jose_signature_t* apr_jose_signature_make ( apr_jose_signature_t signature,
apr_json_value_t header,
apr_json_value_t protected,
void *  ctx,
apr_pool_t pool 
)

Make a signature structure for JWS.

Parameters
signaturethe result.
headerthe unprotected header.
protectedthe protected header.
ctxuser supplied context
poolthe pool to use.
Returns
The apr_jose_signature_t is returned.

◆ apr_jose_text_make()

apr_jose_t* apr_jose_text_make ( apr_jose_t jose,
const char *  cty,
const char *  in,
apr_size_t  inlen,
apr_pool_t pool 
)

Make a UTF-8 text buffer for encoding from the given string and length.

Parameters
joseIf jose points at NULL, a JOSE structure will be created. If the jose pointer is not NULL, the structure will be reused.
ctythe content type.
inthe UTF-8 encoded text string.
inlenlength of the UTF-8 encoded text string.
poolpool used to allocate the result from.
Returns
The apr_jose_t is returned.