openssl 3.3.3 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -0
- data/History.md +111 -0
- data/README.md +12 -11
- data/ext/openssl/extconf.rb +30 -70
- data/ext/openssl/openssl_missing.h +0 -210
- data/ext/openssl/ossl.c +295 -304
- data/ext/openssl/ossl.h +13 -9
- data/ext/openssl/ossl_asn1.c +598 -406
- data/ext/openssl/ossl_asn1.h +15 -1
- data/ext/openssl/ossl_bio.c +8 -4
- data/ext/openssl/ossl_bn.c +286 -291
- data/ext/openssl/ossl_cipher.c +257 -209
- data/ext/openssl/ossl_cipher.h +10 -1
- data/ext/openssl/ossl_config.c +1 -6
- data/ext/openssl/ossl_digest.c +74 -43
- data/ext/openssl/ossl_digest.h +9 -1
- data/ext/openssl/ossl_engine.c +39 -103
- data/ext/openssl/ossl_hmac.c +30 -36
- data/ext/openssl/ossl_kdf.c +42 -53
- data/ext/openssl/ossl_ns_spki.c +27 -32
- data/ext/openssl/ossl_ocsp.c +208 -236
- data/ext/openssl/ossl_pkcs12.c +26 -26
- data/ext/openssl/ossl_pkcs7.c +175 -145
- data/ext/openssl/ossl_pkey.c +102 -158
- data/ext/openssl/ossl_pkey.h +99 -100
- data/ext/openssl/ossl_pkey_dh.c +31 -68
- data/ext/openssl/ossl_pkey_dsa.c +15 -54
- data/ext/openssl/ossl_pkey_ec.c +180 -238
- data/ext/openssl/ossl_pkey_rsa.c +56 -103
- data/ext/openssl/ossl_provider.c +0 -5
- data/ext/openssl/ossl_rand.c +7 -14
- data/ext/openssl/ossl_ssl.c +535 -384
- data/ext/openssl/ossl_ssl.h +8 -8
- data/ext/openssl/ossl_ssl_session.c +93 -97
- data/ext/openssl/ossl_ts.c +78 -124
- data/ext/openssl/ossl_x509.c +9 -28
- data/ext/openssl/ossl_x509attr.c +33 -54
- data/ext/openssl/ossl_x509cert.c +70 -101
- data/ext/openssl/ossl_x509crl.c +78 -89
- data/ext/openssl/ossl_x509ext.c +43 -64
- data/ext/openssl/ossl_x509name.c +64 -90
- data/ext/openssl/ossl_x509req.c +55 -62
- data/ext/openssl/ossl_x509revoked.c +28 -42
- data/ext/openssl/ossl_x509store.c +36 -54
- data/lib/openssl/buffering.rb +30 -24
- data/lib/openssl/digest.rb +1 -1
- data/lib/openssl/pkey.rb +71 -49
- data/lib/openssl/ssl.rb +12 -79
- data/lib/openssl/version.rb +2 -1
- data/lib/openssl/x509.rb +9 -0
- data/lib/openssl.rb +9 -6
- metadata +1 -3
- data/ext/openssl/openssl_missing.c +0 -41
- data/lib/openssl/asn1.rb +0 -188
data/ext/openssl/ossl_x509cert.c
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
TypedData_Wrap_Struct((klass), &ossl_x509_type, 0)
|
|
14
14
|
#define SetX509(obj, x509) do { \
|
|
15
15
|
if (!(x509)) { \
|
|
16
|
-
|
|
16
|
+
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
|
|
17
17
|
} \
|
|
18
18
|
RTYPEDDATA_DATA(obj) = (x509); \
|
|
19
19
|
} while (0)
|
|
20
20
|
#define GetX509(obj, x509) do { \
|
|
21
21
|
TypedData_Get_Struct((obj), X509, &ossl_x509_type, (x509)); \
|
|
22
22
|
if (!(x509)) { \
|
|
23
|
-
|
|
23
|
+
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
|
|
24
24
|
} \
|
|
25
25
|
} while (0)
|
|
26
26
|
|
|
@@ -39,7 +39,7 @@ ossl_x509_free(void *ptr)
|
|
|
39
39
|
static const rb_data_type_t ossl_x509_type = {
|
|
40
40
|
"OpenSSL/X509",
|
|
41
41
|
{
|
|
42
|
-
|
|
42
|
+
0, ossl_x509_free,
|
|
43
43
|
},
|
|
44
44
|
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
|
45
45
|
};
|
|
@@ -54,15 +54,10 @@ ossl_x509_new(const X509 *x509)
|
|
|
54
54
|
VALUE obj;
|
|
55
55
|
|
|
56
56
|
obj = NewX509(cX509Cert);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
new = X509_dup((X509 *)x509);
|
|
62
|
-
}
|
|
63
|
-
if (!new) {
|
|
64
|
-
ossl_raise(eX509CertError, NULL);
|
|
65
|
-
}
|
|
57
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
58
|
+
new = X509_dup((X509 *)x509);
|
|
59
|
+
if (!new)
|
|
60
|
+
ossl_raise(eX509CertError, "X509_dup");
|
|
66
61
|
SetX509(obj, new);
|
|
67
62
|
|
|
68
63
|
return obj;
|
|
@@ -121,8 +116,8 @@ ossl_x509_initialize(int argc, VALUE *argv, VALUE self)
|
|
|
121
116
|
|
|
122
117
|
rb_check_frozen(self);
|
|
123
118
|
if (rb_scan_args(argc, argv, "01", &arg) == 0) {
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
/* create just empty X509Cert */
|
|
120
|
+
return self;
|
|
126
121
|
}
|
|
127
122
|
arg = ossl_to_der_if_possible(arg);
|
|
128
123
|
in = ossl_obj2bio(&arg);
|
|
@@ -141,6 +136,7 @@ ossl_x509_initialize(int argc, VALUE *argv, VALUE self)
|
|
|
141
136
|
return self;
|
|
142
137
|
}
|
|
143
138
|
|
|
139
|
+
/* :nodoc: */
|
|
144
140
|
static VALUE
|
|
145
141
|
ossl_x509_copy(VALUE self, VALUE other)
|
|
146
142
|
{
|
|
@@ -175,11 +171,11 @@ ossl_x509_to_der(VALUE self)
|
|
|
175
171
|
|
|
176
172
|
GetX509(self, x509);
|
|
177
173
|
if ((len = i2d_X509(x509, NULL)) <= 0)
|
|
178
|
-
|
|
174
|
+
ossl_raise(eX509CertError, NULL);
|
|
179
175
|
str = rb_str_new(0, len);
|
|
180
176
|
p = (unsigned char *)RSTRING_PTR(str);
|
|
181
177
|
if (i2d_X509(x509, &p) <= 0)
|
|
182
|
-
|
|
178
|
+
ossl_raise(eX509CertError, NULL);
|
|
183
179
|
ossl_str_adjust(str, p);
|
|
184
180
|
|
|
185
181
|
return str;
|
|
@@ -201,8 +197,8 @@ ossl_x509_to_pem(VALUE self)
|
|
|
201
197
|
if (!out) ossl_raise(eX509CertError, NULL);
|
|
202
198
|
|
|
203
199
|
if (!PEM_write_bio_X509(out, x509)) {
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
BIO_free(out);
|
|
201
|
+
ossl_raise(eX509CertError, NULL);
|
|
206
202
|
}
|
|
207
203
|
str = ossl_membio2str(out);
|
|
208
204
|
|
|
@@ -226,8 +222,8 @@ ossl_x509_to_text(VALUE self)
|
|
|
226
222
|
if (!out) ossl_raise(eX509CertError, NULL);
|
|
227
223
|
|
|
228
224
|
if (!X509_print(out, x509)) {
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
BIO_free(out);
|
|
226
|
+
ossl_raise(eX509CertError, NULL);
|
|
231
227
|
}
|
|
232
228
|
str = ossl_membio2str(out);
|
|
233
229
|
|
|
@@ -247,7 +243,7 @@ ossl_x509_to_req(VALUE self)
|
|
|
247
243
|
|
|
248
244
|
GetX509(self, x509);
|
|
249
245
|
if (!(req = X509_to_X509_REQ(x509, NULL, EVP_md5()))) {
|
|
250
|
-
|
|
246
|
+
ossl_raise(eX509CertError, NULL);
|
|
251
247
|
}
|
|
252
248
|
obj = ossl_x509req_new(req);
|
|
253
249
|
X509_REQ_free(req);
|
|
@@ -281,11 +277,11 @@ ossl_x509_set_version(VALUE self, VALUE version)
|
|
|
281
277
|
long ver;
|
|
282
278
|
|
|
283
279
|
if ((ver = NUM2LONG(version)) < 0) {
|
|
284
|
-
|
|
280
|
+
ossl_raise(eX509CertError, "version must be >= 0!");
|
|
285
281
|
}
|
|
286
282
|
GetX509(self, x509);
|
|
287
283
|
if (!X509_set_version(x509, ver)) {
|
|
288
|
-
|
|
284
|
+
ossl_raise(eX509CertError, NULL);
|
|
289
285
|
}
|
|
290
286
|
|
|
291
287
|
return version;
|
|
@@ -323,25 +319,23 @@ ossl_x509_set_serial(VALUE self, VALUE num)
|
|
|
323
319
|
/*
|
|
324
320
|
* call-seq:
|
|
325
321
|
* cert.signature_algorithm => string
|
|
322
|
+
*
|
|
323
|
+
* Returns the signature algorithm used to sign this certificate. This returns
|
|
324
|
+
* the algorithm name found in the TBSCertificate structure, not the outer
|
|
325
|
+
* \Certificate structure.
|
|
326
|
+
*
|
|
327
|
+
* Returns the long name of the signature algorithm, or the dotted decimal
|
|
328
|
+
* notation if \OpenSSL does not define a long name for it.
|
|
326
329
|
*/
|
|
327
330
|
static VALUE
|
|
328
331
|
ossl_x509_get_signature_algorithm(VALUE self)
|
|
329
332
|
{
|
|
330
333
|
X509 *x509;
|
|
331
|
-
|
|
332
|
-
VALUE str;
|
|
334
|
+
const ASN1_OBJECT *obj;
|
|
333
335
|
|
|
334
336
|
GetX509(self, x509);
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (!i2a_ASN1_OBJECT(out, X509_get0_tbs_sigalg(x509)->algorithm)) {
|
|
339
|
-
BIO_free(out);
|
|
340
|
-
ossl_raise(eX509CertError, NULL);
|
|
341
|
-
}
|
|
342
|
-
str = ossl_membio2str(out);
|
|
343
|
-
|
|
344
|
-
return str;
|
|
337
|
+
X509_ALGOR_get0(&obj, NULL, NULL, X509_get0_tbs_sigalg(x509));
|
|
338
|
+
return ossl_asn1obj_to_string_long_name(obj);
|
|
345
339
|
}
|
|
346
340
|
|
|
347
341
|
/*
|
|
@@ -356,7 +350,7 @@ ossl_x509_get_subject(VALUE self)
|
|
|
356
350
|
|
|
357
351
|
GetX509(self, x509);
|
|
358
352
|
if (!(name = X509_get_subject_name(x509))) { /* NO DUP - don't free! */
|
|
359
|
-
|
|
353
|
+
ossl_raise(eX509CertError, NULL);
|
|
360
354
|
}
|
|
361
355
|
|
|
362
356
|
return ossl_x509name_new(name);
|
|
@@ -373,7 +367,7 @@ ossl_x509_set_subject(VALUE self, VALUE subject)
|
|
|
373
367
|
|
|
374
368
|
GetX509(self, x509);
|
|
375
369
|
if (!X509_set_subject_name(x509, GetX509NamePtr(subject))) { /* DUPs name */
|
|
376
|
-
|
|
370
|
+
ossl_raise(eX509CertError, NULL);
|
|
377
371
|
}
|
|
378
372
|
|
|
379
373
|
return subject;
|
|
@@ -391,7 +385,7 @@ ossl_x509_get_issuer(VALUE self)
|
|
|
391
385
|
|
|
392
386
|
GetX509(self, x509);
|
|
393
387
|
if(!(name = X509_get_issuer_name(x509))) { /* NO DUP - don't free! */
|
|
394
|
-
|
|
388
|
+
ossl_raise(eX509CertError, NULL);
|
|
395
389
|
}
|
|
396
390
|
|
|
397
391
|
return ossl_x509name_new(name);
|
|
@@ -408,7 +402,7 @@ ossl_x509_set_issuer(VALUE self, VALUE issuer)
|
|
|
408
402
|
|
|
409
403
|
GetX509(self, x509);
|
|
410
404
|
if (!X509_set_issuer_name(x509, GetX509NamePtr(issuer))) { /* DUPs name */
|
|
411
|
-
|
|
405
|
+
ossl_raise(eX509CertError, NULL);
|
|
412
406
|
}
|
|
413
407
|
|
|
414
408
|
return issuer;
|
|
@@ -426,7 +420,7 @@ ossl_x509_get_not_before(VALUE self)
|
|
|
426
420
|
|
|
427
421
|
GetX509(self, x509);
|
|
428
422
|
if (!(asn1time = X509_get0_notBefore(x509))) {
|
|
429
|
-
|
|
423
|
+
ossl_raise(eX509CertError, NULL);
|
|
430
424
|
}
|
|
431
425
|
|
|
432
426
|
return asn1time_to_time(asn1time);
|
|
@@ -445,8 +439,8 @@ ossl_x509_set_not_before(VALUE self, VALUE time)
|
|
|
445
439
|
GetX509(self, x509);
|
|
446
440
|
asn1time = ossl_x509_time_adjust(NULL, time);
|
|
447
441
|
if (!X509_set1_notBefore(x509, asn1time)) {
|
|
448
|
-
|
|
449
|
-
|
|
442
|
+
ASN1_TIME_free(asn1time);
|
|
443
|
+
ossl_raise(eX509CertError, "X509_set_notBefore");
|
|
450
444
|
}
|
|
451
445
|
ASN1_TIME_free(asn1time);
|
|
452
446
|
|
|
@@ -465,7 +459,7 @@ ossl_x509_get_not_after(VALUE self)
|
|
|
465
459
|
|
|
466
460
|
GetX509(self, x509);
|
|
467
461
|
if (!(asn1time = X509_get0_notAfter(x509))) {
|
|
468
|
-
|
|
462
|
+
ossl_raise(eX509CertError, NULL);
|
|
469
463
|
}
|
|
470
464
|
|
|
471
465
|
return asn1time_to_time(asn1time);
|
|
@@ -484,8 +478,8 @@ ossl_x509_set_not_after(VALUE self, VALUE time)
|
|
|
484
478
|
GetX509(self, x509);
|
|
485
479
|
asn1time = ossl_x509_time_adjust(NULL, time);
|
|
486
480
|
if (!X509_set1_notAfter(x509, asn1time)) {
|
|
487
|
-
|
|
488
|
-
|
|
481
|
+
ASN1_TIME_free(asn1time);
|
|
482
|
+
ossl_raise(eX509CertError, "X509_set_notAfter");
|
|
489
483
|
}
|
|
490
484
|
ASN1_TIME_free(asn1time);
|
|
491
485
|
|
|
@@ -504,10 +498,10 @@ ossl_x509_get_public_key(VALUE self)
|
|
|
504
498
|
|
|
505
499
|
GetX509(self, x509);
|
|
506
500
|
if (!(pkey = X509_get_pubkey(x509))) { /* adds an reference */
|
|
507
|
-
|
|
501
|
+
ossl_raise(eX509CertError, NULL);
|
|
508
502
|
}
|
|
509
503
|
|
|
510
|
-
return
|
|
504
|
+
return ossl_pkey_wrap(pkey);
|
|
511
505
|
}
|
|
512
506
|
|
|
513
507
|
/*
|
|
@@ -524,7 +518,7 @@ ossl_x509_set_public_key(VALUE self, VALUE key)
|
|
|
524
518
|
pkey = GetPKeyPtr(key);
|
|
525
519
|
ossl_pkey_check_public_key(pkey);
|
|
526
520
|
if (!X509_set_pubkey(x509, pkey))
|
|
527
|
-
|
|
521
|
+
ossl_raise(eX509CertError, "X509_set_pubkey");
|
|
528
522
|
return key;
|
|
529
523
|
}
|
|
530
524
|
|
|
@@ -538,17 +532,14 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest)
|
|
|
538
532
|
X509 *x509;
|
|
539
533
|
EVP_PKEY *pkey;
|
|
540
534
|
const EVP_MD *md;
|
|
535
|
+
VALUE md_holder;
|
|
541
536
|
|
|
542
537
|
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
} else {
|
|
546
|
-
md = ossl_evp_get_digestbyname(digest);
|
|
547
|
-
}
|
|
538
|
+
/* NULL needed for some key types, e.g. Ed25519 */
|
|
539
|
+
md = NIL_P(digest) ? NULL : ossl_evp_md_fetch(digest, &md_holder);
|
|
548
540
|
GetX509(self, x509);
|
|
549
|
-
if (!X509_sign(x509, pkey, md))
|
|
550
|
-
|
|
551
|
-
}
|
|
541
|
+
if (!X509_sign(x509, pkey, md))
|
|
542
|
+
ossl_raise(eX509CertError, "X509_sign");
|
|
552
543
|
|
|
553
544
|
return self;
|
|
554
545
|
}
|
|
@@ -571,12 +562,12 @@ ossl_x509_verify(VALUE self, VALUE key)
|
|
|
571
562
|
ossl_pkey_check_public_key(pkey);
|
|
572
563
|
switch (X509_verify(x509, pkey)) {
|
|
573
564
|
case 1:
|
|
574
|
-
|
|
565
|
+
return Qtrue;
|
|
575
566
|
case 0:
|
|
576
|
-
|
|
577
|
-
|
|
567
|
+
ossl_clear_error();
|
|
568
|
+
return Qfalse;
|
|
578
569
|
default:
|
|
579
|
-
|
|
570
|
+
ossl_raise(eX509CertError, NULL);
|
|
580
571
|
}
|
|
581
572
|
}
|
|
582
573
|
|
|
@@ -597,8 +588,8 @@ ossl_x509_check_private_key(VALUE self, VALUE key)
|
|
|
597
588
|
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
|
|
598
589
|
GetX509(self, x509);
|
|
599
590
|
if (!X509_check_private_key(x509, pkey)) {
|
|
600
|
-
|
|
601
|
-
|
|
591
|
+
ossl_clear_error();
|
|
592
|
+
return Qfalse;
|
|
602
593
|
}
|
|
603
594
|
|
|
604
595
|
return Qtrue;
|
|
@@ -617,13 +608,10 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
617
608
|
|
|
618
609
|
GetX509(self, x509);
|
|
619
610
|
count = X509_get_ext_count(x509);
|
|
620
|
-
|
|
621
|
-
return rb_ary_new();
|
|
622
|
-
}
|
|
623
|
-
ary = rb_ary_new2(count);
|
|
611
|
+
ary = rb_ary_new_capa(count);
|
|
624
612
|
for (i=0; i<count; i++) {
|
|
625
|
-
|
|
626
|
-
|
|
613
|
+
const X509_EXTENSION *ext = X509_get_ext(x509, i);
|
|
614
|
+
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
627
615
|
}
|
|
628
616
|
|
|
629
617
|
return ary;
|
|
@@ -643,16 +631,16 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
|
|
|
643
631
|
Check_Type(ary, T_ARRAY);
|
|
644
632
|
/* All ary's members should be X509Extension */
|
|
645
633
|
for (i=0; i<RARRAY_LEN(ary); i++) {
|
|
646
|
-
|
|
634
|
+
OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Ext);
|
|
647
635
|
}
|
|
648
636
|
GetX509(self, x509);
|
|
649
637
|
for (i = X509_get_ext_count(x509); i > 0; i--)
|
|
650
638
|
X509_EXTENSION_free(X509_delete_ext(x509, 0));
|
|
651
639
|
for (i=0; i<RARRAY_LEN(ary); i++) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
640
|
+
ext = GetX509ExtPtr(RARRAY_AREF(ary, i));
|
|
641
|
+
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext */
|
|
642
|
+
ossl_raise(eX509CertError, "X509_add_ext");
|
|
643
|
+
}
|
|
656
644
|
}
|
|
657
645
|
|
|
658
646
|
return ary;
|
|
@@ -671,32 +659,24 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
|
|
|
671
659
|
GetX509(self, x509);
|
|
672
660
|
ext = GetX509ExtPtr(extension);
|
|
673
661
|
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext - FREE it */
|
|
674
|
-
|
|
662
|
+
ossl_raise(eX509CertError, NULL);
|
|
675
663
|
}
|
|
676
664
|
|
|
677
665
|
return extension;
|
|
678
666
|
}
|
|
679
667
|
|
|
680
|
-
static VALUE
|
|
681
|
-
ossl_x509_inspect(VALUE self)
|
|
682
|
-
{
|
|
683
|
-
return rb_sprintf("#<%"PRIsVALUE": subject=%+"PRIsVALUE", "
|
|
684
|
-
"issuer=%+"PRIsVALUE", serial=%+"PRIsVALUE", "
|
|
685
|
-
"not_before=%+"PRIsVALUE", not_after=%+"PRIsVALUE">",
|
|
686
|
-
rb_obj_class(self),
|
|
687
|
-
ossl_x509_get_subject(self),
|
|
688
|
-
ossl_x509_get_issuer(self),
|
|
689
|
-
ossl_x509_get_serial(self),
|
|
690
|
-
ossl_x509_get_not_before(self),
|
|
691
|
-
ossl_x509_get_not_after(self));
|
|
692
|
-
}
|
|
693
|
-
|
|
694
668
|
/*
|
|
695
669
|
* call-seq:
|
|
696
670
|
* cert1 == cert2 -> true | false
|
|
697
671
|
*
|
|
698
672
|
* Compares the two certificates. Note that this takes into account all fields,
|
|
699
673
|
* not just the issuer name and the serial number.
|
|
674
|
+
*
|
|
675
|
+
* This method uses X509_cmp() from OpenSSL, which compares certificates based
|
|
676
|
+
* on their cached DER encodings. The comparison can be unreliable if a
|
|
677
|
+
* certificate is incomplete.
|
|
678
|
+
*
|
|
679
|
+
* See also the man page X509_cmp(3).
|
|
700
680
|
*/
|
|
701
681
|
static VALUE
|
|
702
682
|
ossl_x509_eq(VALUE self, VALUE other)
|
|
@@ -705,13 +685,12 @@ ossl_x509_eq(VALUE self, VALUE other)
|
|
|
705
685
|
|
|
706
686
|
GetX509(self, a);
|
|
707
687
|
if (!rb_obj_is_kind_of(other, cX509Cert))
|
|
708
|
-
|
|
688
|
+
return Qfalse;
|
|
709
689
|
GetX509(other, b);
|
|
710
690
|
|
|
711
691
|
return !X509_cmp(a, b) ? Qtrue : Qfalse;
|
|
712
692
|
}
|
|
713
693
|
|
|
714
|
-
#ifdef HAVE_I2D_RE_X509_TBS
|
|
715
694
|
/*
|
|
716
695
|
* call-seq:
|
|
717
696
|
* cert.tbs_bytes => string
|
|
@@ -741,7 +720,6 @@ ossl_x509_tbs_bytes(VALUE self)
|
|
|
741
720
|
|
|
742
721
|
return str;
|
|
743
722
|
}
|
|
744
|
-
#endif
|
|
745
723
|
|
|
746
724
|
struct load_chained_certificates_arguments {
|
|
747
725
|
VALUE certificates;
|
|
@@ -802,7 +780,7 @@ load_chained_certificates_PEM(BIO *in) {
|
|
|
802
780
|
certificates = load_chained_certificates_append(Qnil, certificate);
|
|
803
781
|
|
|
804
782
|
while ((certificate = PEM_read_bio_X509(in, NULL, NULL, NULL))) {
|
|
805
|
-
|
|
783
|
+
load_chained_certificates_append(certificates, certificate);
|
|
806
784
|
}
|
|
807
785
|
|
|
808
786
|
/* We tried to read one more certificate but could not read start line: */
|
|
@@ -900,12 +878,6 @@ ossl_x509_load(VALUE klass, VALUE buffer)
|
|
|
900
878
|
void
|
|
901
879
|
Init_ossl_x509cert(void)
|
|
902
880
|
{
|
|
903
|
-
#if 0
|
|
904
|
-
mOSSL = rb_define_module("OpenSSL");
|
|
905
|
-
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
|
|
906
|
-
mX509 = rb_define_module_under(mOSSL, "X509");
|
|
907
|
-
#endif
|
|
908
|
-
|
|
909
881
|
eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError);
|
|
910
882
|
|
|
911
883
|
/* Document-class: OpenSSL::X509::Certificate
|
|
@@ -1033,9 +1005,6 @@ Init_ossl_x509cert(void)
|
|
|
1033
1005
|
rb_define_method(cX509Cert, "extensions", ossl_x509_get_extensions, 0);
|
|
1034
1006
|
rb_define_method(cX509Cert, "extensions=", ossl_x509_set_extensions, 1);
|
|
1035
1007
|
rb_define_method(cX509Cert, "add_extension", ossl_x509_add_extension, 1);
|
|
1036
|
-
rb_define_method(cX509Cert, "inspect", ossl_x509_inspect, 0);
|
|
1037
1008
|
rb_define_method(cX509Cert, "==", ossl_x509_eq, 1);
|
|
1038
|
-
#ifdef HAVE_I2D_RE_X509_TBS
|
|
1039
1009
|
rb_define_method(cX509Cert, "tbs_bytes", ossl_x509_tbs_bytes, 0);
|
|
1040
|
-
#endif
|
|
1041
1010
|
}
|