From: Martin Bosslet Date: 2011-01-26T23:52:38+09:00 Subject: [ruby-core:34871] [Ruby 1.9-Bug#4325] [ext/openssl] Encoding of subclasses fails when it shouldn't Issue #4325 has been updated by Martin Bosslet. The first thought that came into my mind for changing this was to provide consistency. There are several similar operations that also use rb_is_kind_of instead of checking the class directly, mainly in ossl_asn1_default_tag, which is used throughout the entire encoding process. But there may also be good use cases when subclassing would make sense. For example if one would like to have some kind of default value set before encoding the value. A probable scenario where this would make sense could e.g. be an ASN.1 structure that comes with a SET of certificates. Depending on the application environment, this SET might be predetermined, and to simplify things one might want to add the predetermined certificates in case someone else forgot to do so. To achieve this the developer could subclass OpenSSL::ASN1::Set and overwrite #to_der by setting the default first (if needed) and then delegate to Set's implementation. I don't know, I couldn't find a more convincing example right now, but I think the consistency argument is more convincing anyway :) Regards, Martin ---------------------------------------- http://redmine.ruby-lang.org/issues/show/4325 ---------------------------------------- http://redmine.ruby-lang.org