openssl 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openssl might be problematic. Click here for more details.

Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/BSDL +22 -0
  3. data/CONTRIBUTING.md +130 -0
  4. data/History.md +118 -0
  5. data/LICENSE.txt +56 -0
  6. data/README.md +70 -0
  7. data/ext/openssl/deprecation.rb +26 -0
  8. data/ext/openssl/extconf.rb +158 -0
  9. data/ext/openssl/openssl_missing.c +173 -0
  10. data/ext/openssl/openssl_missing.h +244 -0
  11. data/ext/openssl/ossl.c +1201 -0
  12. data/ext/openssl/ossl.h +222 -0
  13. data/ext/openssl/ossl_asn1.c +1992 -0
  14. data/ext/openssl/ossl_asn1.h +66 -0
  15. data/ext/openssl/ossl_bio.c +87 -0
  16. data/ext/openssl/ossl_bio.h +19 -0
  17. data/ext/openssl/ossl_bn.c +1153 -0
  18. data/ext/openssl/ossl_bn.h +23 -0
  19. data/ext/openssl/ossl_cipher.c +1085 -0
  20. data/ext/openssl/ossl_cipher.h +20 -0
  21. data/ext/openssl/ossl_config.c +89 -0
  22. data/ext/openssl/ossl_config.h +19 -0
  23. data/ext/openssl/ossl_digest.c +453 -0
  24. data/ext/openssl/ossl_digest.h +20 -0
  25. data/ext/openssl/ossl_engine.c +580 -0
  26. data/ext/openssl/ossl_engine.h +19 -0
  27. data/ext/openssl/ossl_hmac.c +398 -0
  28. data/ext/openssl/ossl_hmac.h +18 -0
  29. data/ext/openssl/ossl_ns_spki.c +406 -0
  30. data/ext/openssl/ossl_ns_spki.h +19 -0
  31. data/ext/openssl/ossl_ocsp.c +2013 -0
  32. data/ext/openssl/ossl_ocsp.h +23 -0
  33. data/ext/openssl/ossl_pkcs12.c +259 -0
  34. data/ext/openssl/ossl_pkcs12.h +13 -0
  35. data/ext/openssl/ossl_pkcs5.c +180 -0
  36. data/ext/openssl/ossl_pkcs5.h +6 -0
  37. data/ext/openssl/ossl_pkcs7.c +1125 -0
  38. data/ext/openssl/ossl_pkcs7.h +20 -0
  39. data/ext/openssl/ossl_pkey.c +435 -0
  40. data/ext/openssl/ossl_pkey.h +245 -0
  41. data/ext/openssl/ossl_pkey_dh.c +650 -0
  42. data/ext/openssl/ossl_pkey_dsa.c +672 -0
  43. data/ext/openssl/ossl_pkey_ec.c +1899 -0
  44. data/ext/openssl/ossl_pkey_rsa.c +768 -0
  45. data/ext/openssl/ossl_rand.c +238 -0
  46. data/ext/openssl/ossl_rand.h +18 -0
  47. data/ext/openssl/ossl_ssl.c +2679 -0
  48. data/ext/openssl/ossl_ssl.h +41 -0
  49. data/ext/openssl/ossl_ssl_session.c +352 -0
  50. data/ext/openssl/ossl_version.h +15 -0
  51. data/ext/openssl/ossl_x509.c +186 -0
  52. data/ext/openssl/ossl_x509.h +119 -0
  53. data/ext/openssl/ossl_x509attr.c +328 -0
  54. data/ext/openssl/ossl_x509cert.c +860 -0
  55. data/ext/openssl/ossl_x509crl.c +565 -0
  56. data/ext/openssl/ossl_x509ext.c +480 -0
  57. data/ext/openssl/ossl_x509name.c +547 -0
  58. data/ext/openssl/ossl_x509req.c +492 -0
  59. data/ext/openssl/ossl_x509revoked.c +279 -0
  60. data/ext/openssl/ossl_x509store.c +846 -0
  61. data/ext/openssl/ruby_missing.h +32 -0
  62. data/lib/openssl.rb +21 -0
  63. data/lib/openssl/bn.rb +39 -0
  64. data/lib/openssl/buffering.rb +451 -0
  65. data/lib/openssl/cipher.rb +67 -0
  66. data/lib/openssl/config.rb +473 -0
  67. data/lib/openssl/digest.rb +78 -0
  68. data/lib/openssl/pkey.rb +44 -0
  69. data/lib/openssl/ssl.rb +416 -0
  70. data/lib/openssl/x509.rb +176 -0
  71. metadata +178 -0
