Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

ossl_x509.c
Go to the documentation of this file.
1 /*
2 * $Id: ossl_x509.c 25189 2009-10-02 12:04:37Z akr $
3 * 'OpenSSL for Ruby' project
4 * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
5 * All rights reserved.
6 */
7 /*
8 * This program is licenced under the same licence as Ruby.
9 * (See the file 'LICENCE'.)
10 */
11 #include "ossl.h"
12
13 VALUE mX509;
14
15 #define DefX509Const(x) rb_define_const(mX509, #x,INT2FIX(X509_##x))
16 #define DefX509Default(x,i) \
17 rb_define_const(mX509, "DEFAULT_" #x, rb_str_new2(X509_get_default_##i()))
18
19 void
20 Init_ossl_x509()
21 {
22 mX509 = rb_define_module_under(mOSSL, "X509");
23
24 Init_ossl_x509attr();
25 Init_ossl_x509cert();
26 Init_ossl_x509crl();
27 Init_ossl_x509ext();
28 Init_ossl_x509name();
29 Init_ossl_x509req();
30 Init_ossl_x509revoked();
31 Init_ossl_x509store();
32
33 DefX509Const(V_OK);
34 DefX509Const(V_ERR_UNABLE_TO_GET_ISSUER_CERT);
35 DefX509Const(V_ERR_UNABLE_TO_GET_CRL);
36 DefX509Const(V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE);
37 DefX509Const(V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE);
38 DefX509Const(V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
39 DefX509Const(V_ERR_CERT_SIGNATURE_FAILURE);
40 DefX509Const(V_ERR_CRL_SIGNATURE_FAILURE);
41 DefX509Const(V_ERR_CERT_NOT_YET_VALID);
42 DefX509Const(V_ERR_CERT_HAS_EXPIRED);
43 DefX509Const(V_ERR_CRL_NOT_YET_VALID);
44 DefX509Const(V_ERR_CRL_HAS_EXPIRED);
45 DefX509Const(V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD);
46 DefX509Const(V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD);
47 DefX509Const(V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD);
48 DefX509Const(V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD);
49 DefX509Const(V_ERR_OUT_OF_MEM);
50 DefX509Const(V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT);
51 DefX509Const(V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
52 DefX509Const(V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
53 DefX509Const(V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
54 DefX509Const(V_ERR_CERT_CHAIN_TOO_LONG);
55 DefX509Const(V_ERR_CERT_REVOKED);
56 DefX509Const(V_ERR_INVALID_CA);
57 DefX509Const(V_ERR_PATH_LENGTH_EXCEEDED);
58 DefX509Const(V_ERR_INVALID_PURPOSE);
59 DefX509Const(V_ERR_CERT_UNTRUSTED);
60 DefX509Const(V_ERR_CERT_REJECTED);
61 DefX509Const(V_ERR_SUBJECT_ISSUER_MISMATCH);
62 DefX509Const(V_ERR_AKID_SKID_MISMATCH);
63 DefX509Const(V_ERR_AKID_ISSUER_SERIAL_MISMATCH);
64 DefX509Const(V_ERR_KEYUSAGE_NO_CERTSIGN);
65 DefX509Const(V_ERR_APPLICATION_VERIFICATION);
66
67 #if defined(X509_V_FLAG_CRL_CHECK)
68 DefX509Const(V_FLAG_CRL_CHECK);
69 #endif
70 #if defined(X509_V_FLAG_CRL_CHECK_ALL)
71 DefX509Const(V_FLAG_CRL_CHECK_ALL);
72 #endif
73
74 DefX509Const(PURPOSE_SSL_CLIENT);
75 DefX509Const(PURPOSE_SSL_SERVER);
76 DefX509Const(PURPOSE_NS_SSL_SERVER);
77 DefX509Const(PURPOSE_SMIME_SIGN);
78 DefX509Const(PURPOSE_SMIME_ENCRYPT);
79 DefX509Const(PURPOSE_CRL_SIGN);
80 DefX509Const(PURPOSE_ANY);
81 #if defined(X509_PURPOSE_OCSP_HELPER)
82 DefX509Const(PURPOSE_OCSP_HELPER);
83 #endif
84
85 DefX509Const(TRUST_COMPAT);
86 DefX509Const(TRUST_SSL_CLIENT);
87 DefX509Const(TRUST_SSL_SERVER);
88 DefX509Const(TRUST_EMAIL);
89 DefX509Const(TRUST_OBJECT_SIGN);
90 #if defined(X509_TRUST_OCSP_SIGN)
91 DefX509Const(TRUST_OCSP_SIGN);
92 #endif
93 #if defined(X509_TRUST_OCSP_REQUEST)
94 DefX509Const(TRUST_OCSP_REQUEST);
95 #endif
96
97 DefX509Default(CERT_AREA, cert_area);
98 DefX509Default(CERT_DIR, cert_dir);
99 DefX509Default(CERT_FILE, cert_file);
100 DefX509Default(CERT_DIR_ENV, cert_dir_env);
101 DefX509Default(CERT_FILE_ENV, cert_file_env);
102 DefX509Default(PRIVATE_DIR, private_dir);
103 }
104
Init_ossl_x509ext
void Init_ossl_x509ext(void)
Definition: ossl_x509ext.c:439
mOSSL
VALUE mOSSL
Definition: ossl.c:259
Init_ossl_x509revoked
void Init_ossl_x509revoked(void)
Definition: ossl_x509revoked.c:212
DefX509Default
#define DefX509Default(x, i)
Definition: ossl_x509.c:16
Init_ossl_x509req
void Init_ossl_x509req(void)
Definition: ossl_x509req.c:441
Init_ossl_x509name
void Init_ossl_x509name(void)
Definition: ossl_x509name.c:428
mX509
VALUE mX509
Definition: ossl_x509.c:13
rb_define_module_under
VALUE rb_define_module_under(VALUE outer, const char *name)
Definition: class.c:637
Init_ossl_x509crl
void Init_ossl_x509crl(void)
Definition: ossl_x509crl.c:505
Init_ossl_x509attr
void Init_ossl_x509attr(void)
Definition: ossl_x509attr.c:263
ossl.h
Init_ossl_x509store
void Init_ossl_x509store(void)
Definition: ossl_x509store.c:596
VALUE
unsigned long VALUE
Definition: ripper.y:104
Init_ossl_x509
void Init_ossl_x509()
Definition: ossl_x509.c:20
Init_ossl_x509cert
void Init_ossl_x509cert(void)
Definition: ossl_x509cert.c:731
DefX509Const
#define DefX509Const(x)
Definition: ossl_x509.c:15