[前][次][番号順一覧][スレッド一覧]

ruby-changes:22439

From: naruse <ko1@a...>
Date: Wed, 8 Feb 2012 18:50:37 +0900 (JST)
Subject: [ruby-changes:22439] naruse:r34488 (trunk): "street" for X509 Name is not supported before 0.9.8m.

naruse	2012-02-08 18:49:36 +0900 (Wed, 08 Feb 2012)

  New Revision: 34488

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34488

  Log:
    "street" for X509 Name is not supported before 0.9.8m.
    
    It is added openssl/crypto/objects/obj_mac.h 1.83.
    http://cvs.openssl.org/rlog?f=openssl/crypto/objects/obj_mac.h

  Modified files:
    trunk/test/openssl/test_x509name.rb

Index: test/openssl/test_x509name.rb
===================================================================
--- test/openssl/test_x509name.rb	(revision 34487)
+++ test/openssl/test_x509name.rb	(revision 34488)
@@ -107,31 +107,32 @@
            ["postalCode", "60602"],
            ["ST", "Illinois"],
            ["L", "Chicago"],
-           ["street", "123 Fake St"],
+           #["street", "123 Fake St"],
            ["O", "Some Company LLC"],
            ["CN", "mydomain.com"] ]
 
     name = OpenSSL::X509::Name.new(dn)
     ary = name.to_a
-    assert_equal("/1.2.3.4.5.6.7.8.9.7.5.3.1=Unknown OID 1/1.1.2.3.5.8.13.21.34=Unknown OID 2/C=US/postalCode=60602/ST=Illinois/L=Chicago/street=123 Fake St/O=Some Company LLC/CN=mydomain.com", name.to_s)
+    #assert_equal("/1.2.3.4.5.6.7.8.9.7.5.3.1=Unknown OID 1/1.1.2.3.5.8.13.21.34=Unknown OID 2/C=US/postalCode=60602/ST=Illinois/L=Chicago/street=123 Fake St/O=Some Company LLC/CN=mydomain.com", name.to_s)
+    assert_equal("/1.2.3.4.5.6.7.8.9.7.5.3.1=Unknown OID 1/1.1.2.3.5.8.13.21.34=Unknown OID 2/C=US/postalCode=60602/ST=Illinois/L=Chicago/O=Some Company LLC/CN=mydomain.com", name.to_s)
     assert_equal("1.2.3.4.5.6.7.8.9.7.5.3.1", ary[0][0])
     assert_equal("1.1.2.3.5.8.13.21.34", ary[1][0])
     assert_equal("C", ary[2][0])
     assert_equal("postalCode", ary[3][0])
     assert_equal("ST", ary[4][0])
     assert_equal("L", ary[5][0])
-    assert_equal("street", ary[6][0])
-    assert_equal("O", ary[7][0])
-    assert_equal("CN", ary[8][0])
+    #assert_equal("street", ary[6][0])
+    assert_equal("O", ary[6][0])
+    assert_equal("CN", ary[7][0])
     assert_equal("Unknown OID 1", ary[0][1])
     assert_equal("Unknown OID 2", ary[1][1])
     assert_equal("US", ary[2][1])
     assert_equal("60602", ary[3][1])
     assert_equal("Illinois", ary[4][1])
     assert_equal("Chicago", ary[5][1])
-    assert_equal("123 Fake St", ary[6][1])
-    assert_equal("Some Company LLC", ary[7][1])
-    assert_equal("mydomain.com", ary[8][1])
+    #assert_equal("123 Fake St", ary[6][1])
+    assert_equal("Some Company LLC", ary[6][1])
+    assert_equal("mydomain.com", ary[7][1])
   end
 
   def test_unrecognized_oid_parse_encode_equality
@@ -141,7 +142,7 @@
            ["postalCode", "60602"],
            ["ST", "Illinois"],
            ["L", "Chicago"],
-           ["street", "123 Fake St"],
+           #["street", "123 Fake St"],
            ["O", "Some Company LLC"],
            ["CN", "mydomain.com"] ]
 
@@ -309,6 +310,24 @@
     assert_equal(OpenSSL::ASN1::PRINTABLESTRING, ary[4][2])
   end
 
+  def test_add_entry_street
+    return if OpenSSL::OPENSSL_VERSION_NUMBER >= 0x009080df # 0.9.8m
+    # openssl/crypto/objects/obj_mac.h 1.83
+    dn = [
+      ["DC", "org"],
+      ["DC", "ruby-lang"],
+      ["CN", "GOTOU Yuuzou"],
+      ["emailAddress", "gotoyuzo@r..."],
+      ["serialNumber", "123"],
+      ["street", "Namiki"],
+    ]
+    name = OpenSSL::X509::Name.new
+    dn.each{|attr| name.add_entry(*attr) }
+    ary = name.to_a
+    assert_equal("/DC=org/DC=ruby-lang/CN=GOTOU Yuuzou/emailAddress=gotoyuzo@r.../serialNumber=123/street=Namiki", name.to_s)
+    assert_equal("Namiki", ary[5][1])
+  end
+
   def test_equals2
     n1 = OpenSSL::X509::Name.parse 'CN=a'
     n2 = OpenSSL::X509::Name.parse 'CN=a'

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]