Re: [Muscle] PCSCD Not reading Smart Card

2008-08-14 Thread Wesley Nugent
Ok, this got it running and I'm able to connect now.  I still get a seg 
fault when I try to run my read or write programs.  What happens, it 
says please select reader from the list.  If I hit enter, I get 
segfault, if I type anything in, it doesn't recognize the reader.  I did 
a gdb with backtrace and get:


#0 0xb7e2e463 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7f0c457 in SCardConnect (hContext=16996003,
   szReader=0x1000 Address 0x1000 out of bounds, dwShareMode=2,
   dwPreferredProtocols=4, phCard=0xbf9e1758, pdwActiveProtocol=0xbf9e12f8
   at winscard_clnt.c:745
#2 0x08048c50 in ?? ()

On a side note, I do have scriptor installed and can connect to the 
smart card reader using scriptor.  It uses RAW protocol and comes up 
says reading commands from STDIN.


Unfortunately, I don't know what commands to give it.  If you could 
point me to the commands to read and write in raw mode, or where I can 
find these commands, I would appreciate it.  Either help with the 
segfault or the commands to read/write with scriptor in RAW mode would 
be of great benefit to me.



Thank you for all of your help.

Wesley

Ludovic Rousseau wrote:

On Fri, Aug 8, 2008 at 6:10 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
  

