diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-12-14 18:42:28 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-12-14 18:42:28 +0000 |
commit | 2c15d426b927444652cb53f39bc8463a1e6b91a6 (patch) | |
tree | 9850785e8806f5b6ff8dd633e35c603ed333d235 /crypto/x509v3/v3_prn.c | |
parent | bdcfe1d165b46d9263d3395535631305c3e27bd6 (diff) | |
download | openssl-new-2c15d426b927444652cb53f39bc8463a1e6b91a6.tar.gz |
New function X509V3_extensions_print() this removes extension duplication
from the print routines.
Reorganisation of OCSP code: initial print routines in ocsp_prn.c. Doesn't
work fully because OCSP extensions aren't reimplemented yet.
Implement some ASN1 functions needed to compile OCSP code.
Diffstat (limited to 'crypto/x509v3/v3_prn.c')
-rw-r--r-- | crypto/x509v3/v3_prn.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crypto/x509v3/v3_prn.c b/crypto/x509v3/v3_prn.c index ae1b7c81c0..475c48098c 100644 --- a/crypto/x509v3/v3_prn.c +++ b/crypto/x509v3/v3_prn.c @@ -147,6 +147,39 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde return ok; } +int X509V3_extensions_print(BIO *bp, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent) +{ + int i, j; + + if(sk_X509_EXTENSION_num(exts) <= 0) return 1; + + if(title) + { + BIO_printf(bp,"%*s%s:\n",indent, "", title); + indent += 4; + } + + for (i=0; i<sk_X509_EXTENSION_num(exts); i++) + { + ASN1_OBJECT *obj; + X509_EXTENSION *ex; + ex=sk_X509_EXTENSION_value(exts, i); + if (BIO_printf(bp,"%*s",indent, "") <= 0) return 0; + obj=X509_EXTENSION_get_object(ex); + i2a_ASN1_OBJECT(bp,obj); + j=X509_EXTENSION_get_critical(ex); + if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0) + return 0; + if(!X509V3_EXT_print(bp, ex, flag, 12)) + { + BIO_printf(bp, "%*s", indent + 4, ""); + M_ASN1_OCTET_STRING_print(bp,ex->value); + } + if (BIO_write(bp,"\n",1) <= 0) return 0; + } + return 1; +} + static int unknown_ext_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent, int supported) { switch(flag & X509V3_EXT_UNKNOWN_MASK) { |