summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/perl/openssl_x509.xs
blob: 008d959c642047ba49e80cdf14554dfe3287d47b (plain)
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
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

#include "openssl.h"

MODULE =  OpenSSL::X509	PACKAGE = OpenSSL::X509	PREFIX = p5_X509_

PROTOTYPES: ENABLE
VERSIONCHECK: DISABLE

void
p5_X509_new(void )
	PREINIT:
		X509 *x509;
		SV *arg;
	PPCODE:
		pr_name("p5_X509_new");
		EXTEND(sp,1);
		PUSHs(sv_newmortal());
		x509=X509_new();
		sv_setref_pv(ST(0),"OpenSSL::X509",(void *)x509);

char *
p5_X509_get_subject_name(x509)
	X509 *x509;
	PREINIT:
		char *p;
		X509_NAME *name;
		char buf[1024];
		int i;
	CODE:
		name=X509_get_subject_name(x509);
		X509_NAME_oneline(name,buf,sizeof(buf));
		p= &(buf[0]);
		RETVAL=p;
	OUTPUT:
		RETVAL

char *
p5_X509_get_issuer_name(x509)
	X509 *x509;
	PREINIT:
		char *p;
		X509_NAME *name;
		char buf[1024];
		int i;
	CODE:
		name=X509_get_issuer_name(x509);
		X509_NAME_oneline(name,buf,sizeof(buf));
		p= &(buf[0]);
		RETVAL=p;
	OUTPUT:
		RETVAL

int
p5_X509_get_version(x509)
	X509 *x509;
	CODE:
		RETVAL=X509_get_version(x509);
	OUTPUT:
		RETVAL

BIGNUM *
p5_X509_get_serialNumber(x509)
	X509 *x509;
	CODE:
		RETVAL=ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
	OUTPUT:
		RETVAL

void
p5_X509_DESTROY(x509)
	X509 *x509;
	CODE:
	pr_name("p5_X509_DESTROY");
	X509_free(x509);

OpenPOWER on IntegriCloud