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

Go to the source code of this file.

## Macros

#define | WrapX509Req(klass, obj, req)
#define | GetX509Req(obj, req)
#define | SafeGetX509Req(obj, req)

## Functions

VALUE | ossl_x509req_new (X509_REQ *req)
X509_REQ * | GetX509ReqPtr (VALUE obj)
X509_REQ * | DupX509ReqPtr (VALUE obj)
static VALUE | ossl_x509req_alloc (VALUE klass)
static VALUE | ossl_x509req_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509req_copy (VALUE self, VALUE other)
static VALUE | ossl_x509req_to_pem (VALUE self)
static VALUE | ossl_x509req_to_der (VALUE self)
static VALUE | ossl_x509req_to_text (VALUE self)
static VALUE | ossl_x509req_get_version (VALUE self)
static VALUE | ossl_x509req_set_version (VALUE self, VALUE version)
static VALUE | ossl_x509req_get_subject (VALUE self)
static VALUE | ossl_x509req_set_subject (VALUE self, VALUE subject)
static VALUE | ossl_x509req_get_signature_algorithm (VALUE self)
static VALUE | ossl_x509req_get_public_key (VALUE self)
static VALUE | ossl_x509req_set_public_key (VALUE self, VALUE key)
static VALUE | ossl_x509req_sign (VALUE self, VALUE key, VALUE digest)
static VALUE | ossl_x509req_verify (VALUE self, VALUE key)
static VALUE | ossl_x509req_get_attributes (VALUE self)
static VALUE | ossl_x509req_set_attributes (VALUE self, VALUE ary)
static VALUE | ossl_x509req_add_attribute (VALUE self, VALUE attr)
void | Init_ossl_x509req ()

## Variables

VALUE | cX509Req
VALUE | eX509ReqError

## Macro Definition Documentation

#define GetX509Req | ( |  | obj,
|  |  | req
| ) |  |

Value:
do { \
Data_Get_Struct((obj), X509_REQ, (req)); \
if (!(req)) { \
ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \
} \
} while (0)

Definition at line 19 of file ossl_x509req.c.

Referenced by ossl_x509req_add_attribute(), ossl_x509req_copy(), ossl_x509req_get_attributes(), ossl_x509req_get_public_key(), ossl_x509req_get_signature_algorithm(), ossl_x509req_get_subject(), ossl_x509req_get_version(), ossl_x509req_set_attributes(), ossl_x509req_set_public_key(), ossl_x509req_set_subject(), ossl_x509req_set_version(), ossl_x509req_sign(), ossl_x509req_to_der(), ossl_x509req_to_pem(), ossl_x509req_to_text(), and ossl_x509req_verify().

#define SafeGetX509Req | ( |  | obj,
|  |  | req
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cX509Req); \
GetX509Req((obj), (req)); \
} while (0)

Definition at line 25 of file ossl_x509req.c.

Referenced by DupX509ReqPtr(), GetX509ReqPtr(), and ossl_x509req_copy().

#define WrapX509Req | ( |  | klass,
|  |  | obj,
|  |  | req
| ) |  |

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

Definition at line 13 of file ossl_x509req.c.

Referenced by ossl_x509req_alloc(), and ossl_x509req_new().

## Function Documentation

X509_REQ* DupX509ReqPtr | ( | VALUE | obj | ) |

Definition at line 69 of file ossl_x509req.c.

References eX509ReqError, NULL, ossl_raise(), and SafeGetX509Req.

X509_REQ* GetX509ReqPtr | ( | VALUE | obj | ) |

Definition at line 59 of file ossl_x509req.c.

References SafeGetX509Req.

Referenced by ossl_x509extfactory_set_subject_req().

void Init_ossl_x509req | ( | void |  | ) |

Definition at line 441 of file ossl_x509req.c.

References cX509Req, eOSSLError, eX509ReqError, mX509, ossl_x509req_add_attribute(), ossl_x509req_alloc(), ossl_x509req_copy(), ossl_x509req_get_attributes(), ossl_x509req_get_public_key(), ossl_x509req_get_signature_algorithm(), ossl_x509req_get_subject(), ossl_x509req_get_version(), ossl_x509req_initialize(), ossl_x509req_set_attributes(), ossl_x509req_set_public_key(), ossl_x509req_set_subject(), ossl_x509req_set_version(), ossl_x509req_sign(), ossl_x509req_to_der(), ossl_x509req_to_pem(), ossl_x509req_to_text(), ossl_x509req_verify(), rb_cObject, rb_define_alias(), rb_define_alloc_func(), rb_define_class_under(), rb_define_copy_func, and rb_define_method().

Referenced by Init_ossl_x509().

static VALUE ossl_x509req_add_attribute | ( | VALUE | self,
|  | VALUE | attr
| ) |  |

static

Definition at line 425 of file ossl_x509req.c.