@@ -0,0 +1,547 @@
1
+ /*
2
+ * 'OpenSSL for Ruby' project
3
+ * Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
4
+ * All rights reserved.
5
+ */
6
+ /*
7
+ * This program is licensed under the same licence as Ruby.
8
+ * (See the file 'LICENCE'.)
9
+ */
10
+ #include "ossl.h"
11
+
12
+ #define NewX509Name(klass) \
13
+ TypedData_Wrap_Struct((klass), &ossl_x509name_type, 0)
14
+ #define SetX509Name(obj, name) do { \
15
+ if (!(name)) { \
16
+ ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
17
+ } \
18
+ RTYPEDDATA_DATA(obj) = (name); \
19
+ } while (0)
20
+ #define GetX509Name(obj, name) do { \
21
+ TypedData_Get_Struct((obj), X509_NAME, &ossl_x509name_type, (name)); \
22
+ if (!(name)) { \
23
+ ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
24
+ } \
25
+ } while (0)
26
+ #define SafeGetX509Name(obj, name) do { \
27
+ OSSL_Check_Kind((obj), cX509Name); \
28
+ GetX509Name((obj), (name)); \
29
+ } while (0)
30
+
31
+ #define OBJECT_TYPE_TEMPLATE \
32
+ rb_const_get(cX509Name, rb_intern("OBJECT_TYPE_TEMPLATE"))
33
+ #define DEFAULT_OBJECT_TYPE \
34
+ rb_const_get(cX509Name, rb_intern("DEFAULT_OBJECT_TYPE"))
35
+
36
+ /*
37
+ * Classes
38
+ */
39
+ VALUE cX509Name;
40
+ VALUE eX509NameError;
41
+
42
+ static void
43
+ ossl_x509name_free(void *ptr)
44
+ {
45
+ X509_NAME_free(ptr);
46
+ }
47
+
48
+ static const rb_data_type_t ossl_x509name_type = {
49
+ "OpenSSL/X509/NAME",
50
+ {
51
+ 0, ossl_x509name_free,
52
+ },
53
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
54
+ };
55
+
56
+ /*
57
+ * Public
58
+ */
59
+ VALUE
60
+ ossl_x509name_new(X509_NAME *name)
61
+ {
62
+ X509_NAME *new;
63
+ VALUE obj;
64
+
65
+ obj = NewX509Name(cX509Name);
66
+ if (!name) {
67
+ new = X509_NAME_new();
68
+ } else {
69
+ new = X509_NAME_dup(name);
70
+ }
71
+ if (!new) {
72
+ ossl_raise(eX509NameError, NULL);
73
+ }
74
+ SetX509Name(obj, new);
75
+
76
+ return obj;
77
+ }
78
+
79
+ X509_NAME *
80
+ GetX509NamePtr(VALUE obj)
81
+ {
82
+ X509_NAME *name;
83
+
84
+ SafeGetX509Name(obj, name);
85
+
86
+ return name;
87
+ }
88
+
89
+ /*
90
+ * Private
91
+ */
92
+ static VALUE
93
+ ossl_x509name_alloc(VALUE klass)
94
+ {
95
+ X509_NAME *name;
96
+ VALUE obj;
97
+
98
+ obj = NewX509Name(klass);
99
+ if (!(name = X509_NAME_new())) {
100
+ ossl_raise(eX509NameError, NULL);
101
+ }
102
+ SetX509Name(obj, name);
103
+
104
+ return obj;
105
+ }
106
+
107
+ static ID id_aref;
108
+ static VALUE ossl_x509name_add_entry(int, VALUE*, VALUE);
109
+ #define rb_aref(obj, key) rb_funcall((obj), id_aref, 1, (key))
110
+
111
+ static VALUE
112
+ ossl_x509name_init_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
113
+ {
114
+ VALUE self = rb_ary_entry(args, 0);
115
+ VALUE template = rb_ary_entry(args, 1);
116
+ VALUE entry[3];
117
+
118
+ Check_Type(i, T_ARRAY);
119
+ entry[0] = rb_ary_entry(i, 0);
120
+ entry[1] = rb_ary_entry(i, 1);
121
+ entry[2] = rb_ary_entry(i, 2);
122
+ if(NIL_P(entry[2])) entry[2] = rb_aref(template, entry[0]);
123
+ if(NIL_P(entry[2])) entry[2] = DEFAULT_OBJECT_TYPE;
124
+ ossl_x509name_add_entry(3, entry, self);
125
+
126
+ return Qnil;
127
+ }
128
+
129
+ /*
130
+ * call-seq:
131
+ * X509::Name.new => name
132
+ * X509::Name.new(der) => name
133
+ * X509::Name.new(distinguished_name) => name
134
+ * X509::Name.new(distinguished_name, template) => name
135
+ *
136
+ * Creates a new Name.
137
+ *
138
+ * A name may be created from a DER encoded string +der+, an Array
139
+ * representing a +distinguished_name+ or a +distinguished_name+ along with a
140
+ * +template+.
141
+ *
142
+ * name = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']]
143
+ *
144
+ * name = OpenSSL::X509::Name.new name.to_der
145
+ *
146
+ * See add_entry for a description of the +distinguished_name+ Array's
147
+ * contents
148
+ */
149
+ static VALUE
150
+ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
151
+ {
152
+ X509_NAME *name;
153
+ VALUE arg, template;
154
+
155
+ GetX509Name(self, name);
156
+ if (rb_scan_args(argc, argv, "02", &arg, &template) == 0) {
157
+ return self;
158
+ }
159
+ else {
160
+ VALUE tmp = rb_check_array_type(arg);
161
+ if (!NIL_P(tmp)) {
162
+ VALUE args;
163
+ if(NIL_P(template)) template = OBJECT_TYPE_TEMPLATE;
164
+ args = rb_ary_new3(2, self, template);
165
+ rb_block_call(tmp, rb_intern("each"), 0, 0, ossl_x509name_init_i, args);
166
+ }
167
+ else{
168
+ const unsigned char *p;
169
+ VALUE str = ossl_to_der_if_possible(arg);
170
+ X509_NAME *x;
171
+ StringValue(str);
172
+ p = (unsigned char *)RSTRING_PTR(str);
173
+ x = d2i_X509_NAME(&name, &p, RSTRING_LEN(str));
174
+ DATA_PTR(self) = name;
175
+ if(!x){
176
+ ossl_raise(eX509NameError, NULL);
177
+ }
178
+ }
179
+ }
180
+
181
+ return self;
182
+ }
183
+
184
+ static VALUE
185
+ ossl_x509name_initialize_copy(VALUE self, VALUE other)
186
+ {
187
+ X509_NAME *name, *name_other, *name_new;
188
+
189
+ rb_check_frozen(self);
190
+ GetX509Name(self, name);
191
+ SafeGetX509Name(other, name_other);
192
+
193
+ name_new = X509_NAME_dup(name_other);
194
+ if (!name_new)
195
+ ossl_raise(eX509NameError, "X509_NAME_dup");
196
+
197
+ SetX509Name(self, name_new);
198
+ X509_NAME_free(name);
199
+
200
+ return self;
201
+ }
202
+
203
+ /*
204
+ * call-seq:
205
+ * name.add_entry(oid, value [, type]) => self
206
+ *
207
+ * Adds a new entry with the given +oid+ and +value+ to this name. The +oid+
208
+ * is an object identifier defined in ASN.1. Some common OIDs are:
209
+ *
210
+ * C:: Country Name
211
+ * CN:: Common Name
212
+ * DC:: Domain Component
213
+ * O:: Organization Name
214
+ * OU:: Organizational Unit Name
215
+ * ST:: State or Province Name
216
+ */
217
+ static
218
+ VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self)
219
+ {
220
+ X509_NAME *name;
221
+ VALUE oid, value, type;
222
+ const char *oid_name;
223
+
224
+ rb_scan_args(argc, argv, "21", &oid, &value, &type);
225
+ oid_name = StringValueCStr(oid);
226
+ StringValue(value);
227
+ if(NIL_P(type)) type = rb_aref(OBJECT_TYPE_TEMPLATE, oid);
228
+ GetX509Name(self, name);
229
+ if (!X509_NAME_add_entry_by_txt(name, oid_name, NUM2INT(type),
230
+ (const unsigned char *)RSTRING_PTR(value), RSTRING_LENINT(value), -1, 0)) {
231
+ ossl_raise(eX509NameError, NULL);
232
+ }
233
+
234
+ return self;
235
+ }
236
+
237
+ static VALUE
238
+ ossl_x509name_to_s_old(VALUE self)
239
+ {
240
+ X509_NAME *name;
241
+ char *buf;
242
+ VALUE str;
243
+
244
+ GetX509Name(self, name);
245
+ buf = X509_NAME_oneline(name, NULL, 0);
246
+ str = rb_str_new2(buf);
247
+ OPENSSL_free(buf);
248
+
249
+ return str;
250
+ }
251
+
252
+ /*
253
+ * call-seq:
254
+ * name.to_s => string
255
+ * name.to_s(flags) => string
256
+ *
257
+ * Returns this name as a Distinguished Name string. +flags+ may be one of:
258
+ *
259
+ * * OpenSSL::X509::Name::COMPAT
260
+ * * OpenSSL::X509::Name::RFC2253
261
+ * * OpenSSL::X509::Name::ONELINE
262
+ * * OpenSSL::X509::Name::MULTILINE
263
+ */
264
+ static VALUE
265
+ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
266
+ {
267
+ X509_NAME *name;
268
+ VALUE flag, str;
269
+ BIO *out;
270
+ unsigned long iflag;
271
+
272
+ rb_scan_args(argc, argv, "01", &flag);
273
+ if (NIL_P(flag))
274
+ return ossl_x509name_to_s_old(self);
275
+ else iflag = NUM2ULONG(flag);
276
+ if (!(out = BIO_new(BIO_s_mem())))
277
+ ossl_raise(eX509NameError, NULL);
278
+ GetX509Name(self, name);
279
+ if (!X509_NAME_print_ex(out, name, 0, iflag)){
280
+ BIO_free(out);
281
+ ossl_raise(eX509NameError, NULL);
282
+ }
283
+ str = ossl_membio2str(out);
284
+
285
+ return str;
286
+ }
287
+
288
+ /*
289
+ * call-seq:
290
+ * name.to_a => [[name, data, type], ...]
291
+ *
292
+ * Returns an Array representation of the distinguished name suitable for
293
+ * passing to ::new
294
+ */
295
+ static VALUE
296
+ ossl_x509name_to_a(VALUE self)
297
+ {
298
+ X509_NAME *name;
299
+ X509_NAME_ENTRY *entry;
300
+ int i,entries,nid;
301
+ char long_name[512];
302
+ const char *short_name;
303
+ VALUE ary, vname, ret;
304
+ ASN1_STRING *value;
305
+
306
+ GetX509Name(self, name);
307
+ entries = X509_NAME_entry_count(name);
308
+ if (entries < 0) {
309
+ OSSL_Debug("name entries < 0!");
310
+ return rb_ary_new();
311
+ }
312
+ ret = rb_ary_new2(entries);
313
+ for (i=0; i<entries; i++) {
314
+ if (!(entry = X509_NAME_get_entry(name, i))) {
315
+ ossl_raise(eX509NameError, NULL);
316
+ }
317
+ if (!i2t_ASN1_OBJECT(long_name, sizeof(long_name),
318
+ X509_NAME_ENTRY_get_object(entry))) {
319
+ ossl_raise(eX509NameError, NULL);
320
+ }
321
+ nid = OBJ_ln2nid(long_name);
322
+ if (nid == NID_undef) {
323
+ vname = rb_str_new2((const char *) &long_name);
324
+ } else {
325
+ short_name = OBJ_nid2sn(nid);
326
+ vname = rb_str_new2(short_name); /*do not free*/
327
+ }
328
+ value = X509_NAME_ENTRY_get_data(entry);
329
+ ary = rb_ary_new3(3, vname, asn1str_to_str(value), INT2NUM(value->type));
330
+ rb_ary_push(ret, ary);
331
+ }
332
+ return ret;
333
+ }
334
+
335
+ static int
336
+ ossl_x509name_cmp0(VALUE self, VALUE other)
337
+ {
338
+ X509_NAME *name1, *name2;
339
+
340
+ GetX509Name(self, name1);
341
+ SafeGetX509Name(other, name2);
342
+
343
+ return X509_NAME_cmp(name1, name2);
344
+ }
345
+
346
+ /*
347
+ * call-seq:
348
+ * name.cmp other => integer
349
+ * name.<=> other => integer
350
+ *
351
+ * Compares this Name with +other+ and returns 0 if they are the same and -1 or
352
+ * +1 if they are greater or less than each other respectively.
353
+ */
354
+ static VALUE
355
+ ossl_x509name_cmp(VALUE self, VALUE other)
356
+ {
357
+ int result;
358
+
359
+ result = ossl_x509name_cmp0(self, other);
360
+ if (result < 0) return INT2FIX(-1);
361
+ if (result > 1) return INT2FIX(1);
362
+
363
+ return INT2FIX(0);
364
+ }
365
+
366
+ /*
367
+ * call-seq:
368
+ * name.eql? other => boolean
369
+ *
370
+ * Returns true if +name+ and +other+ refer to the same hash key.
371
+ */
372
+ static VALUE
373
+ ossl_x509name_eql(VALUE self, VALUE other)
374
+ {
375
+ int result;
376
+
377
+ if(CLASS_OF(other) != cX509Name) return Qfalse;
378
+ result = ossl_x509name_cmp0(self, other);
379
+
380
+ return (result == 0) ? Qtrue : Qfalse;
381
+ }
382
+
383
+ /*
384
+ * call-seq:
385
+ * name.hash => integer
386
+ *
387
+ * The hash value returned is suitable for use as a certificate's filename in
388
+ * a CA path.
389
+ */
390
+ static VALUE
391
+ ossl_x509name_hash(VALUE self)
392
+ {
393
+ X509_NAME *name;
394
+ unsigned long hash;
395
+
396
+ GetX509Name(self, name);
397
+
398
+ hash = X509_NAME_hash(name);
399
+
400
+ return ULONG2NUM(hash);
401
+ }
402
+
403
+ #ifdef HAVE_X509_NAME_HASH_OLD
404
+ /*
405
+ * call-seq:
406
+ * name.hash_old => integer
407
+ *
408
+ * Returns an MD5 based hash used in OpenSSL 0.9.X.
409
+ */
410
+ static VALUE
411
+ ossl_x509name_hash_old(VALUE self)
412
+ {
413
+ X509_NAME *name;
414
+ unsigned long hash;
415
+
416
+ GetX509Name(self, name);
417
+
418
+ hash = X509_NAME_hash_old(name);
419
+
420
+ return ULONG2NUM(hash);
421
+ }
422
+ #endif
423
+
424
+ /*
425
+ * call-seq:
426
+ * name.to_der => string
427
+ *
428
+ * Converts the name to DER encoding
429
+ */
430
+ static VALUE
431
+ ossl_x509name_to_der(VALUE self)
432
+ {
433
+ X509_NAME *name;
434
+ VALUE str;
435
+ long len;
436
+ unsigned char *p;
437
+
438
+ GetX509Name(self, name);
439
+ if((len = i2d_X509_NAME(name, NULL)) <= 0)
440
+ ossl_raise(eX509NameError, NULL);
441
+ str = rb_str_new(0, len);
442
+ p = (unsigned char *)RSTRING_PTR(str);
443
+ if(i2d_X509_NAME(name, &p) <= 0)
444
+ ossl_raise(eX509NameError, NULL);
445
+ ossl_str_adjust(str, p);
446
+
447
+ return str;
448
+ }
449
+
450
+ /*
451
+ * Document-class: OpenSSL::X509::Name
452
+ *
453
+ * An X.509 name represents a hostname, email address or other entity
454
+ * associated with a public key.
455
+ *
456
+ * You can create a Name by parsing a distinguished name String or by
457
+ * supplying the distinguished name as an Array.
458
+ *
459
+ * name = OpenSSL::X509::Name.parse 'CN=nobody/DC=example'
460
+ *
461
+ * name = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']]
462
+ */
463
+
464
+ void
465
+ Init_ossl_x509name(void)
466
+ {
467
+ VALUE utf8str, ptrstr, ia5str, hash;
468
+
469
+ #if 0
470
+ mOSSL = rb_define_module("OpenSSL");
471
+ eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
472
+ mX509 = rb_define_module_under(mOSSL, "X509");
473
+ #endif
474
+
475
+ id_aref = rb_intern("[]");
476
+ eX509NameError = rb_define_class_under(mX509, "NameError", eOSSLError);
477
+ cX509Name = rb_define_class_under(mX509, "Name", rb_cObject);
478
+
479
+ rb_include_module(cX509Name, rb_mComparable);
480
+
481
+ rb_define_alloc_func(cX509Name, ossl_x509name_alloc);
482
+ rb_define_method(cX509Name, "initialize", ossl_x509name_initialize, -1);
483
+ rb_define_copy_func(cX509Name, ossl_x509name_initialize_copy);
484
+ rb_define_method(cX509Name, "add_entry", ossl_x509name_add_entry, -1);
485
+ rb_define_method(cX509Name, "to_s", ossl_x509name_to_s, -1);
486
+ rb_define_method(cX509Name, "to_a", ossl_x509name_to_a, 0);
487
+ rb_define_method(cX509Name, "cmp", ossl_x509name_cmp, 1);
488
+ rb_define_alias(cX509Name, "<=>", "cmp");
489
+ rb_define_method(cX509Name, "eql?", ossl_x509name_eql, 1);
490
+ rb_define_method(cX509Name, "hash", ossl_x509name_hash, 0);
491
+ #ifdef HAVE_X509_NAME_HASH_OLD
492
+ rb_define_method(cX509Name, "hash_old", ossl_x509name_hash_old, 0);
493
+ #endif
494
+ rb_define_method(cX509Name, "to_der", ossl_x509name_to_der, 0);
495
+
496
+ utf8str = INT2NUM(V_ASN1_UTF8STRING);
497
+ ptrstr = INT2NUM(V_ASN1_PRINTABLESTRING);
498
+ ia5str = INT2NUM(V_ASN1_IA5STRING);
499
+
500
+ /*
501
+ * The default object type for name entries.
502
+ */
503
+ rb_define_const(cX509Name, "DEFAULT_OBJECT_TYPE", utf8str);
504
+ hash = rb_hash_new();
505
+ RHASH_SET_IFNONE(hash, utf8str);
506
+ rb_hash_aset(hash, rb_str_new2("C"), ptrstr);
507
+ rb_hash_aset(hash, rb_str_new2("countryName"), ptrstr);
508
+ rb_hash_aset(hash, rb_str_new2("serialNumber"), ptrstr);
509
+ rb_hash_aset(hash, rb_str_new2("dnQualifier"), ptrstr);
510
+ rb_hash_aset(hash, rb_str_new2("DC"), ia5str);
511
+ rb_hash_aset(hash, rb_str_new2("domainComponent"), ia5str);
512
+ rb_hash_aset(hash, rb_str_new2("emailAddress"), ia5str);
513
+
514
+ /*
515
+ * The default object type template for name entries.
516
+ */
517
+ rb_define_const(cX509Name, "OBJECT_TYPE_TEMPLATE", hash);
518
+
519
+ /*
520
+ * A flag for #to_s.
521
+ *
522
+ * Breaks the name returned into multiple lines if longer than 80
523
+ * characters.
524
+ */
525
+ rb_define_const(cX509Name, "COMPAT", ULONG2NUM(XN_FLAG_COMPAT));
526
+
527
+ /*
528
+ * A flag for #to_s.
529
+ *
530
+ * Returns an RFC2253 format name.
531
+ */
532
+ rb_define_const(cX509Name, "RFC2253", ULONG2NUM(XN_FLAG_RFC2253));
533
+
534
+ /*
535
+ * A flag for #to_s.
536
+ *
537
+ * Returns a more readable format than RFC2253.
538
+ */
539
+ rb_define_const(cX509Name, "ONELINE", ULONG2NUM(XN_FLAG_ONELINE));
540
+
541
+ /*
542
+ * A flag for #to_s.
543
+ *
544
+ * Returns a multiline format.
545
+ */
546
+ rb_define_const(cX509Name, "MULTILINE", ULONG2NUM(XN_FLAG_MULTILINE));
547
+ }