Step On Hoe to access smartcard

11.11.06 (11:35 pm)   [edit]

Below are the steps which we can perform to access Smart Card:

  1. Use the SCardEstablishContext API to get a Context Handle associated with a reader. We get this handle as all other API functions in WicSCard.dll need to pass this handle as a parameter.
  2. Later using the SCardConnect API you obtain hCard that is handle to a card. Just like above we will need this handle to communicate with the Card.
  3. You may then use SCardStatus with the above hCard value to get the status of the card before you actually start with some transaction.
  4. You then use SCardTransmit API to send APDU to the associated card and retrieve the response at the same time. You'll need the hCard value here too.
  5. After you're done using the Card you use the SCardDisconnect API to disconnect from the Card using the hCard value associated with the card. Then this hCard value is no longer valid and you should do a SCardConnect call again to retrieve a new handle in case you want to reconnect again
  6. Finally when you don't need the connection with the reader device you just call the SCardReleaseContext API to release the Context handle associated with the reader.

smart card program successfull compiled

11.08.06 (2:00 am)   [edit]
1. Create winscard.def from winscard.dll file ...
   > impgen wincard.def winscard.dll
impgen can be found in Borland free tools.
 
2. I have to create *.a file from. Todo that i have to run this:
dlltool.exe --as=as --dllname winscard.dll --add-stdcall-alias 
--def winscard.def --kill-at --output-lib libwinscard.a
** sometimes --as=as will not work ... like mine i have to define full path to the as.exe.
With this i m successfully get rid of the:
"  [Linker error] undefined reference to `SCardEstablishContext@16  ' "
error Cool. Now i can proceed to my next level... muhehehhee....
 
I have to clear the warning : 
" [Warning] passing arg 4 of `SCardListReadersA' from incompatible pointer type "
i will update soon on my success ... or failure ...
 
 

Adding New Users to MySQ

11.07.06 (4:31 pm)   [edit]

by Jeff Hunter, Sr. Database Administrator

You can add new users to MySQL in two different ways: by using the GRANT statement or my manipulating the MySQL grant tables directly. The preferred method is to use the GRANT statement because they are more concise and less error-prone.

The following examples show how to use the mysql client to set up new users. These examples assume that privileges are set up according to the defaults provided in the previous MySQL DBA Tip, "Setting Up the Initial MySQL Privileges". This means that to make changes, you must be on the same machine where mysqld is running, you must connect as teh MySQL root user, and the root user must have the insert privilege for the mysql database and the reload administrative privilege. Also, if you have changed the root user password, you must specify it for the following mysql commands:

You can add new users by issuing GRANT statements:

 

  % mysql -u root mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO oracle@localhost
-> IDENTIFIED BY 'manager' WITH GRANT OPTION;

mysql> GRANT ALL PRIVILEGES ON *.* TO oracle@"%"
-> IDENTIFIED BY 'manager' WITH GRANT OPTION;

mysql> GRANT RELOAD, PROCESS ON *.* TO admin@localhost;

mysql> GRANT USAGE ON *.* TO dummy@localhost;

The GRANT statements (above) create and set up three new users:

  • oracle
    A full superuser who can connect to the server from anywhere, but who must use a password 'manager' to do so. Note that we must issue GRANT statements for both oracle@localhost and oracle@"%". If we don't add the entry with localhost, the anonymous user entry for localhost that is create by mysql_install_db will take precedence when we connect from the local host because it has a more specific Host field value and thus comes earlier in the user table sort order.
  • admin
    A user who can connect from localhost without a password and who is granted the reload and process administrative privileges. This allows the user to execute the mysqladmin reload, mysqladmin refresh, and mysqladmin flush_* commands, as well as mysqladmin processlist. No database-related privileges are granted. (They can be granted later by issuing additional GRANT statements.)
  • dummy
    A user who can connect without a password, but only from the local host. The global privileges are all set to 'N' - the usage privilege type allows you to create a user with no privileges. It is assumed that you will grant database-specific privileges later

How do I create the libwinscard.a import library suitable for linking with native Windows WINSCARD.DLL

11.07.06 (3:15 pm)   [edit]
 How do I create the libwinscard.a import library suitable for linking with native Windows WINSCARD.DLL ?

First, create the .def file from the DLL itself:

    & nbsp; $ /usr/bin/impgen WINSCARD.DLL > winscard.def
   

Then, create the .a import library:

    & nbsp; $ /usr/bin/dlltool --as=as \
    & nbsp;   &n bsp;   --dllname WINSCARD.DLL --def winscard.def \
        --kill-at --output-lib libwinscard.a
   

Now you can place libwinscard.a into a standard library path and use -lwinscard to link using it. Note that this file is only required to be found by gcc when linking. It will not be required when executing the program.