here is what I get from pkcs15-tool.c plus util.c, should work
fine for you. you need to search for readers, see if there are
cards in them, connect the card and then you can pkcs15_bind it.
good luck!
Andreas
p.s. if this doesn't help, please post example code so we can have a look.
sc_reader_t *reader;
sc_card_t *card;
int r;
if (reader_id < 0)
reader_id = 0;
if (sc_ctx_get_reader_count(ctx) == 0) {
fprintf(stderr,
"No smart card readers configured.\n");
return 1;
}
if ((unsigned int)reader_id >=
sc_ctx_get_reader_count(ctx)) {
fprintf(stderr,
"Illegal reader number. "
"Only %d reader(s) configured.\n",
sc_ctx_get_reader_count(ctx));
return 1;
}
reader = sc_ctx_get_reader(ctx, reader_id);
slot_id = 0;
if (sc_detect_card_presence(reader, 0) <= 0) {
fprintf(stderr, "Card not present.\n");
return 3;
}
if ((r = sc_connect_card(reader, slot_id, &card)) < 0) {
fprintf(stderr,
"Failed to connect to card: %s\n",
sc_strerror(r));
return 1;
}
if (verbose)
printf("Using card driver %s.\n", card->driver->name);
if ((r = sc_lock(card)) < 0) {
fprintf(stderr,
"Failed to lock card: %s\n",
sc_strerror(r));
sc_disconnect_card(card, 0);
return 1;
}
if (verbose)
fprintf(stderr, "Trying to find a PKCS#15 compatible
card...\n")
;
r = sc_pkcs15_bind(card, &p15card);
if (r) {
fprintf(stderr, "PKCS#15 initialization failed: %s\n",
sc_strerr
or(r));
err = 1;
goto end;
}
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel