mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/openssl/ossl_x509name.c (ossl_x509name_initialize): add
optional argument to specify the DirectoryString type (ASN1::UTF8STRING by default). RFC3280 deprecates PrintableString for DirectoryString, and strongly requires to use UTF8String for all certificates issued after December, 31 2003. * ext/openssl/lib/openssl/x509.rb (X509::Name::parse): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									67a98cd52f
								
							
						
					
					
						commit
						80549d5f17
					
				
					 3 changed files with 16 additions and 7 deletions
				
			
		
							
								
								
									
										10
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								ChangeLog
									
										
									
									
									
								
							|  | @ -1,3 +1,13 @@ | |||
| Fri Oct 10 01:19:00 2003  GOTOU Yuuzou  <gotoyuzo@notwork.org> | ||||
| 
 | ||||
| 	* ext/openssl/ossl_x509name.c (ossl_x509name_initialize): add | ||||
| 	  optional argument to specify the DirectoryString type | ||||
| 	  (ASN1::UTF8STRING by default). RFC3280 deprecates PrintableString | ||||
| 	  for DirectoryString, and strongly requires to use UTF8String for | ||||
| 	  all certificates issued after December, 31 2003. | ||||
| 
 | ||||
| 	* ext/openssl/lib/openssl/x509.rb (X509::Name::parse): ditto. | ||||
| 
 | ||||
| Thu Oct  9 23:50:21 2003  Nobuyoshi Nakada  <nobu@ruby-lang.org> | ||||
| 
 | ||||
| 	* eval.c (rb_thread_start_0): prevent thread from GC. | ||||
|  |  | |||
|  | @ -64,9 +64,9 @@ module OpenSSL | |||
|     end # Extension | ||||
|      | ||||
|     class Name | ||||
|       def self.parse(str) | ||||
|       def self.parse(str, type=ASN1::UTF8STRING) | ||||
|         ary = str.scan(/\s*([^\/,]+)\s*/).collect{|i| i[0].split("=") } | ||||
|         self.new(ary) | ||||
|         self.new(ary, type) | ||||
|       end | ||||
|     end # Name | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,7 +9,6 @@ | |||
|  * (See the file 'LICENCE'.) | ||||
|  */ | ||||
| #include "ossl.h" | ||||
| #include "st.h" /* For st_foreach -- ST_CONTINUE */ | ||||
| 
 | ||||
| #define WrapX509Name(klass, obj, name) do { \ | ||||
|     if (!name) { \ | ||||
|  | @ -88,13 +87,13 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self) | |||
| { | ||||
|     X509_NAME *name; | ||||
|     int i, type; | ||||
|     VALUE arg, item, key, value; | ||||
|     VALUE arg, str_type, item, key, value; | ||||
| 
 | ||||
|     GetX509Name(self, name); | ||||
|     if (rb_scan_args(argc, argv, "01", &arg) == 0) { | ||||
|     if (rb_scan_args(argc, argv, "02", &arg, &str_type) == 0) { | ||||
| 	return self; | ||||
|     } | ||||
|     if (rb_respond_to(arg, ossl_s_to_der)){ | ||||
|     if (argc == 1 && rb_respond_to(arg, ossl_s_to_der)){ | ||||
| 	unsigned char *p; | ||||
| 	VALUE str = rb_funcall(arg, ossl_s_to_der, 0); | ||||
| 	StringValue(str); | ||||
|  | @ -104,6 +103,7 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self) | |||
|         return self; | ||||
|     } | ||||
|     Check_Type(arg, T_ARRAY); | ||||
|     type = NIL_P(str_type) ? V_ASN1_UTF8STRING : NUM2INT(str_type); | ||||
|     for (i=0; i<RARRAY(arg)->len; i++) { | ||||
| 	item = RARRAY(arg)->ptr[i]; | ||||
| 	Check_Type(item, T_ARRAY); | ||||
|  | @ -114,7 +114,6 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self) | |||
| 	value = RARRAY(item)->ptr[1]; | ||||
| 	StringValue(key); | ||||
| 	StringValue(value); | ||||
| 	type = ASN1_PRINTABLE_type(RSTRING(value)->ptr, -1); | ||||
| 	if (!X509_NAME_add_entry_by_txt(name, RSTRING(key)->ptr, type, | ||||
| 			RSTRING(value)->ptr, RSTRING(value)->len, -1, 0)) { | ||||
| 	    ossl_raise(eX509NameError, NULL); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 gotoyuzo
						gotoyuzo