rubysl-openssl 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/.travis.yml +7 -0
  4. data/README.md +2 -2
  5. data/Rakefile +0 -1
  6. data/ext/rubysl/openssl/extconf.h +50 -0
  7. data/ext/rubysl/openssl/extconf.rb +144 -0
  8. data/ext/rubysl/openssl/openssl_missing.c +343 -0
  9. data/ext/rubysl/openssl/openssl_missing.h +191 -0
  10. data/ext/rubysl/openssl/ossl.c +552 -0
  11. data/ext/rubysl/openssl/ossl.h +233 -0
  12. data/ext/rubysl/openssl/ossl_asn1.c +1160 -0
  13. data/ext/rubysl/openssl/ossl_asn1.h +59 -0
  14. data/ext/rubysl/openssl/ossl_bio.c +86 -0
  15. data/ext/rubysl/openssl/ossl_bio.h +21 -0
  16. data/ext/rubysl/openssl/ossl_bn.c +852 -0
  17. data/ext/rubysl/openssl/ossl_bn.h +25 -0
  18. data/ext/rubysl/openssl/ossl_cipher.c +569 -0
  19. data/ext/rubysl/openssl/ossl_cipher.h +22 -0
  20. data/ext/rubysl/openssl/ossl_config.c +75 -0
  21. data/ext/rubysl/openssl/ossl_config.h +22 -0
  22. data/ext/rubysl/openssl/ossl_digest.c +259 -0
  23. data/ext/rubysl/openssl/ossl_digest.h +22 -0
  24. data/ext/rubysl/openssl/ossl_engine.c +411 -0
  25. data/ext/rubysl/openssl/ossl_engine.h +20 -0
  26. data/ext/rubysl/openssl/ossl_hmac.c +268 -0
  27. data/ext/rubysl/openssl/ossl_hmac.h +19 -0
  28. data/ext/rubysl/openssl/ossl_ns_spki.c +257 -0
  29. data/ext/rubysl/openssl/ossl_ns_spki.h +21 -0
  30. data/ext/rubysl/openssl/ossl_ocsp.c +769 -0
  31. data/ext/rubysl/openssl/ossl_ocsp.h +24 -0
  32. data/ext/rubysl/openssl/ossl_pkcs12.c +210 -0
  33. data/ext/rubysl/openssl/ossl_pkcs12.h +15 -0
  34. data/ext/rubysl/openssl/ossl_pkcs5.c +99 -0
  35. data/ext/rubysl/openssl/ossl_pkcs5.h +6 -0
  36. data/ext/rubysl/openssl/ossl_pkcs7.c +1039 -0
  37. data/ext/rubysl/openssl/ossl_pkcs7.h +22 -0
  38. data/ext/rubysl/openssl/ossl_pkey.c +240 -0
  39. data/ext/rubysl/openssl/ossl_pkey.h +141 -0
  40. data/ext/rubysl/openssl/ossl_pkey_dh.c +532 -0
  41. data/ext/rubysl/openssl/ossl_pkey_dsa.c +484 -0
  42. data/ext/rubysl/openssl/ossl_pkey_ec.c +1593 -0
  43. data/ext/rubysl/openssl/ossl_pkey_rsa.c +593 -0
  44. data/ext/rubysl/openssl/ossl_rand.c +202 -0
  45. data/ext/rubysl/openssl/ossl_rand.h +20 -0
  46. data/ext/rubysl/openssl/ossl_ssl.c +1484 -0
  47. data/ext/rubysl/openssl/ossl_ssl.h +36 -0
  48. data/ext/rubysl/openssl/ossl_ssl_session.c +307 -0
  49. data/ext/rubysl/openssl/ossl_version.h +16 -0
  50. data/ext/rubysl/openssl/ossl_x509.c +104 -0
  51. data/ext/rubysl/openssl/ossl_x509.h +114 -0
  52. data/ext/rubysl/openssl/ossl_x509attr.c +274 -0
  53. data/ext/rubysl/openssl/ossl_x509cert.c +764 -0
  54. data/ext/rubysl/openssl/ossl_x509crl.c +535 -0
  55. data/ext/rubysl/openssl/ossl_x509ext.c +458 -0
  56. data/ext/rubysl/openssl/ossl_x509name.c +399 -0
  57. data/ext/rubysl/openssl/ossl_x509req.c +466 -0
  58. data/ext/rubysl/openssl/ossl_x509revoked.c +229 -0
  59. data/ext/rubysl/openssl/ossl_x509store.c +625 -0
  60. data/ext/rubysl/openssl/ruby_missing.h +41 -0
  61. data/lib/openssl.rb +1 -0
  62. data/lib/openssl/bn.rb +35 -0
  63. data/lib/openssl/buffering.rb +241 -0
  64. data/lib/openssl/cipher.rb +65 -0
  65. data/lib/openssl/config.rb +316 -0
  66. data/lib/openssl/digest.rb +61 -0
  67. data/lib/openssl/net/ftptls.rb +53 -0
  68. data/lib/openssl/net/telnets.rb +251 -0
  69. data/lib/openssl/pkcs7.rb +25 -0
  70. data/lib/openssl/ssl-internal.rb +187 -0
  71. data/lib/openssl/ssl.rb +1 -0
  72. data/lib/openssl/x509-internal.rb +153 -0
  73. data/lib/openssl/x509.rb +1 -0
  74. data/lib/rubysl/openssl.rb +28 -0
  75. data/lib/rubysl/openssl/version.rb +5 -0
  76. data/rubysl-openssl.gemspec +19 -18
  77. data/spec/cipher_spec.rb +16 -0
  78. data/spec/config/freeze_spec.rb +17 -0
  79. data/spec/hmac/digest_spec.rb +15 -0
  80. data/spec/hmac/hexdigest_spec.rb +15 -0
  81. data/spec/random/pseudo_bytes_spec.rb +5 -0
  82. data/spec/random/random_bytes_spec.rb +5 -0
  83. data/spec/random/shared/random_bytes.rb +28 -0
  84. data/spec/shared/constants.rb +11 -0
  85. data/spec/x509/name/parse_spec.rb +47 -0
  86. metadata +153 -89
  87. data/lib/rubysl-openssl.rb +0 -7
  88. data/lib/rubysl-openssl/version.rb +0 -5
