pem.h File Reference
#include "orconfig.h"
#include <stddef.h>
#include "lib/cc/torint.h"

Go to the source code of this file.


size_t pem_encoded_size (size_t src_len, const char *objtype)
int pem_encode (char *dest, size_t destlen, const uint8_t *src, size_t srclen, const char *objtype)
int pem_decode (uint8_t *dest, size_t destlen, const char *src, size_t srclen, const char *objtype)

Detailed Description

Header for pem.c.

Definition in file pem.h.

Function Documentation

◆ pem_decode()

int pem_decode ( uint8_t *  dest,
size_t  destlen,
const char *  src,
size_t  srclen,
const char *  objtype 

Given a PEM-encoded block of size srclen in src, if it has object type objtype, decode it into the destlen-byte buffer at dest. Return the number of characters decoded on success, or -1 on failure.

Definition at line 80 of file pem.c.

References eat_whitespace_eos().

◆ pem_encode()

int pem_encode ( char *  dest,
size_t  destlen,
const uint8_t *  src,
size_t  srclen,
const char *  objtype 

PEM-encode the srclen-byte object at src into the destlen< >-byte buffer at dest, tagging it with objtype. Return 0 on success and -1 on failure.

Definition at line 49 of file pem.c.

References base64_encode(), and tor_snprintf().

◆ pem_encoded_size()

size_t pem_encoded_size ( size_t  src_len,
const char *  objtype 

Return the length of a src_len-byte object when tagged with objtype and PEM-encoded. Includes terminating NUL.

Definition at line 33 of file pem.c.

References base64_encode_size().