summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_strex.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-03-15 19:13:40 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-03-15 19:13:40 +0000
commit535d79da635c2015a88a0184321296bdcb201848 (patch)
tree5bca4bb95332244dbe4b6770c6b80c45253d2c13 /crypto/asn1/a_strex.c
parent4f69172d25f1aab5dce50f97cd5ab61a6d74d771 (diff)
Overhaul the display of certificate details in
the 'ca' utility. This can now be extensively customised in the configuration file and handles multibyte strings and extensions properly. This is required when extensions copying from certificate requests is supported: the user must be able to view the extensions before allowing a certificate to be issued.
Diffstat (limited to 'crypto/asn1/a_strex.c')
-rw-r--r--crypto/asn1/a_strex.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
index 5335538ae0..defc4e7ecf 100644
--- a/crypto/asn1/a_strex.c
+++ b/crypto/asn1/a_strex.c
@@ -371,6 +371,8 @@ static int do_indent(char_io *io_ch, void *arg, int indent)
return 1;
}
+#define FN_WIDTH_LN 25
+#define FN_WIDTH_SN 10
static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
int indent, unsigned long flags)
@@ -456,19 +458,25 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
val = X509_NAME_ENTRY_get_data(ent);
fn_nid = OBJ_obj2nid(fn);
if(fn_opt != XN_FLAG_FN_NONE) {
- int objlen;
+ int objlen, fld_len;
if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
OBJ_obj2txt(objtmp, 80, fn, 1);
objbuf = objtmp;
} else {
- if(fn_opt == XN_FLAG_FN_SN)
+ if(fn_opt == XN_FLAG_FN_SN) {
+ fld_len = FN_WIDTH_SN;
objbuf = OBJ_nid2sn(fn_nid);
- else if(fn_opt == XN_FLAG_FN_LN)
+ } else if(fn_opt == XN_FLAG_FN_LN) {
+ fld_len = FN_WIDTH_LN;
objbuf = OBJ_nid2ln(fn_nid);
- else objbuf = "";
+ } else objbuf = "";
}
objlen = strlen(objbuf);
if(!io_ch(arg, objbuf, objlen)) return -1;
+ if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
+ if (!do_indent(io_ch, arg, fld_len - objlen)) return -1;
+ outlen += fld_len - objlen;
+ }
if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
outlen += objlen + sep_eq_len;
}