@@ -0,0 +1,458 @@
1
+ /*
2
+ * $Id$
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'.)
10
+ */
11
+ #include "ossl.h"
12
+
13
+ #define WrapX509Ext(klass, obj, ext) do { \
14
+ if (!ext) { \
15
+ ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
16
+ } \
17
+ obj = Data_Wrap_Struct(klass, 0, X509_EXTENSION_free, ext); \
18
+ } while (0)
19
+ #define GetX509Ext(obj, ext) do { \
20
+ Data_Get_Struct(obj, X509_EXTENSION, ext); \
21
+ if (!ext) { \
22
+ ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
23
+ } \
24
+ } while (0)
25
+ #define SafeGetX509Ext(obj, ext) do { \
26
+ OSSL_Check_Kind(obj, cX509Ext); \
27
+ GetX509Ext(obj, ext); \
28
+ } while (0)
29
+ #define MakeX509ExtFactory(klass, obj, ctx) do { \
30
+ if (!(ctx = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
31
+ ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
32
+ X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, 0); \
33
+ obj = Data_Wrap_Struct(klass, 0, ossl_x509extfactory_free, ctx); \
34
+ } while (0)
35
+ #define GetX509ExtFactory(obj, ctx) do { \
36
+ Data_Get_Struct(obj, X509V3_CTX, ctx); \
37
+ if (!ctx) { \
38
+ ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \
39
+ } \
40
+ } while (0)
41
+
42
+ /*
43
+ * Classes
44
+ */
45
+ VALUE cX509Ext;
46
+ VALUE cX509ExtFactory;
47
+ VALUE eX509ExtError;
48
+
49
+ /*
50
+ * Public
51
+ */
52
+ VALUE
53
+ ossl_x509ext_new(X509_EXTENSION *ext)
54
+ {
55
+ X509_EXTENSION *new;
56
+ VALUE obj;
57
+
58
+ if (!ext) {
59
+ new = X509_EXTENSION_new();
60
+ } else {
61
+ new = X509_EXTENSION_dup(ext);
62
+ }
63
+ if (!new) {
64
+ ossl_raise(eX509ExtError, NULL);
65
+ }
66
+ WrapX509Ext(cX509Ext, obj, new);
67
+
68
+ return obj;
69
+ }
70
+
71
+ X509_EXTENSION *
72
+ GetX509ExtPtr(VALUE obj)
73
+ {
74
+ X509_EXTENSION *ext;
75
+
76
+ SafeGetX509Ext(obj, ext);
77
+
78
+ return ext;
79
+ }
80
+
81
+ X509_EXTENSION *
82
+ DupX509ExtPtr(VALUE obj)
83
+ {
84
+ X509_EXTENSION *ext, *new;
85
+
86
+ SafeGetX509Ext(obj, ext);
87
+ if (!(new = X509_EXTENSION_dup(ext))) {
88
+ ossl_raise(eX509ExtError, NULL);
89
+ }
90
+
91
+ return new;
92
+ }
93
+
94
+ /*
95
+ * Private
96
+ */
97
+ /*
98
+ * Ext factory
99
+ */
100
+ static void
101
+ ossl_x509extfactory_free(X509V3_CTX *ctx)
102
+ {
103
+ OPENSSL_free(ctx);
104
+ }
105
+
106
+ static VALUE
107
+ ossl_x509extfactory_alloc(VALUE klass)
108
+ {
109
+ X509V3_CTX *ctx;
110
+ VALUE obj;
111
+
112
+ MakeX509ExtFactory(klass, obj, ctx);
113
+
114
+ return obj;
115
+ }
116
+
117
+ static VALUE
118
+ ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert)
119
+ {
120
+ X509V3_CTX *ctx;
121
+
122
+ GetX509ExtFactory(self, ctx);
123
+ rb_iv_set(self, "@issuer_certificate", cert);
124
+ ctx->issuer_cert = GetX509CertPtr(cert); /* NO DUP NEEDED */
125
+
126
+ return cert;
127
+ }
128
+
129
+ static VALUE
130
+ ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert)
131
+ {
132
+ X509V3_CTX *ctx;
133
+
134
+ GetX509ExtFactory(self, ctx);
135
+ rb_iv_set(self, "@subject_certificate", cert);
136
+ ctx->subject_cert = GetX509CertPtr(cert); /* NO DUP NEEDED */
137
+
138
+ return cert;
139
+ }
140
+
141
+ static VALUE
142
+ ossl_x509extfactory_set_subject_req(VALUE self, VALUE req)
143
+ {
144
+ X509V3_CTX *ctx;
145
+
146
+ GetX509ExtFactory(self, ctx);
147
+ rb_iv_set(self, "@subject_request", req);
148
+ ctx->subject_req = GetX509ReqPtr(req); /* NO DUP NEEDED */
149
+
150
+ return req;
151
+ }
152
+
153
+ static VALUE
154
+ ossl_x509extfactory_set_crl(VALUE self, VALUE crl)
155
+ {
156
+ X509V3_CTX *ctx;
157
+
158
+ GetX509ExtFactory(self, ctx);
159
+ rb_iv_set(self, "@crl", crl);
160
+ ctx->crl = GetX509CRLPtr(crl); /* NO DUP NEEDED */
161
+
162
+ return crl;
163
+ }
164
+
165
+ static VALUE
166
+ ossl_x509extfactory_set_config(VALUE self, VALUE config)
167
+ {
168
+ #ifdef HAVE_X509V3_SET_NCONF
169
+ X509V3_CTX *ctx;
170
+ CONF *conf;
171
+
172
+ GetX509ExtFactory(self, ctx);
173
+ rb_iv_set(self, "@config", config);
174
+ conf = GetConfigPtr(config); /* NO DUP NEEDED */
175
+ X509V3_set_nconf(ctx, conf);
176
+
177
+ return config;
178
+ #else
179
+ rb_notimplement();
180
+ #endif
181
+ }
182
+
183
+ static VALUE
184
+ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
185
+ {
186
+ /*X509V3_CTX *ctx;*/
187
+ VALUE issuer_cert, subject_cert, subject_req, crl;
188
+
189
+ /*GetX509ExtFactory(self, ctx);*/
190
+
191
+ rb_scan_args(argc, argv, "04",
192
+ &issuer_cert, &subject_cert, &subject_req, &crl);
193
+ if (!NIL_P(issuer_cert))
194
+ ossl_x509extfactory_set_issuer_cert(self, issuer_cert);
195
+ if (!NIL_P(subject_cert))
196
+ ossl_x509extfactory_set_subject_cert(self, subject_cert);
197
+ if (!NIL_P(subject_req))
198
+ ossl_x509extfactory_set_subject_req(self, subject_req);
199
+ if (!NIL_P(crl))
200
+ ossl_x509extfactory_set_crl(self, crl);
201
+ rb_iv_set(self, "@config", Qnil);
202
+
203
+ return self;
204
+ }
205
+
206
+ /*
207
+ * Array to X509_EXTENSION
208
+ * Structure:
209
+ * ["ln", "value", bool_critical] or
210
+ * ["sn", "value", bool_critical] or
211
+ * ["ln", "critical,value"] or the same for sn
212
+ * ["ln", "value"] => not critical
213
+ */
214
+ static VALUE
215
+ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
216
+ {
217
+ X509V3_CTX *ctx;
218
+ X509_EXTENSION *ext;
219
+ VALUE oid, value, critical, valstr, obj;
220
+ int nid;
221
+ #ifdef HAVE_X509V3_EXT_NCONF_NID
222
+ VALUE rconf;
223
+ CONF *conf;
224
+ #else
225
+ static LHASH *empty_lhash;
226
+ #endif
227
+
228
+ rb_scan_args(argc, argv, "21", &oid, &value, &critical);
229
+ StringValue(oid);
230
+ StringValue(value);
231
+ if(NIL_P(critical)) critical = Qfalse;
232
+
233
+ nid = OBJ_ln2nid(RSTRING_PTR(oid));
234
+ if(!nid) nid = OBJ_sn2nid(RSTRING_PTR(oid));
235
+ if(!nid) ossl_raise(eX509ExtError, "unknown OID `%s'", RSTRING_PTR(oid));
236
+ valstr = rb_str_new2(RTEST(critical) ? "critical," : "");
237
+ rb_str_append(valstr, value);
238
+ GetX509ExtFactory(self, ctx);
239
+ #ifdef HAVE_X509V3_EXT_NCONF_NID
240
+ rconf = rb_iv_get(self, "@config");
241
+ conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
242
+ ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
243
+ #else
244
+ if (!empty_lhash) empty_lhash = lh_new(NULL, NULL);
245
+ ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, RSTRING_PTR(valstr));
246
+ #endif
247
+ if (!ext){
248
+ ossl_raise(eX509ExtError, "%s = %s",
249
+ RSTRING_PTR(oid), RSTRING_PTR(value));
250
+ }
251
+ WrapX509Ext(cX509Ext, obj, ext);
252
+
253
+ return obj;
254
+ }
255
+
256
+ /*
257
+ * Ext
258
+ */
259
+ static VALUE
260
+ ossl_x509ext_alloc(VALUE klass)
261
+ {
262
+ X509_EXTENSION *ext;
263
+ VALUE obj;
264
+
265
+ if(!(ext = X509_EXTENSION_new())){
266
+ ossl_raise(eX509ExtError, NULL);
267
+ }
268
+ WrapX509Ext(klass, obj, ext);
269
+
270
+ return obj;
271
+ }
272
+
273
+ static VALUE
274
+ ossl_x509ext_initialize(int argc, VALUE *argv, VALUE self)
275
+ {
276
+ VALUE oid, value, critical;
277
+ const unsigned char *p;
278
+ X509_EXTENSION *ext;
279
+
280
+ GetX509Ext(self, ext);
281
+ if(rb_scan_args(argc, argv, "12", &oid, &value, &critical) == 1){
282
+ oid = ossl_to_der_if_possible(oid);
283
+ StringValue(oid);
284
+ p = (const unsigned char*) RSTRING_PTR(oid);
285
+ if(!d2i_X509_EXTENSION((X509_EXTENSION**)&DATA_PTR(self),
286
+ &p, RSTRING_LEN(oid)))
287
+ ossl_raise(eX509ExtError, NULL);
288
+ return self;
289
+ }
290
+ rb_funcall(self, rb_intern("oid="), 1, oid);
291
+ rb_funcall(self, rb_intern("value="), 1, value);
292
+ if(argc > 2) rb_funcall(self, rb_intern("critical="), 1, critical);
293
+
294
+ return self;
295
+ }
296
+
297
+ static VALUE
298
+ ossl_x509ext_set_oid(VALUE self, VALUE oid)
299
+ {
300
+ X509_EXTENSION *ext;
301
+ ASN1_OBJECT *obj;
302
+ char *s;
303
+
304
+ s = StringValuePtr(oid);
305
+ obj = OBJ_txt2obj(s, 0);
306
+ if(!obj) obj = OBJ_txt2obj(s, 1);
307
+ if(!obj) ossl_raise(eX509ExtError, NULL);
308
+ GetX509Ext(self, ext);
309
+ X509_EXTENSION_set_object(ext, obj);
310
+
311
+ return oid;
312
+ }
313
+
314
+ static VALUE
315
+ ossl_x509ext_set_value(VALUE self, VALUE data)
316
+ {
317
+ X509_EXTENSION *ext;
318
+ ASN1_OCTET_STRING *asn1s;
319
+ char *s;
320
+
321
+ data = ossl_to_der_if_possible(data);
322
+ StringValue(data);
323
+ if(!(s = OPENSSL_malloc(RSTRING_LEN(data))))
324
+ ossl_raise(eX509ExtError, "malloc error");
325
+ memcpy(s, RSTRING_PTR(data), RSTRING_LEN(data));
326
+ if(!(asn1s = ASN1_OCTET_STRING_new())){
327
+ OPENSSL_free(s);
328
+ ossl_raise(eX509ExtError, NULL);
329
+ }
330
+ if(!M_ASN1_OCTET_STRING_set(asn1s, s, RSTRING_LEN(data))){
331
+ OPENSSL_free(s);
332
+ ASN1_OCTET_STRING_free(asn1s);
333
+ ossl_raise(eX509ExtError, NULL);
334
+ }
335
+ OPENSSL_free(s);
336
+ GetX509Ext(self, ext);
337
+ X509_EXTENSION_set_data(ext, asn1s);
338
+
339
+ return data;
340
+ }
341
+
342
+ static VALUE
343
+ ossl_x509ext_set_critical(VALUE self, VALUE flag)
344
+ {
345
+ X509_EXTENSION *ext;
346
+
347
+ GetX509Ext(self, ext);
348
+ X509_EXTENSION_set_critical(ext, RTEST(flag) ? 1 : 0);
349
+
350
+ return flag;
351
+ }
352
+
353
+ static VALUE
354
+ ossl_x509ext_get_oid(VALUE obj)
355
+ {
356
+ X509_EXTENSION *ext;
357
+ ASN1_OBJECT *extobj;
358
+ BIO *out;
359
+ VALUE ret;
360
+ int nid;
361
+
362
+ GetX509Ext(obj, ext);
363
+ extobj = X509_EXTENSION_get_object(ext);
364
+ if ((nid = OBJ_obj2nid(extobj)) != NID_undef)
365
+ ret = rb_str_new2(OBJ_nid2sn(nid));
366
+ else{
367
+ if (!(out = BIO_new(BIO_s_mem())))
368
+ ossl_raise(eX509ExtError, NULL);
369
+ i2a_ASN1_OBJECT(out, extobj);
370
+ ret = ossl_membio2str(out);
371
+ }
372
+
373
+ return ret;
374
+ }
375
+
376
+ static VALUE
377
+ ossl_x509ext_get_value(VALUE obj)
378
+ {
379
+ X509_EXTENSION *ext;
380
+ BIO *out;
381
+ VALUE ret;
382
+
383
+ GetX509Ext(obj, ext);
384
+ if (!(out = BIO_new(BIO_s_mem())))
385
+ ossl_raise(eX509ExtError, NULL);
386
+ if (!X509V3_EXT_print(out, ext, 0, 0))
387
+ M_ASN1_OCTET_STRING_print(out, ext->value);
388
+ ret = ossl_membio2str(out);
389
+
390
+ return ret;
391
+ }
392
+
393
+ static VALUE
394
+ ossl_x509ext_get_critical(VALUE obj)
395
+ {
396
+ X509_EXTENSION *ext;
397
+
398
+ GetX509Ext(obj, ext);
399
+ return X509_EXTENSION_get_critical(ext) ? Qtrue : Qfalse;
400
+ }
401
+
402
+ static VALUE
403
+ ossl_x509ext_to_der(VALUE obj)
404
+ {
405
+ X509_EXTENSION *ext;
406
+ unsigned char *p;
407
+ long len;
408
+ VALUE str;
409
+
410
+ GetX509Ext(obj, ext);
411
+ if((len = i2d_X509_EXTENSION(ext, NULL)) <= 0)
412
+ ossl_raise(eX509ExtError, NULL);
413
+ str = rb_str_new(0, len);
414
+ p = RSTRING_PTR(str);
415
+ if(i2d_X509_EXTENSION(ext, &p) < 0)
416
+ ossl_raise(eX509ExtError, NULL);
417
+ ossl_str_adjust(str, p);
418
+
419
+ return str;
420
+ }
421
+
422
+ /*
423
+ * INIT
424
+ */
425
+ void
426
+ Init_ossl_x509ext()
427
+ {
428
+ eX509ExtError = rb_define_class_under(mX509, "ExtensionError", eOSSLError);
429
+
430
+ cX509ExtFactory = rb_define_class_under(mX509, "ExtensionFactory", rb_cObject);
431
+
432
+ rb_define_alloc_func(cX509ExtFactory, ossl_x509extfactory_alloc);
433
+ rb_define_method(cX509ExtFactory, "initialize", ossl_x509extfactory_initialize, -1);
434
+
435
+ rb_attr(cX509ExtFactory, rb_intern("issuer_certificate"), 1, 0, Qfalse);
436
+ rb_attr(cX509ExtFactory, rb_intern("subject_certificate"), 1, 0, Qfalse);
437
+ rb_attr(cX509ExtFactory, rb_intern("subject_request"), 1, 0, Qfalse);
438
+ rb_attr(cX509ExtFactory, rb_intern("crl"), 1, 0, Qfalse);
439
+ rb_attr(cX509ExtFactory, rb_intern("config"), 1, 0, Qfalse);
440
+
441
+ rb_define_method(cX509ExtFactory, "issuer_certificate=", ossl_x509extfactory_set_issuer_cert, 1);
442
+ rb_define_method(cX509ExtFactory, "subject_certificate=", ossl_x509extfactory_set_subject_cert, 1);
443
+ rb_define_method(cX509ExtFactory, "subject_request=", ossl_x509extfactory_set_subject_req, 1);
444
+ rb_define_method(cX509ExtFactory, "crl=", ossl_x509extfactory_set_crl, 1);
445
+ rb_define_method(cX509ExtFactory, "config=", ossl_x509extfactory_set_config, 1);
446
+ rb_define_method(cX509ExtFactory, "create_ext", ossl_x509extfactory_create_ext, -1);
447
+
448
+ cX509Ext = rb_define_class_under(mX509, "Extension", rb_cObject);
449
+ rb_define_alloc_func(cX509Ext, ossl_x509ext_alloc);
450
+ rb_define_method(cX509Ext, "initialize", ossl_x509ext_initialize, -1);
451
+ rb_define_method(cX509Ext, "oid=", ossl_x509ext_set_oid, 1);
452
+ rb_define_method(cX509Ext, "value=", ossl_x509ext_set_value, 1);
453
+ rb_define_method(cX509Ext, "critical=", ossl_x509ext_set_critical, 1);
454
+ rb_define_method(cX509Ext, "oid", ossl_x509ext_get_oid, 0);
455
+ rb_define_method(cX509Ext, "value", ossl_x509ext_get_value, 0);
456
+ rb_define_method(cX509Ext, "critical?", ossl_x509ext_get_critical, 0);
457
+ rb_define_method(cX509Ext, "to_der", ossl_x509ext_to_der, 0);
458
+ }