forked from dirkx/makerspaceleiden-payment-node-7segments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselfsign.h
More file actions
17 lines (12 loc) · 685 Bytes
/
selfsign.h
File metadata and controls
17 lines (12 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef _H_SELFSIGN
#define _H_SELFSIGN
#include <mbedtls/pk.h>
#include <mbedtls/x509_crt.h>
char * der2pem(const char *what, unsigned char * der, size_t derlen);
int pem2der(unsigned char * buff);
char * sha256toHEX(unsigned char sha256[256 / 8], char buff[256 / 4 + 1]);
int populate_self_signed(mbedtls_pk_context * key, const char * CN_or_full_DN, mbedtls_x509write_cert * crt);
int sign_and_topem(mbedtls_pk_context * key, mbedtls_x509write_cert * crt, char ** out_cert_as_pem, char ** out_key_as_pem);
int fingerprint_from_certpubkey(const mbedtls_x509_crt * crt, unsigned char sha256[256/8]);
int fingerprint_from_pem(char * buff, unsigned char sha256[256 / 8]);
#endif