Change soft-fail to use the config, rather than env
[rbx.git] / stdlib / ext / openssl / ossl_x509.c
blobfdb23bfa101cc8bd9f53de54d8f8192d78f7517d
1 /*
2 * $Id: ossl_x509.c 11708 2007-02-12 23:01:19Z shyouhei $
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'.)
11 #include "ossl.h"
13 VALUE mX509;
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()))
19 void
20 Init_ossl_x509()
22 mX509 = rb_define_module_under(mOSSL, "X509");
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();
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);
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
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
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
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);