actube/src/cw/dtls_gnutls_get_peers_cert.c

29 lines
524 B
C
Raw Normal View History

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "conn.h"
/*#include "dtls.h"*/
#include "dtls_common.h"
#include "dtls_gnutls.h"
struct dtls_ssl_cert dtls_gnutls_get_peers_cert(struct conn * conn,unsigned int n)
{
struct dtls_gnutls_data *d;
const gnutls_datum_t * clist;
struct dtls_ssl_cert cert;
unsigned int len;
d=(struct dtls_gnutls_data*)conn->dtls_data;
clist = gnutls_certificate_get_peers(d->session,&len);
cert.size = clist[n].size;
cert.data= clist[n].data;
return cert;
}