ossl_x509ext.c File Reference
`#include "ossl.h"`

Go to the source code of this file.

## Macros

#define | WrapX509Ext(klass, obj, ext)
#define | GetX509Ext(obj, ext)
#define | SafeGetX509Ext(obj, ext)
#define | MakeX509ExtFactory(klass, obj, ctx)
#define | GetX509ExtFactory(obj, ctx)
#define | ossl_x509extfactory_set_config rb_f_notimplement

## Functions

VALUE | ossl_x509ext_new (X509_EXTENSION *ext)
X509_EXTENSION * | GetX509ExtPtr (VALUE obj)
X509_EXTENSION * | DupX509ExtPtr (VALUE obj)
static void | ossl_x509extfactory_free (X509V3_CTX *ctx)
static VALUE | ossl_x509extfactory_alloc (VALUE klass)
static VALUE | ossl_x509extfactory_set_issuer_cert (VALUE self, VALUE cert)
static VALUE | ossl_x509extfactory_set_subject_cert (VALUE self, VALUE cert)
static VALUE | ossl_x509extfactory_set_subject_req (VALUE self, VALUE req)
static VALUE | ossl_x509extfactory_set_crl (VALUE self, VALUE crl)
static VALUE | ossl_x509extfactory_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509extfactory_create_ext (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509ext_alloc (VALUE klass)
static VALUE | ossl_x509ext_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509ext_set_oid (VALUE self, VALUE oid)
static VALUE | ossl_x509ext_set_value (VALUE self, VALUE data)
static VALUE | ossl_x509ext_set_critical (VALUE self, VALUE flag)
static VALUE | ossl_x509ext_get_oid (VALUE obj)
static VALUE | ossl_x509ext_get_value (VALUE obj)
static VALUE | ossl_x509ext_get_critical (VALUE obj)
static VALUE | ossl_x509ext_to_der (VALUE obj)
void | Init_ossl_x509ext ()

## Variables

VALUE | cX509Ext
VALUE | cX509ExtFactory
VALUE | eX509ExtError

## Macro Definition Documentation

#define GetX509Ext | ( |  | obj,
|  |  | ext
| ) |  |

Value:
do { \
Data_Get_Struct((obj), X509_EXTENSION, (ext)); \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
} while (0)

Definition at line 19 of file ossl_x509ext.c.

Referenced by ossl_x509ext_get_critical(), ossl_x509ext_get_oid(), ossl_x509ext_get_value(), ossl_x509ext_initialize(), ossl_x509ext_set_critical(), ossl_x509ext_set_oid(), ossl_x509ext_set_value(), and ossl_x509ext_to_der().

#define GetX509ExtFactory | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
Data_Get_Struct((obj), X509V3_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \
} \
} while (0)

Definition at line 35 of file ossl_x509ext.c.

Referenced by ossl_x509extfactory_create_ext(), ossl_x509extfactory_set_crl(), ossl_x509extfactory_set_issuer_cert(), ossl_x509extfactory_set_subject_cert(), and ossl_x509extfactory_set_subject_req().

#define MakeX509ExtFactory | ( |  | klass,
|  |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
X509V3_set_ctx((ctx), NULL, NULL, NULL, NULL, 0); \
(obj) = Data_Wrap_Struct((klass), 0, ossl_x509extfactory_free, (ctx)); \
} while (0)

Definition at line 29 of file ossl_x509ext.c.

Referenced by ossl_x509extfactory_alloc().

#define ossl_x509extfactory_set_config rb_f_notimplement

Definition at line 181 of file ossl_x509ext.c.

Referenced by Init_ossl_x509ext().

#define SafeGetX509Ext | ( |  | obj,
|  |  | ext
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cX509Ext); \
GetX509Ext((obj), (ext)); \
} while (0)

Definition at line 25 of file ossl_x509ext.c.

Referenced by DupX509ExtPtr(), and GetX509ExtPtr().

#define WrapX509Ext | ( |  | klass,
|  |  | obj,
|  |  | ext
| ) |  |

Value:
do { \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
(obj) = Data_Wrap_Struct((klass), 0, X509_EXTENSION_free, (ext)); \
} while (0)

Definition at line 13 of file ossl_x509ext.c.

Referenced by ossl_x509ext_alloc(), ossl_x509ext_new(), and ossl_x509extfactory_create_ext().

## Function Documentation

X509_EXTENSION* DupX509ExtPtr | ( | VALUE | obj | ) |

Definition at line 82 of file ossl_x509ext.c.

References eX509ExtError, NULL, ossl_raise(), and SafeGetX509Ext.

Referenced by ossl_x509_add_extension(), ossl_x509_set_extensions(), ossl_x509crl_add_extension(), ossl_x509crl_set_extensions(), ossl_x509revoked_add_extension(), and ossl_x509revoked_set_extensions().

X509_EXTENSION* GetX509ExtPtr | ( | VALUE | obj | ) |

Definition at line 72 of file ossl_x509ext.c.

References SafeGetX509Ext.

void Init_ossl_x509ext | ( | void |  | ) |

Definition at line 439 of file ossl_x509ext.c.

References cX509Ext, cX509ExtFactory, eOSSLError, eX509ExtError, mX509, ossl_x509ext_alloc(), ossl_x509ext_get_critical(), ossl_x509ext_get_oid(), ossl_x509ext_get_value(), ossl_x509ext_initialize(), ossl_x509ext_set_critical(), ossl_x509ext_set_oid(), ossl_x509ext_set_value(), ossl_x509ext_to_der(), ossl_x509extfactory_alloc(), ossl_x509extfactory_create_ext(), ossl_x509extfactory_initialize(), ossl_x509extfactory_set_config, ossl_x509extfactory_set_crl(), ossl_x509extfactory_set_issuer_cert(), ossl_x509extfactory_set_subject_cert(), ossl_x509extfactory_set_subject_req(), Qfalse, rb_attr(), rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), and rb_intern.

