This commit was generated by cvs2svn to track changes on a CVS vendor
[openssl.git] / perl / openssl_x509.xs
1 #include "p5SSLeay.h"
2
3 MODULE =  SSLeay::X509  PACKAGE = SSLeay::X509  PREFIX = p5_X509_
4
5 PROTOTYPES: ENABLE
6 VERSIONCHECK: DISABLE
7
8 void
9 p5_X509_new(void )
10         PREINIT:
11                 X509 *x509;
12                 SV *arg;
13         PPCODE:
14                 pr_name("p5_X509_new");
15                 EXTEND(sp,1);
16                 PUSHs(sv_newmortal());
17                 x509=X509_new();
18                 sv_setref_pv(ST(0),"SSLeay::X509",(void *)x509);
19
20 char *
21 p5_X509_get_subject_name(x509)
22         X509 *x509;
23         PREINIT:
24                 char *p;
25                 X509_NAME *name;
26                 char buf[1024];
27                 int i;
28         CODE:
29                 name=X509_get_subject_name(x509);
30                 X509_NAME_oneline(name,buf,sizeof(buf));
31                 p= &(buf[0]);
32                 RETVAL=p;
33         OUTPUT:
34                 RETVAL
35
36 char *
37 p5_X509_get_issuer_name(x509)
38         X509 *x509;
39         PREINIT:
40                 char *p;
41                 X509_NAME *name;
42                 char buf[1024];
43                 int i;
44         CODE:
45                 name=X509_get_issuer_name(x509);
46                 X509_NAME_oneline(name,buf,sizeof(buf));
47                 p= &(buf[0]);
48                 RETVAL=p;
49         OUTPUT:
50                 RETVAL
51
52 int
53 p5_X509_get_version(x509)
54         X509 *x509;
55         CODE:
56                 RETVAL=X509_get_version(x509);
57         OUTPUT:
58                 RETVAL
59
60 BIGNUM *
61 p5_X509_get_serialNumber(x509)
62         X509 *x509;
63         CODE:
64                 RETVAL=ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
65         OUTPUT:
66                 RETVAL
67
68 void
69 p5_X509_DESTROY(x509)
70         X509 *x509;
71         CODE:
72         pr_name("p5_X509_DESTROY");
73         X509_free(x509);
74