Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# ext/openssl/ossl_x509.c

Go to the documentation of this file.

    00001 /*
    00002  * $Id: ossl_x509.c 25189 2009-10-02 12:04:37Z akr $
    00003  * 'OpenSSL for Ruby' project
    00004  * Copyright (C) 2001-2002  Michal Rokos <m.rokos@sh.cvut.cz>
    00005  * All rights reserved.
    00006  */
    00007 /*
    00008  * This program is licenced under the same licence as Ruby.
    00009  * (See the file 'LICENCE'.)
    00010  */
    00011 #include "ossl.h"
    00012
    00013 VALUE mX509;
    00014
    00015 #define DefX509Const(x) rb_define_const(mX509, #x,INT2FIX(X509_##x))
    00016 #define DefX509Default(x,i) \
    00017   rb_define_const(mX509, "DEFAULT_" #x, rb_str_new2(X509_get_default_##i()))
    00018
    00019 void
    00020 Init_ossl_x509()
    00021 {
    00022     mX509 = rb_define_module_under(mOSSL, "X509");
    00023
    00024     Init_ossl_x509attr();
    00025     Init_ossl_x509cert();
    00026     Init_ossl_x509crl();
    00027     Init_ossl_x509ext();
    00028     Init_ossl_x509name();
    00029     Init_ossl_x509req();
    00030     Init_ossl_x509revoked();
    00031     Init_ossl_x509store();
    00032
    00033     DefX509Const(V_OK);
    00034     DefX509Const(V_ERR_UNABLE_TO_GET_ISSUER_CERT);
    00035     DefX509Const(V_ERR_UNABLE_TO_GET_CRL);
    00036     DefX509Const(V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE);
    00037     DefX509Const(V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE);
    00038     DefX509Const(V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
    00039     DefX509Const(V_ERR_CERT_SIGNATURE_FAILURE);
    00040     DefX509Const(V_ERR_CRL_SIGNATURE_FAILURE);
    00041     DefX509Const(V_ERR_CERT_NOT_YET_VALID);
    00042     DefX509Const(V_ERR_CERT_HAS_EXPIRED);
    00043     DefX509Const(V_ERR_CRL_NOT_YET_VALID);
    00044     DefX509Const(V_ERR_CRL_HAS_EXPIRED);
    00045     DefX509Const(V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD);
    00046     DefX509Const(V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD);
    00047     DefX509Const(V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD);
    00048     DefX509Const(V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD);
    00049     DefX509Const(V_ERR_OUT_OF_MEM);
    00050     DefX509Const(V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT);
    00051     DefX509Const(V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
    00052     DefX509Const(V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
    00053     DefX509Const(V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
    00054     DefX509Const(V_ERR_CERT_CHAIN_TOO_LONG);
    00055     DefX509Const(V_ERR_CERT_REVOKED);
    00056     DefX509Const(V_ERR_INVALID_CA);
    00057     DefX509Const(V_ERR_PATH_LENGTH_EXCEEDED);
    00058     DefX509Const(V_ERR_INVALID_PURPOSE);
    00059     DefX509Const(V_ERR_CERT_UNTRUSTED);
    00060     DefX509Const(V_ERR_CERT_REJECTED);
    00061     DefX509Const(V_ERR_SUBJECT_ISSUER_MISMATCH);
    00062     DefX509Const(V_ERR_AKID_SKID_MISMATCH);
    00063     DefX509Const(V_ERR_AKID_ISSUER_SERIAL_MISMATCH);
    00064     DefX509Const(V_ERR_KEYUSAGE_NO_CERTSIGN);
    00065     DefX509Const(V_ERR_APPLICATION_VERIFICATION);
    00066
    00067 #if defined(X509_V_FLAG_CRL_CHECK)
    00068     DefX509Const(V_FLAG_CRL_CHECK);
    00069 #endif
    00070 #if defined(X509_V_FLAG_CRL_CHECK_ALL)
    00071     DefX509Const(V_FLAG_CRL_CHECK_ALL);
    00072 #endif
    00073
    00074     DefX509Const(PURPOSE_SSL_CLIENT);
    00075     DefX509Const(PURPOSE_SSL_SERVER);
    00076     DefX509Const(PURPOSE_NS_SSL_SERVER);
    00077     DefX509Const(PURPOSE_SMIME_SIGN);
    00078     DefX509Const(PURPOSE_SMIME_ENCRYPT);
    00079     DefX509Const(PURPOSE_CRL_SIGN);
    00080     DefX509Const(PURPOSE_ANY);
    00081 #if defined(X509_PURPOSE_OCSP_HELPER)
    00082     DefX509Const(PURPOSE_OCSP_HELPER);
    00083 #endif
    00084
    00085     DefX509Const(TRUST_COMPAT);
    00086     DefX509Const(TRUST_SSL_CLIENT);
    00087     DefX509Const(TRUST_SSL_SERVER);
    00088     DefX509Const(TRUST_EMAIL);
    00089     DefX509Const(TRUST_OBJECT_SIGN);
    00090 #if defined(X509_TRUST_OCSP_SIGN)
    00091     DefX509Const(TRUST_OCSP_SIGN);
    00092 #endif
    00093 #if defined(X509_TRUST_OCSP_REQUEST)
    00094     DefX509Const(TRUST_OCSP_REQUEST);
    00095 #endif
    00096
    00097     DefX509Default(CERT_AREA, cert_area);
    00098     DefX509Default(CERT_DIR, cert_dir);
    00099     DefX509Default(CERT_FILE, cert_file);
    00100     DefX509Default(CERT_DIR_ENV, cert_dir_env);
    00101     DefX509Default(CERT_FILE_ENV, cert_file_env);
    00102     DefX509Default(PRIVATE_DIR, private_dir);
    00103 }
    00104
    00105