References DupX509AttrPtr(), eX509ReqError, GetX509Req, NULL, and ossl_raise().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_alloc | ( | VALUE | klass | ) |

static

Definition at line 85 of file ossl_x509req.c.

References eX509ReqError, NULL, ossl_raise(), and WrapX509Req.

Referenced by Init_ossl_x509req().

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

static

Definition at line 124 of file ossl_x509req.c.

References DATA_PTR, eX509ReqError, GetX509Req, NULL, ossl_raise(), rb_check_frozen, and SafeGetX509Req.

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_get_attributes | ( | VALUE | self | ) |

static

Definition at line 376 of file ossl_x509req.c.

References count, GetX509Req, i, OSSL_Debug, ossl_x509attr_new(), rb_ary_new(), rb_ary_new2(), and rb_ary_push().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_get_public_key | ( | VALUE | self | ) |

static

Definition at line 308 of file ossl_x509req.c.

References eX509ReqError, GetX509Req, NULL, ossl_pkey_new(), and ossl_raise().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_get_signature_algorithm | ( | VALUE | self | ) |

static

Definition at line 285 of file ossl_x509req.c.

References buf, eX509ReqError, GetX509Req, NULL, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_get_subject | ( | VALUE | self | ) |

static

Definition at line 257 of file ossl_x509req.c.

References eX509ReqError, GetX509Req, name, NULL, ossl_raise(), and ossl_x509name_new().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_get_version | ( | VALUE | self | ) |

static

Definition at line 228 of file ossl_x509req.c.

References GetX509Req, LONG2FIX, and version().

Referenced by Init_ossl_x509req().

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

static

Definition at line 99 of file ossl_x509req.c.

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

Referenced by Init_ossl_x509req().

VALUE ossl_x509req_new | ( | X509_REQ * | req | ) |

Definition at line 40 of file ossl_x509req.c.

References cX509Req, eX509ReqError, NULL, ossl_raise(), and WrapX509Req.

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

static

Definition at line 400 of file ossl_x509req.c.

References Check_Type, cX509Attr, DupX509AttrPtr(), eX509ReqError, GetX509Req, i, NULL, OSSL_Check_Kind, ossl_raise(), RARRAY_LEN, RARRAY_PTR, and T_ARRAY.

Referenced by Init_ossl_x509req().

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

static

Definition at line 322 of file ossl_x509req.c.

References eX509ReqError, GetPKeyPtr(), GetX509Req, NULL, and ossl_raise().

Referenced by Init_ossl_x509req().

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

static

Definition at line 271 of file ossl_x509req.c.

References eX509ReqError, GetX509NamePtr(), GetX509Req, NULL, and ossl_raise().

Referenced by Init_ossl_x509req().

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

static

Definition at line 240 of file ossl_x509req.c.

References eX509ReqError, FIX2LONG, GetX509Req, NULL, ossl_raise(), and version().

Referenced by Init_ossl_x509req().

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

static

Definition at line 337 of file ossl_x509req.c.

References eX509ReqError, GetDigestPtr(), GetPrivPKeyPtr(), GetX509Req, NULL, and ossl_raise().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_to_der | ( | VALUE | self | ) |

static

Definition at line 165 of file ossl_x509req.c.

References eX509ReqError, GetX509Req, len, NULL, ossl_raise(), ossl_str_adjust, p, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_to_pem | ( | VALUE | self | ) |

static

Definition at line 142 of file ossl_x509req.c.

References buf, eX509ReqError, GetX509Req, NULL, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_x509req().

static VALUE ossl_x509req_to_text | ( | VALUE | self | ) |

static

Definition at line 185 of file ossl_x509req.c.

References buf, eX509ReqError, GetX509Req, NULL, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_x509req().

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

static

Definition at line 357 of file ossl_x509req.c.

References eX509ReqError, GetPKeyPtr(), GetX509Req, i, NULL, ossl_raise(), Qfalse, and Qtrue.

Referenced by Init_ossl_x509req().

## Variable Documentation

VALUE cX509Req

Definition at line 33 of file ossl_x509req.c.

Referenced by Init_ossl_x509req(), and ossl_x509req_new().

VALUE eX509ReqError

Definition at line 34 of file ossl_x509req.c.

Referenced by DupX509ReqPtr(), Init_ossl_x509req(), ossl_x509req_add_attribute(), ossl_x509req_alloc(), ossl_x509req_copy(), ossl_x509req_get_public_key(), ossl_x509req_get_signature_algorithm(), ossl_x509req_get_subject(), ossl_x509req_initialize(), ossl_x509req_new(), ossl_x509req_set_attributes(), ossl_x509req_set_public_key(), ossl_x509req_set_subject(), ossl_x509req_set_version(), ossl_x509req_sign(), ossl_x509req_to_der(), ossl_x509req_to_pem(), ossl_x509req_to_text(), and ossl_x509req_verify().