void print_linked_list_bin(LinkedList *list){ /** * Prints the specified linked list to the console. Each element's data * is printed byte-wise as a hexadecimal. */ printf("\n"); int n = count_linked_list(list); printf("Linked List of length %d:\n", n); print_separator_line('-'); int i; for(i = 0; i < n; i++){ printf("%3d || ", i); void *data = get_linked_list(list, i); print_byte_data_bin(data, list->data_size); printf("\n"); } print_separator_line('-'); }
void format_smime_info(int pass, BODY *body, long msgno, gf_io_t pc) { PKCS7 *p7; int i; if(body->type == TYPEMULTIPART){ PART *p; for(p=body->nested.part; p; p=p->next) format_smime_info(pass, &p->body, msgno, pc); } p7 = body->sparep; if(p7){ if(PKCS7_type_is_signed(p7)){ STACK_OF(X509) *signers; switch(pass){ case 1: gf_puts(_("This message was cryptographically signed."), pc); gf_puts(NEWLINE, pc); break; case 2: signers = PKCS7_get0_signers(p7, NULL, 0); if(signers){ snprintf(tmp_20k_buf, SIZEOF_20KBUF, _("Certificate%s used for signing"), plural(sk_X509_num(signers))); gf_puts_uline(tmp_20k_buf, pc); gf_puts(NEWLINE, pc); print_separator_line(100, '-', pc); for(i=0; i<sk_X509_num(signers); i++){ X509 *x = sk_X509_value(signers, i); if(x){ output_cert_info(x, pc); gf_puts(NEWLINE, pc); } } } sk_X509_free(signers); break; } } else if(PKCS7_type_is_enveloped(p7)){ switch(pass){ case 1: gf_puts(_("This message was encrypted."), pc); gf_puts(NEWLINE, pc); break; case 2: if(p7->d.enveloped && p7->d.enveloped->enc_data){ X509_ALGOR *alg = p7->d.enveloped->enc_data->algorithm; STACK_OF(PKCS7_RECIP_INFO) *ris = p7->d.enveloped->recipientinfo; int found = 0; gf_puts(_("The algorithm used to encrypt was "), pc); if(alg){ char *n = (char *) OBJ_nid2sn( OBJ_obj2nid(alg->algorithm)); gf_puts(n ? n : "<unknown>", pc); } else gf_puts("<unknown>", pc); gf_puts("." NEWLINE NEWLINE, pc); snprintf(tmp_20k_buf, SIZEOF_20KBUF, _("Certificate%s for decrypting"), plural(sk_PKCS7_RECIP_INFO_num(ris))); gf_puts_uline(tmp_20k_buf, pc); gf_puts(NEWLINE, pc); print_separator_line(100, '-', pc); for(i=0; i<sk_PKCS7_RECIP_INFO_num(ris); i++){ PKCS7_RECIP_INFO *ri; PERSONAL_CERT *pcert; ri = sk_PKCS7_RECIP_INFO_value(ris, i); if(!ri) continue; pcert = find_certificate_matching_recip_info(ri); if(pcert){ if(found){ print_separator_line(25, '*', pc); gf_puts(NEWLINE, pc); } found = 1; output_cert_info(pcert->cert, pc); gf_puts(NEWLINE, pc); } } if(!found){ gf_puts(_("No certificate capable of decrypting could be found."), pc); gf_puts(NEWLINE, pc); gf_puts(NEWLINE, pc); } } break; } } } }