Ok, I went back to a copy of the image I'm using for development to before I
started working on the smart card (I had installed and uninstalled via apt
many packages and couldn't ensure all were gone).  I downloaded the source
code and recompiled.

Now I get winscard_clnt.c:3232:SCardCheckDaemonAvailablity() PCSC Not
Running, and yet I can clearly see /usr/local/sbin/pcscd running in ps -ef
and showing the debug info in the foreground on my console.

Please advise what flag I may have missed or startup option to get it to run
in daemon mode.



Your application is using /usr/lib/libpcsclite.so but the newly
compiled pcsc-lite installed the lib in /usr/local/lib/libpcsclite.so

If you use .deb packages you should backport the Debian/testing
package of pcsclite 1.4.102 and then only use .deb packages on your
system.

If you really want to configure by hand the Debian package is configured as:
./configure \
--sysconfdir=/etc \
--prefix=/usr \
--enable-usbdropdir=/usr/lib/pcsc/drivers

Bye

  



--

___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-11 Thread Wesley Nugent

Ok, this got it running and I'm able to connect now.  I still get a seg
fault when I try to run my read or write programs.  What happens, it
says please select reader from the list.  If I hit enter, I get
segfault, if I type anything in, it doesn't recognize the reader.  I did
a gdb with backtrace and get:

#0 0xb7e2e463 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7f0c457 in SCardConnect (hContext=16996003,
   szReader=0x1000 Address 0x1000 out of bounds, dwShareMode=2,
   dwPreferredProtocols=4, phCard=0xbf9e1758, pdwActiveProtocol=0xbf9e12f8
   at winscard_clnt.c:745
#2 0x08048c50 in ?? ()

On a side note, I do have scriptor installed and can connect to the
smart card reader using scriptor.  It uses RAW protocol and comes up
says reading commands from STDIN.

Unfortunately, I don't know what commands to give it.  If you could
point me to the commands to read and write in raw mode, or where I can
find these commands, I would appreciate it.  Either help with the
segfault or the commands to read/write with scriptor in RAW mode would
be of great benefit to me.


Thank you for all of your help.

Wesley

Ludovic Rousseau wrote:

On Fri, Aug 8, 2008 at 6:10 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
  

Ok, I went back to a copy of the image I'm using for development to before I
started working on the smart card (I had installed and uninstalled via apt
many packages and couldn't ensure all were gone).  I downloaded the source
code and recompiled.

Now I get winscard_clnt.c:3232:SCardCheckDaemonAvailablity() PCSC Not
Running, and yet I can clearly see /usr/local/sbin/pcscd running in ps -ef
and showing the debug info in the foreground on my console.

Please advise what flag I may have missed or startup option to get it to run
in daemon mode.



Your application is using /usr/lib/libpcsclite.so but the newly
compiled pcsc-lite installed the lib in /usr/local/lib/libpcsclite.so

If you use .deb packages you should backport the Debian/testing
package of pcsclite 1.4.102 and then only use .deb packages on your
system.

If you really want to configure by hand the Debian package is configured as:
./configure \
--sysconfdir=/etc \
--prefix=/usr \
--enable-usbdropdir=/usr/lib/pcsc/drivers

Bye

  



--

___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-11 Thread Wesley Nugent




Well, through trial and error, I found out that my program was looking
for the letter e to select the proper smart card. I have no idea why,
but I updated my scripts and it is now reading and writing. Thank you
for all of your help.

I'm still interested in references to scriptor as I don't want to rely
solely on the program that I don't have any source for from a previous
developer.

Thanks again.

Wesley

Wesley Nugent wrote:
Ok, this
got it running and I'm able to connect now. I still get a seg
  
fault when I try to run my read or write programs. What happens, it
  
says please select reader from the list. If I hit enter, I get
  
segfault, if I type anything in, it doesn't recognize the reader. I
did
  
a gdb with backtrace and get:
  
  
#0 0xb7e2e463 in strlen () from /lib/tls/i686/cmov/libc.so.6
  
#1 0xb7f0c457 in SCardConnect (hContext=16996003,
  
 szReader=0x1000 Address 0x1000 out of bounds, dwShareMode=2,
  
 dwPreferredProtocols=4, phCard=0xbf9e1758,
pdwActiveProtocol=0xbf9e12f8
  
 at winscard_clnt.c:745
  
#2 0x08048c50 in ?? ()
  
  
On a side note, I do have scriptor installed and can connect to the
  
smart card reader using scriptor. It uses RAW protocol and comes up
  
says reading commands from STDIN.
  
  
Unfortunately, I don't know what commands to give it. If you could
  
point me to the commands to read and write in raw mode, or where I can
  
find these commands, I would appreciate it. Either help with the
  
segfault or the commands to read/write with scriptor in RAW mode would
  
be of great benefit to me.
  
  
  
Thank you for all of your help.
  
  
Wesley
  
  
Ludovic Rousseau wrote:
  
  On Fri, Aug 8, 2008 at 6:10 PM, Wesley Nugent
[EMAIL PROTECTED] wrote:


Ok, I went back to a copy of the image I'm
using for development to before I
  
started working on the smart card (I had installed and uninstalled via
apt
  
many packages and couldn't ensure all were gone). I downloaded the
source
  
code and recompiled.
  
  
Now I get winscard_clnt.c:3232:SCardCheckDaemonAvailablity() PCSC Not
  
Running, and yet I can clearly see /usr/local/sbin/pcscd running in ps
-ef
  
and showing the debug info in the foreground on my console.
  
  
Please advise what flag I may have missed or startup option to get it
to run
  
in daemon mode.
  
 

Your application is using /usr/lib/libpcsclite.so but the newly

compiled pcsc-lite installed the lib in /usr/local/lib/libpcsclite.so


If you use .deb packages you should backport the Debian/testing

package of pcsclite 1.4.102 and then only use .deb packages on your

system.


If you really want to configure by hand the Debian package is
configured as:

 ./configure \

 --sysconfdir=/etc \

 --prefix=/usr \

 --enable-usbdropdir=/usr/lib/pcsc/drivers


Bye


 
  
  



-- 



___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-11 Thread Ludovic Rousseau
On Mon, Aug 11, 2008 at 3:47 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
 Ok, this got it running and I'm able to connect now.  I still get a seg
 fault when I try to run my read or write programs.  What happens, it
 says please select reader from the list.  If I hit enter, I get
 segfault, if I type anything in, it doesn't recognize the reader.  I did
 a gdb with backtrace and get:

 #0 0xb7e2e463 in strlen () from /lib/tls/i686/cmov/libc.so.6
 #1 0xb7f0c457 in SCardConnect (hContext=16996003,
   szReader=0x1000 Address 0x1000 out of bounds, dwShareMode=2,
   dwPreferredProtocols=4, phCard=0xbf9e1758, pdwActiveProtocol=0xbf9e12f8
   at winscard_clnt.c:745
 #2 0x08048c50 in ?? ()

SCardConnect() is called with szReader=0x1000. szReader is supposed to
be a pointer to a C string containing the reader name to use.
It is clear that your application is using a wrong value here and can
only crash.

I am surprised your application ever worked.

 On a side note, I do have scriptor installed and can connect to the
 smart card reader using scriptor.  It uses RAW protocol and comes up
 says reading commands from STDIN.

 Unfortunately, I don't know what commands to give it.  If you could
 point me to the commands to read and write in raw mode, or where I can
 find these commands, I would appreciate it.  Either help with the
 segfault or the commands to read/write with scriptor in RAW mode would
 be of great benefit to me.

I think you will have to reverse engineer the scard-read and
scard-write program (since you do not have the source code) and
rewrite them.

The --apdu pcscd option to log the apdu exchanged was introduced in
pcsc-lite 1.1.2beta1 and your working configuration is using
pcsc-lite 1.1.1. So it will not be easy to get the exchanged APDU.

Good luck,

-- 
 Dr. Ludovic Rousseau
___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-11 Thread Wesley Nugent




Any suggestions on getting scriptor to read and write to the card? 

I am somewhat new to reverse engineering, and honestly don't know where
to begin. I do know a little about bash scripting and have hacked some
perl programs before and minor C. I've only had programming training
with 1 class in Java. Nowhere near the level of ability as people such
as yourself.

I have gotten it to read but would like to use scriptor if I can find
out what commands to give to read and write the card.

Thanks for all your help.

Wesley

Ludovic Rousseau wrote:

  On Mon, Aug 11, 2008 at 3:47 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
  
  
Ok, this got it running and I'm able to connect now.  I still get a seg
fault when I try to run my read or write programs.  What happens, it
says please select reader from the list.  If I hit enter, I get
segfault, if I type anything in, it doesn't recognize the reader.  I did
a gdb with backtrace and get:

#0 0xb7e2e463 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7f0c457 in SCardConnect (hContext=16996003,
  szReader=0x1000 Address 0x1000 out of bounds, dwShareMode=2,
  dwPreferredProtocols=4, phCard=0xbf9e1758, pdwActiveProtocol=0xbf9e12f8
  at winscard_clnt.c:745
#2 0x08048c50 in ?? ()

  
  
SCardConnect() is called with szReader=0x1000. szReader is supposed to
be a pointer to a C string containing the reader name to use.
It is clear that your application is using a wrong value here and can
only crash.

I am surprised your application ever worked.

  
  
On a side note, I do have scriptor installed and can connect to the
smart card reader using scriptor.  It uses RAW protocol and comes up
says reading commands from STDIN.

Unfortunately, I don't know what commands to give it.  If you could
point me to the commands to read and write in raw mode, or where I can
find these commands, I would appreciate it.  Either help with the
segfault or the commands to read/write with scriptor in RAW mode would
be of great benefit to me.

  
  
I think you will have to reverse engineer the scard-read and
scard-write program (since you do not have the source code) and
rewrite them.

The --apdu pcscd option to log the apdu exchanged was introduced in
pcsc-lite 1.1.2beta1 and your "working" configuration is using
pcsc-lite 1.1.1. So it will not be easy to get the exchanged APDU.

Good luck,

  



-- 



___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-11 Thread Ludovic Rousseau
On Mon, Aug 11, 2008 at 4:54 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
 Well, through trial and error, I found out that my program was looking for
 the letter e to select the proper smart card.  I have no idea why, but I
 updated my scripts and it is now reading and writing.  Thank you for all of
 your help.

Start pcscd as pcscd --apdu --forground to list the APDU used by
your closed source programs.
Once you have the list of APDU used and you anderstand the format of
the parameters you can start writing an equivalent in the language of
your choice.

 I'm still interested in references to scriptor as I don't want to rely
 solely on the program that I don't have any source for from a previous
 developer.

scriptor does not provide a programming language. It can just send a
static list of APDU and can't even use the answers from the card.

The winscard (or PC/SC API) can be used from a large variety of
languages on Unix. Just choose one.

Bye

-- 
 Dr. Ludovic Rousseau
___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle


Re: [Muscle] PCSCD Not reading Smart Card

2008-08-08 Thread Ludovic Rousseau
On Fri, Aug 8, 2008 at 3:20 PM, Wesley Nugent [EMAIL PROTECTED] wrote:
 (gdb) run /usr/local/bin/scard-read
 Starting the program: /usr/local/bin/scard-read
 Using host libthread_db library /lib/tls/i686/cmov/libthread_db.so.1.
 Failed to read a valid object file image from memory.
 (no debugging symbols found)
 (no debugging symbols found)
 [New Thread -1209727296 (LWP 10210)]
 (no debugging symbols found)
 (no debugging symbols found)
 (no debugging symbols found)

 Established context

 Check the connected readers
 reader=AseIIIeUSB 00 00
 Please select reader from the list:



 waiting on status change!

 Card Connect

 Program received signal SIGSEGV. Segmentation Fault.
 [Switching to Thread -1209727296 (LWP 10210)]
 9xb7ec0463 in strlen () from /lib/tls/i686/cmov/libc.so.6
 (gdb)

At this stage you need to enter bt or backtrace at the (gdb)
prompt to get a backtrace of the calls.

-- 
 Dr. Ludovic Rousseau
___
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle