Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Functions | Variables
ossl_x509cert.c File Reference
`#include "ossl.h"`
Include dependency graph for ossl_x509cert.c:

Go to the source code of this file.

## Macros
#define | WrapX509(klass, obj, x509)
#define | GetX509(obj, x509)
#define | SafeGetX509(obj, x509)

## Functions
VALUE | ossl_x509_new (X509 *x509)
VALUE | ossl_x509_new_from_file (VALUE filename)
X509 * | GetX509CertPtr (VALUE obj)
X509 * | DupX509CertPtr (VALUE obj)
static VALUE | ossl_x509_alloc (VALUE klass)
static VALUE | ossl_x509_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509_copy (VALUE self, VALUE other)
static VALUE | ossl_x509_to_der (VALUE self)
static VALUE | ossl_x509_to_pem (VALUE self)
static VALUE | ossl_x509_to_text (VALUE self)
static VALUE | ossl_x509_get_version (VALUE self)
static VALUE | ossl_x509_set_version (VALUE self, VALUE version)
static VALUE | ossl_x509_get_serial (VALUE self)
static VALUE | ossl_x509_set_serial (VALUE self, VALUE num)
static VALUE | ossl_x509_get_signature_algorithm (VALUE self)
static VALUE | ossl_x509_get_subject (VALUE self)
static VALUE | ossl_x509_set_subject (VALUE self, VALUE subject)
static VALUE | ossl_x509_get_issuer (VALUE self)
static VALUE | ossl_x509_set_issuer (VALUE self, VALUE issuer)
static VALUE | ossl_x509_get_not_before (VALUE self)
static VALUE | ossl_x509_set_not_before (VALUE self, VALUE time)
static VALUE | ossl_x509_get_not_after (VALUE self)
static VALUE | ossl_x509_set_not_after (VALUE self, VALUE time)
static VALUE | ossl_x509_get_public_key (VALUE self)
static VALUE | ossl_x509_set_public_key (VALUE self, VALUE key)
static VALUE | ossl_x509_sign (VALUE self, VALUE key, VALUE digest)
static VALUE | ossl_x509_verify (VALUE self, VALUE key)
static VALUE | ossl_x509_check_private_key (VALUE self, VALUE key)
static VALUE | ossl_x509_get_extensions (VALUE self)
static VALUE | ossl_x509_set_extensions (VALUE self, VALUE ary)
static VALUE | ossl_x509_add_extension (VALUE self, VALUE extension)
static VALUE | ossl_x509_inspect (VALUE self)
void | Init_ossl_x509cert ()

## Variables
VALUE | cX509Cert
VALUE | eX509CertError

## Macro Definition Documentation

#define GetX509 | ( |  | obj,
|  |  | x509
| ) |  |

Value:
do { \
Data_Get_Struct((obj), X509, (x509)); \
if (!(x509)) { \
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
} \
} while (0)
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:510
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
Data_Get_Struct
#define Data_Get_Struct(obj, type, sval)
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

Definition at line 19 of file ossl_x509cert.c.

Referenced by ossl_x509_add_extension(), ossl_x509_check_private_key(), ossl_x509_copy(), ossl_x509_get_extensions(), ossl_x509_get_issuer(), ossl_x509_get_not_after(), ossl_x509_get_not_before(), ossl_x509_get_public_key(), ossl_x509_get_serial(), ossl_x509_get_signature_algorithm(), ossl_x509_get_subject(), ossl_x509_get_version(), ossl_x509_set_extensions(), ossl_x509_set_issuer(), ossl_x509_set_not_after(), ossl_x509_set_not_before(), ossl_x509_set_public_key(), ossl_x509_set_serial(), ossl_x509_set_subject(), ossl_x509_set_version(), ossl_x509_sign(), ossl_x509_to_der(), ossl_x509_to_pem(), ossl_x509_to_text(), and ossl_x509_verify().

#define SafeGetX509 | ( |  | obj,
|  |  | x509
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cX509Cert); \
GetX509((obj), (x509)); \
} while (0)
GetX509
#define GetX509(obj, x509)
Definition: ossl_x509cert.c:19
cX509Cert
VALUE cX509Cert
Definition: ossl_x509cert.c:33
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
OSSL_Check_Kind
#define OSSL_Check_Kind(obj, klass)
Definition: ossl.h:96

Definition at line 25 of file ossl_x509cert.c.

Referenced by DupX509CertPtr(), GetX509CertPtr(), and ossl_x509_copy().

#define WrapX509 | ( |  | klass,
|  |  | obj,
|  |  | x509
| ) |  |

Value:
do { \
if (!(x509)) { \
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
} \
(obj) = Data_Wrap_Struct((klass), 0, X509_free, (x509)); \
} while (0)
Data_Wrap_Struct
return Data_Wrap_Struct(CLASS_OF(interp), 0, ip_free, slave)
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:510
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
klass
klass
Definition: tcltklib.c:3504
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

Definition at line 13 of file ossl_x509cert.c.

Referenced by ossl_x509_alloc(), ossl_x509_new(), and ossl_x509_new_from_file().

## Function Documentation

X509* DupX509CertPtr | ( | VALUE | obj | ) |

Definition at line 102 of file ossl_x509cert.c.

References SafeGetX509.

Referenced by ossl_client_cert_cb(), ossl_sslctx_add_extra_chain_cert_i(), and ossl_x509stctx_initialize().

X509* GetX509CertPtr | ( | VALUE | obj | ) |

Definition at line 92 of file ossl_x509cert.c.

References SafeGetX509.

Referenced by ossl_call_client_cert_cb(), ossl_pkcs12_s_create(), ossl_pkcs7_add_certificate(), ossl_pkcs7_decrypt(), ossl_pkcs7_s_sign(), ossl_pkcs7ri_initialize(), ossl_pkcs7si_initialize(), ossl_sslctx_setup(), ossl_x509extfactory_set_issuer_cert(), ossl_x509extfactory_set_subject_cert(), and ossl_x509store_add_cert().

void Init_ossl_x509cert | ( | void |  | ) |

Definition at line 731 of file ossl_x509cert.c.

References cX509Cert, eOSSLError, eX509CertError, mOSSL, mX509, ossl_x509_add_extension(), ossl_x509_alloc(), ossl_x509_check_private_key(), ossl_x509_copy(), ossl_x509_get_extensions(), ossl_x509_get_issuer(), ossl_x509_get_not_after(), ossl_x509_get_not_before(), ossl_x509_get_public_key(), ossl_x509_get_serial(), ossl_x509_get_signature_algorithm(), ossl_x509_get_subject(), ossl_x509_get_version(), ossl_x509_initialize(), ossl_x509_inspect(), ossl_x509_set_extensions(), ossl_x509_set_issuer(), ossl_x509_set_not_after(), ossl_x509_set_not_before(), ossl_x509_set_public_key(), ossl_x509_set_serial(), ossl_x509_set_subject(), ossl_x509_set_version(), ossl_x509_sign(), ossl_x509_to_der(), ossl_x509_to_pem(), ossl_x509_to_text(), ossl_x509_verify(), rb_cObject, rb_define_alias(), rb_define_alloc_func(), rb_define_class_under(), rb_define_copy_func, rb_define_method(), rb_define_module(), and rb_define_module_under().

Referenced by Init_ossl_x509().

static VALUE ossl_x509_add_extension | ( | VALUE | self,
|  | VALUE | extension
| ) |  |
| static

Definition at line 677 of file ossl_x509cert.c.

References DupX509ExtPtr(), eX509CertError, GetX509, NULL, and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_alloc | ( | VALUE | klass | ) |
| static

Definition at line 117 of file ossl_x509cert.c.

References eX509CertError, NULL, obj, ossl_raise(), and WrapX509.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_check_private_key | ( | VALUE | self,
|  | VALUE | key
| ) |  |
| static

Definition at line 598 of file ossl_x509cert.c.

References GetPrivPKeyPtr(), GetX509, OSSL_ErrMsg, OSSL_Warning, Qfalse, and Qtrue.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_copy | ( | VALUE | self,
|  | VALUE | other
| ) |  |
| static

Definition at line 162 of file ossl_x509cert.c.

References a, b, DATA_PTR(), eX509CertError, GetX509, NULL, ossl_raise(), rb_check_frozen, and SafeGetX509.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_get_extensions | ( | VALUE | self | ) |
| static

Definition at line 619 of file ossl_x509cert.c.

References ary, count, GetX509, i, ossl_x509ext_new(), rb_ary_new(), rb_ary_new2(), and rb_ary_push().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_get_issuer | ( | VALUE | self | ) |
| static

Definition at line 406 of file ossl_x509cert.c.

References eX509CertError, GetX509, name, NULL, ossl_raise(), and ossl_x509name_new().

Referenced by Init_ossl_x509cert(), and ossl_x509_inspect().

static VALUE ossl_x509_get_not_after | ( | VALUE | self | ) |
| static

Definition at line 478 of file ossl_x509cert.c.

References asn1time_to_time(), eX509CertError, GetX509, NULL, and ossl_raise().

Referenced by Init_ossl_x509cert(), and ossl_x509_inspect().

static VALUE ossl_x509_get_not_before | ( | VALUE | self | ) |
| static

Definition at line 441 of file ossl_x509cert.c.

References asn1time_to_time(), eX509CertError, GetX509, NULL, and ossl_raise().

Referenced by Init_ossl_x509cert(), and ossl_x509_inspect().

static VALUE ossl_x509_get_public_key | ( | VALUE | self | ) |
| static

Definition at line 515 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_pkey_new(), and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_get_serial | ( | VALUE | self | ) |
| static

Definition at line 316 of file ossl_x509cert.c.

References asn1integer_to_num(), and GetX509.

Referenced by Init_ossl_x509cert(), and ossl_x509_inspect().

static VALUE ossl_x509_get_signature_algorithm | ( | VALUE | self | ) |
| static

Definition at line 347 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_membio2str(), ossl_raise(), out, and str.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_get_subject | ( | VALUE | self | ) |
| static

Definition at line 371 of file ossl_x509cert.c.

References eX509CertError, GetX509, name, NULL, ossl_raise(), and ossl_x509name_new().

Referenced by Init_ossl_x509cert(), and ossl_x509_inspect().

static VALUE ossl_x509_get_version | ( | VALUE | self | ) |
| static

Definition at line 281 of file ossl_x509cert.c.

References GetX509, and LONG2NUM.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 136 of file ossl_x509cert.c.

References arg, DATA_PTR(), eX509CertError, in, NULL, OSSL_BIO_reset, ossl_obj2bio(), ossl_raise(), ossl_to_der_if_possible(), and rb_scan_args().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_inspect | ( | VALUE | self | ) |
| static

Definition at line 694 of file ossl_x509cert.c.

References ossl_x509_get_issuer(), ossl_x509_get_not_after(), ossl_x509_get_not_before(), ossl_x509_get_serial(), ossl_x509_get_subject(), rb_class2name(), rb_inspect(), rb_obj_class(), rb_str_append(), rb_str_cat2(), rb_str_new2, and str.

Referenced by Init_ossl_x509cert().

VALUE ossl_x509_new | ( | X509 * | x509 | ) |

Definition at line 40 of file ossl_x509cert.c.

References cX509Cert, eX509CertError, NULL, obj, ossl_raise(), and WrapX509.

Referenced by ossl_pkcs12_initialize(), ossl_ssl_get_cert(), ossl_ssl_get_peer_cert(), ossl_ssl_get_peer_cert_chain(), ossl_x509stctx_get_chain(), and ossl_x509stctx_get_curr_cert().

VALUE ossl_x509_new_from_file | ( | VALUE | filename | ) |

Definition at line 59 of file ossl_x509cert.c.

References cX509Cert, errno, eX509CertError, fileno, NULL, obj, ossl_raise(), rb_fd_fix_cloexec(), RSTRING_PTR, SafeStringValue, strerror(), and WrapX509.

static VALUE ossl_x509_set_extensions | ( | VALUE | self,
|  | VALUE | ary
| ) |  |
| static

Definition at line 645 of file ossl_x509cert.c.

References ary, Check_Type, cX509Ext, DupX509ExtPtr(), eX509CertError, GetX509, i, NULL, OSSL_Check_Kind, ossl_raise(), RARRAY_LEN, RARRAY_PTR(), and T_ARRAY.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_issuer | ( | VALUE | self,
|  | VALUE | issuer
| ) |  |
| static

Definition at line 424 of file ossl_x509cert.c.

References eX509CertError, GetX509, GetX509NamePtr(), NULL, and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_not_after | ( | VALUE | self,
|  | VALUE | time
| ) |  |
| static

Definition at line 496 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_raise(), time, and time_to_time_t().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_not_before | ( | VALUE | self,
|  | VALUE | time
| ) |  |
| static

Definition at line 459 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_raise(), time, and time_to_time_t().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_public_key | ( | VALUE | self,
|  | VALUE | key
| ) |  |
| static

Definition at line 533 of file ossl_x509cert.c.

References eX509CertError, GetPKeyPtr(), GetX509, key, NULL, and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_serial | ( | VALUE | self,
|  | VALUE | num
| ) |  |
| static

Definition at line 330 of file ossl_x509cert.c.

References GetX509, and num_to_asn1integer().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_subject | ( | VALUE | self,
|  | VALUE | subject
| ) |  |
| static

Definition at line 389 of file ossl_x509cert.c.

References eX509CertError, GetX509, GetX509NamePtr(), NULL, and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_set_version | ( | VALUE | self,
|  | VALUE | version
| ) |  |
| static

Definition at line 295 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, NUM2LONG, ossl_raise(), and version().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_sign | ( | VALUE | self,
|  | VALUE | key,
|  | VALUE | digest
| ) |  |
| static

Definition at line 550 of file ossl_x509cert.c.

References eX509CertError, GetDigestPtr(), GetPrivPKeyPtr(), GetX509, NULL, and ossl_raise().

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_to_der | ( | VALUE | self | ) |
| static

Definition at line 186 of file ossl_x509cert.c.

References eX509CertError, GetX509, len, NULL, ossl_raise(), ossl_str_adjust, p, rb_str_new(), RSTRING_PTR, and str.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_to_pem | ( | VALUE | self | ) |
| static

Definition at line 210 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_membio2str(), ossl_raise(), out, and str.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_to_text | ( | VALUE | self | ) |
| static

Definition at line 234 of file ossl_x509cert.c.

References eX509CertError, GetX509, NULL, ossl_membio2str(), ossl_raise(), out, and str.

Referenced by Init_ossl_x509cert().

static VALUE ossl_x509_verify | ( | VALUE | self,
|  | VALUE | key
| ) |  |
| static

Definition at line 573 of file ossl_x509cert.c.

References eX509CertError, GetPKeyPtr(), GetX509, i, NULL, ossl_raise(), Qfalse, and Qtrue.

Referenced by Init_ossl_x509cert().

## Variable Documentation

VALUE cX509Cert

Definition at line 33 of file ossl_x509cert.c.

Referenced by Init_ossl_x509cert(), ossl_x509_new(), and ossl_x509_new_from_file().

VALUE eX509CertError

Definition at line 34 of file ossl_x509cert.c.

Referenced by Init_ossl_x509cert(), ossl_spki_to_der(), ossl_x509_add_extension(), ossl_x509_alloc(), ossl_x509_copy(), ossl_x509_get_issuer(), ossl_x509_get_not_after(), ossl_x509_get_not_before(), ossl_x509_get_public_key(), ossl_x509_get_signature_algorithm(), ossl_x509_get_subject(), ossl_x509_initialize(), ossl_x509_new(), ossl_x509_new_from_file(), ossl_x509_set_extensions(), ossl_x509_set_issuer(), ossl_x509_set_not_after(), ossl_x509_set_not_before(), ossl_x509_set_public_key(), ossl_x509_set_subject(), ossl_x509_set_version(), ossl_x509_sign(), ossl_x509_to_der(), ossl_x509_to_pem(), ossl_x509_to_text(), and ossl_x509_verify().