Skip to content

Commit

Permalink
Update: Support AES keywrap and AES-CBC-HMAC-SHA2
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxwolf authored Jul 22, 2016
2 parents eb4d7f6 + b043985 commit b751879
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 13 deletions.
10 changes: 10 additions & 0 deletions include/cjose/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ extern const char *CJOSE_HDR_KID;
/** The JWE algorithm attribute value for RSA-OAEP. */
extern const char *CJOSE_HDR_ALG_RSA_OAEP;

/** The JWE algorithm attribute value for A128KW, A192KW and A256KW. */
extern const char *CJOSE_HDR_ALG_A128KW;
extern const char *CJOSE_HDR_ALG_A192KW;
extern const char *CJOSE_HDR_ALG_A256KW;

/** The JWS algorithm attribute value for PS256, PS384 and PS512. */
extern const char *CJOSE_HDR_ALG_PS256;
extern const char *CJOSE_HDR_ALG_PS384;
Expand All @@ -66,6 +71,11 @@ extern const char *CJOSE_HDR_ALG_DIR;
/** The JWE content encryption algorithm value for A256GCM. */
extern const char *CJOSE_HDR_ENC_A256GCM;

/** The JWE content encryption algorithm value for A128CBC-HS256, A192CBC-HS384 and A256CBC-HS512. */
extern const char *CJOSE_HDR_ENC_A128CBC_HS256;
extern const char *CJOSE_HDR_ENC_A192CBC_HS384;
extern const char *CJOSE_HDR_ENC_A256CBC_HS512;


/**
* An instance of a header object (used when creating JWE/JWS objects).
Expand Down
13 changes: 13 additions & 0 deletions include/cjose/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define CJOSE_UTIL_H

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C"
Expand Down Expand Up @@ -80,6 +81,18 @@ cjose_realloc_fn_t cjose_get_realloc();
*/
cjose_dealloc_fn_t cjose_get_dealloc();

/**
* Compares the first n bytes of the memory areas s1 and s2 in constant time.
*
* \returns an integer less than, equal to, or
* greater than zero if the first n bytes of s1 is found, respectively, to
* be less than, to match, or be greater than the first n bytes of s2
*/
int cjose_const_memcmp(
const uint8_t *a,
const uint8_t *b,
const size_t size);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

const char *CJOSE_HDR_ALG = "alg";
const char *CJOSE_HDR_ALG_RSA_OAEP = "RSA-OAEP";
const char *CJOSE_HDR_ALG_A128KW = "A128KW";
const char *CJOSE_HDR_ALG_A192KW = "A192KW";
const char *CJOSE_HDR_ALG_A256KW = "A256KW";
const char *CJOSE_HDR_ALG_DIR = "dir";
const char *CJOSE_HDR_ALG_PS256 = "PS256";
const char *CJOSE_HDR_ALG_PS384 = "PS384";
Expand All @@ -30,6 +33,9 @@ const char *CJOSE_HDR_ALG_ES512 = "ES512";

const char *CJOSE_HDR_ENC = "enc";
const char *CJOSE_HDR_ENC_A256GCM = "A256GCM";
const char *CJOSE_HDR_ENC_A128CBC_HS256 = "A128CBC-HS256";
const char *CJOSE_HDR_ENC_A192CBC_HS384 = "A192CBC-HS384";
const char *CJOSE_HDR_ENC_A256CBC_HS512 = "A256CBC-HS512";

const char *CJOSE_HDR_CTY = "cty";

Expand Down
Loading

0 comments on commit b751879

Please sign in to comment.