From 14fb0aefe962139a36cbb885361dbf2d8d8d6d57 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Tue, 26 Jul 2011 11:17:20 +0000 Subject: [PATCH] adjusted to changes of OpenPACE git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@438 96b47cad-a561-4643-ad3b-153ac7d7599c --- npa/src/npa.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/npa/src/npa.c b/npa/src/npa.c index 9c45019..6a68eac 100644 --- a/npa/src/npa.c +++ b/npa/src/npa.c @@ -928,6 +928,7 @@ int EstablishPACEChannel(struct sm_ctx *oldnpactx, sc_card_t *card, PACE_SEC *sec = NULL; CVC_CHAT *chat = NULL; BIO *bio_stdout = NULL; + CVC_CERTIFICATE_DESCRIPTION *desc = NULL; int r; if (!card) @@ -940,6 +941,14 @@ int EstablishPACEChannel(struct sm_ctx *oldnpactx, sc_card_t *card, if (pace_input.certificate_description_length && pace_input.certificate_description) { + if (!d2i_CVC_CERTIFICATE_DESCRIPTION(&desc, + &pace_input.certificate_description, + pace_input.certificate_description_length)) { + sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not parse certificate description."); + r = SC_ERROR_INTERNAL; + goto err; + } + if (!bio_stdout) bio_stdout = BIO_new_fp(stdout, BIO_NOCLOSE); if (!bio_stdout) { @@ -950,9 +959,7 @@ int EstablishPACEChannel(struct sm_ctx *oldnpactx, sc_card_t *card, } printf("Certificate Description\n"); - switch(certificate_description_print(bio_stdout, - pace_input.certificate_description, - pace_input.certificate_description_length, "\t")) { + switch(certificate_description_print(bio_stdout, desc, 8)) { case -1: sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not print certificate description."); ssl_error(card->ctx); @@ -1018,7 +1025,7 @@ int EstablishPACEChannel(struct sm_ctx *oldnpactx, sc_card_t *card, } printf("Card holder authorization template (CHAT)\n"); - if (!cvc_chat_print(bio_stdout, chat, "\t")) { + if (!cvc_chat_print(bio_stdout, chat, 8)) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not print card holder authorization template (CHAT)."); ssl_error(card->ctx); r = SC_ERROR_INTERNAL;