Referenced by Init_ossl_x509().

static VALUE ossl_x509ext_alloc | ( | VALUE | klass | ) |

static

Definition at line 260 of file ossl_x509ext.c.

References eX509ExtError, NULL, ossl_raise(), and WrapX509Ext.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_get_critical | ( | VALUE | obj | ) |

static

Definition at line 407 of file ossl_x509ext.c.

References GetX509Ext, Qfalse, and Qtrue.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_get_oid | ( | VALUE | obj | ) |

static

Definition at line 367 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, NULL, ossl_membio2str(), ossl_raise(), and rb_str_new2().

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_get_value | ( | VALUE | obj | ) |

static

Definition at line 390 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, NULL, ossl_membio2str(), and ossl_raise().

Referenced by Init_ossl_x509ext().

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

static

Definition at line 286 of file ossl_x509ext.c.

References DATA_PTR, eX509ExtError, GetX509Ext, NULL, ossl_raise(), ossl_to_der_if_possible(), p, rb_funcall(), rb_intern, rb_scan_args(), RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_x509ext().

VALUE ossl_x509ext_new | ( | X509_EXTENSION * | ext | ) |

Definition at line 53 of file ossl_x509ext.c.

References cX509Ext, eX509ExtError, NULL, ossl_raise(), and WrapX509Ext.

Referenced by ossl_x509_get_extensions(), ossl_x509crl_get_extensions(), and ossl_x509revoked_get_extensions().

static VALUE ossl_x509ext_set_critical | ( | VALUE | self,
|  | VALUE | flag
| ) |  |

static

Definition at line 356 of file ossl_x509ext.c.

References GetX509Ext, and RTEST.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_set_oid | ( | VALUE | self,
|  | VALUE | oid
| ) |  |

static

Definition at line 311 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, NULL, ossl_raise(), and StringValuePtr.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_set_value | ( | VALUE | self,
|  | VALUE | data
| ) |  |

static

Definition at line 328 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, NULL, ossl_raise(), ossl_to_der_if_possible(), RSTRING_LEN, RSTRING_LENINT, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509ext_to_der | ( | VALUE | obj | ) |

static

Definition at line 416 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, len, NULL, ossl_raise(), ossl_str_adjust, p, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509extfactory_alloc | ( | VALUE | klass | ) |

static

Definition at line 107 of file ossl_x509ext.c.

References MakeX509ExtFactory, Qnil, and rb_iv_set().

Referenced by Init_ossl_x509ext().

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

static

Definition at line 215 of file ossl_x509ext.c.

References cX509Ext, eX509ExtError, GetConfigPtr(), GetX509ExtFactory, NIL_P, NULL, ossl_raise(), Qfalse, rb_iv_get(), rb_scan_args(), rb_str_append(), rb_str_new2(), RSTRING_PTR, RTEST, StringValue, and WrapX509Ext.

Referenced by Init_ossl_x509ext().

static void ossl_x509extfactory_free | ( | X509V3_CTX * | ctx | ) |

static

Definition at line 101 of file ossl_x509ext.c.

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

static

Definition at line 185 of file ossl_x509ext.c.

References NIL_P, ossl_x509extfactory_set_crl(), ossl_x509extfactory_set_issuer_cert(), ossl_x509extfactory_set_subject_cert(), ossl_x509extfactory_set_subject_req(), and rb_scan_args().

Referenced by Init_ossl_x509ext().

static VALUE ossl_x509extfactory_set_crl | ( | VALUE | self,
|  | VALUE | crl
| ) |  |

static

Definition at line 155 of file ossl_x509ext.c.

References GetX509CRLPtr(), GetX509ExtFactory, and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

static VALUE ossl_x509extfactory_set_issuer_cert | ( | VALUE | self,
|  | VALUE | cert
| ) |  |

static

Definition at line 119 of file ossl_x509ext.c.

References GetX509CertPtr(), GetX509ExtFactory, and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

static VALUE ossl_x509extfactory_set_subject_cert | ( | VALUE | self,
|  | VALUE | cert
| ) |  |

static

Definition at line 131 of file ossl_x509ext.c.

References GetX509CertPtr(), GetX509ExtFactory, and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

static VALUE ossl_x509extfactory_set_subject_req | ( | VALUE | self,
|  | VALUE | req
| ) |  |

static

Definition at line 143 of file ossl_x509ext.c.

References GetX509ExtFactory, GetX509ReqPtr(), and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

## Variable Documentation

VALUE cX509Ext

Definition at line 45 of file ossl_x509ext.c.

Referenced by Init_ossl_x509ext(), ossl_x509_set_extensions(), ossl_x509crl_set_extensions(), ossl_x509ext_new(), ossl_x509extfactory_create_ext(), and ossl_x509revoked_set_extensions().

VALUE cX509ExtFactory

Definition at line 46 of file ossl_x509ext.c.

Referenced by Init_ossl_x509ext().

VALUE eX509ExtError

Definition at line 47 of file ossl_x509ext.c.

Referenced by DupX509ExtPtr(), Init_ossl_x509ext(), ossl_x509ext_alloc(), ossl_x509ext_get_oid(), ossl_x509ext_get_value(), ossl_x509ext_initialize(), ossl_x509ext_new(), ossl_x509ext_set_oid(), ossl_x509ext_set_value(), ossl_x509ext_to_der(), and ossl_x509extfactory_create_ext().