Project

General

Profile

Actions

Bug #4325

closed

[ext/openssl] Encoding of subclasses fails when it shouldn't

Added by MartinBosslet (Martin Bosslet) almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
trunk
Backport:
[ruby-core:34856]

Description

=begin
While skimming through ossl_asn1.c I noticed that my patch for infinite length encoding
causes problems when encoding subclasses of OpenSSL::ASN1::Sequence or OpenSSL::ASN1::Set
with infinite length.

E.g. the following fails in trunk:

require 'openssl'

sub = Class.new(OpenSSL::ASN1::Sequence)
instance = sub.new([OpenSSL::ASN1::EndOfContent.new])
instance.infinite_length = true
puts instance.to_der

=> test.rb:10:in to_der': invalid constructed encoding (OpenSSL::ASN1::ASN1Error) from test.rb:10:in '

This can be fixed with the appended code that checks for subclass relationship instead
of comparing the class directly with Set or Sequence.

Regards,
Martin
=end


Files

fix_cons_encode_inf.diff (2.25 KB) fix_cons_encode_inf.diff MartinBosslet (Martin Bosslet), 01/26/2011 09:46 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0