1 /*
2  * 'OpenSSL for Ruby' project
3  * Copyright (C) 2001-2002  Michal Rokos <m.rokos@sh.cvut.cz>
4  * All rights reserved.
5  */
6 /*
7  * This program is licensed under the same licence as Ruby.
8  * (See the file 'LICENCE'.)
9  */
10 #if !defined(_OSSL_X509_H_)
11 #define _OSSL_X509_H_
12 
13 /*
14  * X509 main module
15  */
16 extern VALUE mX509;
17 
18 /*
19  * Converts the VALUE into Integer and set it to the ASN1_TIME. This is a
20  * wrapper for X509_time_adj_ex() so passing NULL creates a new ASN1_TIME.
21  * Note that the caller must check the NULL return.
22  */
23 ASN1_TIME *ossl_x509_time_adjust(ASN1_TIME *, VALUE);
24 
25 void Init_ossl_x509(void);
26 
27 /*
28  * X509Attr
29  */
30 extern VALUE cX509Attr;
31 extern VALUE eX509AttrError;
32 
33 VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
34 X509_ATTRIBUTE *GetX509AttrPtr(VALUE);
35 void Init_ossl_x509attr(void);
36 
37 /*
38  * X509Cert
39  */
40 extern VALUE cX509Cert;
41 extern VALUE eX509CertError;
42 
43 VALUE ossl_x509_new(X509 *);
44 X509 *GetX509CertPtr(VALUE);
45 X509 *DupX509CertPtr(VALUE);
46 void Init_ossl_x509cert(void);
47 
48 /*
49  * X509CRL
50  */
51 extern VALUE cX509CRL;
52 extern VALUE eX509CRLError;
53 
54 VALUE ossl_x509crl_new(X509_CRL *);
55 X509_CRL *GetX509CRLPtr(VALUE);
56 void Init_ossl_x509crl(void);
57 
58 /*
59  * X509Extension
60  */
61 extern VALUE cX509Ext;
62 extern VALUE cX509ExtFactory;
63 extern VALUE eX509ExtError;
64 
65 VALUE ossl_x509ext_new(X509_EXTENSION *);
66 X509_EXTENSION *GetX509ExtPtr(VALUE);
67 void Init_ossl_x509ext(void);
68 
69 /*
70  * X509Name
71  */
72 extern VALUE cX509Name;
73 extern VALUE eX509NameError;
74 
75 VALUE ossl_x509name_new(X509_NAME *);
76 X509_NAME *GetX509NamePtr(VALUE);
77 void Init_ossl_x509name(void);
78 
79 /*
80  * X509Request
81  */
82 extern VALUE cX509Req;
83 extern VALUE eX509ReqError;
84 
85 X509_REQ *GetX509ReqPtr(VALUE);
86 void Init_ossl_x509req(void);
87 
88 /*
89  * X509Revoked
90  */
91 extern VALUE cX509Rev;
92 extern VALUE eX509RevError;
93 
94 VALUE ossl_x509revoked_new(X509_REVOKED *);
95 X509_REVOKED *DupX509RevokedPtr(VALUE);
96 void Init_ossl_x509revoked(void);
97 
98 /*
99  * X509Store and X509StoreContext
100  */
101 extern VALUE cX509Store;
102 extern VALUE cX509StoreContext;
103 extern VALUE eX509StoreError;
104 
105 X509_STORE *GetX509StorePtr(VALUE);
106 
107 void Init_ossl_x509store(void);
108 
109 /*
110  * Calls the verify callback Proc (the first parameter) with given pre-verify
111  * result and the X509_STORE_CTX.
112  */
113 int ossl_verify_cb_call(VALUE, int, X509_STORE_CTX *);
114 
115 #endif /* _OSSL_X509_H_ */
116