diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-10-27 00:15:11 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-10-27 00:15:11 +0000 |
commit | 74400f7348c589bf9e7cd17f657c05b25f8758b1 (patch) | |
tree | 0f3af155bb1cf7cd0a717eab9a8183dae2bdf4ee /apps/req.c | |
parent | 62ac2938015939e2ef30f12295f0ee59ff79c11b (diff) |
Continued multibyte character support.
Add a bunch of functions to simplify the creation of X509_NAME structures.
Change the X509_NAME_entry_add stuff in req/ca so it no longer uses
X509_NAME_entry_count(): passing -1 has the same effect.
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apps/req.c b/apps/req.c index a945610f92..a395c39f4b 100644 --- a/apps/req.c +++ b/apps/req.c @@ -82,6 +82,7 @@ #define ATTRIBUTES "attributes" #define V3_EXTENSIONS "x509_extensions" #define REQ_EXTENSIONS "req_extensions" +#define DIRSTRING_TYPE "dirstring_type" #define DEFAULT_KEY_LENGTH 512 #define MIN_KEY_LENGTH 384 @@ -452,6 +453,13 @@ bad: } } + p = CONF_get_string(req_conf, SECTION, DIRSTRING_TYPE); + + if(p && !ASN1_STRING_set_default_mask_asc(p)) { + BIO_printf(bio_err, "Invalid DiretoryString setting %s", p); + goto end; + } + if(!req_exts) req_exts = CONF_get_string(req_conf, SECTION, REQ_EXTENSIONS); if(req_exts) { @@ -883,6 +891,9 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs) ri=req->req_info; + /* setup version number */ + if (!ASN1_INTEGER_set(ri->version,0L)) goto err; /* version 1 */ + BIO_printf(bio_err,"You are about to be asked to enter information that will be incorporated\n"); BIO_printf(bio_err,"into your certificate request.\n"); BIO_printf(bio_err,"What you are about to enter is what is called a Distinguished Name or a DN.\n"); @@ -891,8 +902,6 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs) BIO_printf(bio_err,"If you enter '.', the field will be left blank.\n"); BIO_printf(bio_err,"-----\n"); - /* setup version number */ - if (!ASN1_INTEGER_set(ri->version,0L)) goto err; /* version 1 */ if (sk_CONF_VALUE_num(sk)) { @@ -1003,8 +1012,7 @@ err: static int add_DN_object(X509_NAME *n, char *text, char *def, char *value, int nid, int min, int max) { - int i,j,ret=0; - X509_NAME_ENTRY *ne=NULL; + int i,ret=0; MS_STATIC char buf[1024]; BIO_printf(bio_err,"%s [%s]:",text,def); @@ -1039,21 +1047,13 @@ static int add_DN_object(X509_NAME *n, char *text, char *def, char *value, } buf[--i]='\0'; - j=ASN1_PRINTABLE_type((unsigned char *)buf,-1); - if (req_fix_data(nid,&j,i,min,max) == 0) - goto err; #ifdef CHARSET_EBCDIC ebcdic2ascii(buf, buf, i); #endif - if ((ne=X509_NAME_ENTRY_create_by_NID(NULL,nid,j,(unsigned char *)buf, - strlen(buf))) - == NULL) goto err; - if (!X509_NAME_add_entry(n,ne,X509_NAME_entry_count(n),0)) - goto err; - + if (!X509_NAME_add_entry_by_NID(n,nid, MBSTRING_ASC, + (unsigned char *) buf, -1,-1,0)) goto err; ret=1; err: - if (ne != NULL) X509_NAME_ENTRY_free(ne); return(ret); } |