#ifndef RIGHTS_H
#define RIGHTS_H
#include "porting/video_output.h"
#include "sa_types.h"
#ifdef __cplusplus
#include <cstdbool>
#include <cstddef>
#include <cstdint>
extern "C" {
#else
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#endif
#define UUID_LENGTH 36
typedef enum {
TYPEJ_DATA_AND_KEY = 0,
DATA_ONLY = 1,
KEY_ONLY = 2,
SOC_DATA_AND_KEY = 3
} key_usage;
typedef enum {
PRIVATE_SUBTYPE = 0,
AES_SUBTYPE,
HMAC_SUBTYPE,
CHACHA20_SUBTYPE
} key_subtype;
extern const sa_uuid NO_MATCH;
extern const sa_uuid ALL_MATCH;
bool rights_validate_format(const sa_rights* rights);
bool rights_allowed_derive(const sa_rights* rights);
bool rights_allowed_exchange(const sa_rights* rights);
bool rights_allowed_unwrap(const sa_rights* rights);
bool rights_allowed_decrypt(
const sa_rights* rights,
sa_key_type key_type);
bool rights_allowed_encrypt(
const sa_rights* rights,
sa_key_type key_type);
bool rights_allowed_clear(const sa_rights* rights);
bool rights_allowed_sign(const sa_rights* rights);
bool rights_allowed_time(
const sa_rights* rights,
uint64_t time);
bool rights_allowed_video_output_state(
const sa_rights* rights,
const video_output_state_t* video_output_state);
bool rights_allowed_uuid(
const sa_rights* rights,
const sa_uuid* caller_uuid);
sa_status key_usage_to_usage_flags(
uint64_t* usage_flags,
int64_t key_usage,
sa_key_type key_type,
key_subtype subtype);
bool convert_uuid(
const char* uuid_str,
size_t uuid_str_length,
sa_uuid* uuid);
#ifdef __cplusplus
}
#endif
#endif