You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
866 B
C
48 lines
866 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct crypto_keys;
|
|
|
|
struct ap_envelope;
|
|
struct http_signature
|
|
{
|
|
struct
|
|
{
|
|
const char* method;
|
|
const char* url;
|
|
const char* post_data;
|
|
} input;
|
|
|
|
char* host;
|
|
char* date;
|
|
char* signature;
|
|
char* digest;
|
|
int content_length;
|
|
};
|
|
|
|
struct hsv_result
|
|
{
|
|
bool pass;
|
|
int error;
|
|
};
|
|
enum {
|
|
HSV_NO_ERROR = 0,
|
|
HSV_NO_HEADER = 1,
|
|
HSV_NO_SIGNATURE = 2,
|
|
HSV_NO_HEADERS = 3,
|
|
HSV_NO_KEY_ID = 4,
|
|
HSV_NO_PUBKEY = 5,
|
|
HSV_MISSING_ACTOR = 6,
|
|
HSV_ACTOR_MISMATCH = 7,
|
|
HSV_NO_ACCOUNT = 8,
|
|
HSV_DIGEST_FAILED = 9,
|
|
HSV_INVALID_SIGNATURE = 10,
|
|
HSV_UNKNOWN = 99999,
|
|
};
|
|
|
|
bool http_signature_make( struct crypto_keys* keys, struct http_signature* sign );
|
|
void http_signature_free( struct http_signature* sign );
|
|
struct hsv_result http_signature_validate( struct ap_envelope* env, const char* request_target, const char* expected_actor );
|
|
|