Strophe  0.9
XMPP client library
Data Structures | Functions | Variables
crypto.c File Reference

Public interface for digests and encodings used in XEPs. More...

Data Structures

struct  xmpp_sha1_t
 

Functions

static char * digest_to_string (const uint8_t *digest, char *s, size_t len)
 
static char * digest_to_string_alloc (xmpp_ctx_t *ctx, const uint8_t *digest)
 
char * xmpp_sha1 (xmpp_ctx_t *ctx, const unsigned char *data, size_t len)
 Compute SHA1 message digest. More...
 
void xmpp_sha1_digest (const unsigned char *data, size_t len, unsigned char *digest)
 Compute SHA1 message digest. More...
 
xmpp_sha1_t * xmpp_sha1_new (xmpp_ctx_t *ctx)
 Create new SHA1 object. More...
 
void xmpp_sha1_free (xmpp_sha1_t *sha1)
 Destroy SHA1 object. More...
 
void xmpp_sha1_update (xmpp_sha1_t *sha1, const unsigned char *data, size_t len)
 Update SHA1 context with the next portion of data. More...
 
void xmpp_sha1_final (xmpp_sha1_t *sha1)
 Finish SHA1 computation. More...
 
char * xmpp_sha1_to_string (xmpp_sha1_t *sha1, char *s, size_t slen)
 Return message digest rendered as a string. More...
 
char * xmpp_sha1_to_string_alloc (xmpp_sha1_t *sha1)
 Return message digest rendered as a string. More...
 
void xmpp_sha1_to_digest (xmpp_sha1_t *sha1, unsigned char *digest)
 Stores message digest to a user's buffer. More...
 
static size_t base64_encoded_len (const size_t len)
 
static char * base64_encode (xmpp_ctx_t *ctx, const unsigned char *const buffer, const size_t len)
 
static size_t base64_decoded_len (const char *const buffer, const size_t len)
 
static void base64_decode (xmpp_ctx_t *ctx, const char *const buffer, const size_t len, unsigned char **out, size_t *outlen)
 
char * xmpp_base64_encode (xmpp_ctx_t *ctx, const unsigned char *data, size_t len)
 Base64 encoding routine. More...
 
char * xmpp_base64_decode_str (xmpp_ctx_t *ctx, const char *base64, size_t len)
 Base64 decoding routine. More...
 
void xmpp_base64_decode_bin (xmpp_ctx_t *ctx, const char *base64, size_t len, unsigned char **out, size_t *outlen)
 Base64 decoding routine. More...
 

Variables

static const unsigned char _base64_invcharmap [256]
 
static const char _base64_charmap [65]
 

Detailed Description

Public interface for digests and encodings used in XEPs.

Function Documentation

◆ digest_to_string()

static char* digest_to_string ( const uint8_t *  digest,
char *  s,
size_t  len 
)
static

◆ digest_to_string_alloc()

static char* digest_to_string_alloc ( xmpp_ctx_t *  ctx,
const uint8_t *  digest 
)
static

◆ base64_encoded_len()

static size_t base64_encoded_len ( const size_t  len)
static

◆ base64_encode()

static char* base64_encode ( xmpp_ctx_t *  ctx,
const unsigned char *const  buffer,
const size_t  len 
)
static

◆ base64_decoded_len()

static size_t base64_decoded_len ( const char *const  buffer,
const size_t  len 
)
static

◆ base64_decode()

static void base64_decode ( xmpp_ctx_t *  ctx,
const char *const  buffer,
const size_t  len,
unsigned char **  out,
size_t *  outlen 
)
static

Variable Documentation

◆ _base64_invcharmap

const unsigned char _base64_invcharmap[256]
static
Initial value:
= {
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,62, 65,65,65,63,
52,53,54,55, 56,57,58,59, 60,61,65,65, 65,64,65,65,
65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
15,16,17,18, 19,20,21,22, 23,24,25,65, 65,65,65,65,
65,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
41,42,43,44, 45,46,47,48, 49,50,51,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65,
65,65,65,65, 65,65,65,65, 65,65,65,65, 65,65,65,65
}

◆ _base64_charmap

const char _base64_charmap[65]
static
Initial value:
= {
'A','B','C','D', 'E','F','G','H',
'I','J','K','L', 'M','N','O','P',
'Q','R','S','T', 'U','V','W','X',
'Y','Z','a','b', 'c','d','e','f',
'g','h','i','j', 'k','l','m','n',
'o','p','q','r', 's','t','u','v',
'w','x','y','z', '0','1','2','3',
'4','5','6','7', '8','9','+','/',
'='
}