拼吾爱程序人生

首页 » .Net编程 » Visual Studio.NET » 开源opensc工程windows平台下编译
cobra - 2008-9-23 12:43:00
在Google上搜了一下opensc的简介,没有,算了还是自己说吧。
opensc官方网站http://www.opensc-project.org/
工程简介:对于智能卡的访问,opensc工程提供了一套库和工具。opensc重点放在了卡片的密码操作,推进卡片的应用如邮件加密、认证和签名。opensc实现了PKCS#11的API以便支持Mozilla FireFox(浏览器)和Thunderbird(邮件客户端)能使用它。opensc实现了PKCS#15标准以便兼容所有的应用。
opensc支持以下卡片:

National ID CardsSmart CardsUSB Tokens二、编译环境
操作系统:Windows XP SP3
开发工具:vistual studio 2003 sp1
代码:opensc-0.11.6.tar.gz
库:openssl 0.9.7e.tar.gz、libtool-1.5.26-bin.zip

三、编译过程
libtool:把zip包解压至c:\(或者别的目录)下
openssl:把tar.gz包解压至c:\下,编译之,步骤略(google上有很多在windows下编译openssl的例子)
opensc:把tar.gz包解压至c:\下,编辑 win32/Make.rules.mak。下面贴出编辑好的文件:

# Note: these instructions obsolete the instructions in opensc.html
# You first need to download the gnuwin32 libtool (e.g. the "Binaries" and "Developer
# files" from http://gnuwin32.sourceforge.net/packages/libtool.htm)
# Then fill in the directory path to ltdl.h on the LIBLTDL_INCL line below, preceeded
# by an "/I"; and fill in the path to the libltdl.lib on the LIBLTDL_LIB line below.
# Then you can build this OpenSC package; and afterwards you'll need to copy the
# libltdl3.dll somewhere on your execution path.
LIBLTDL_INCL = /IC:\libtool-1.5.26-bin\include    # E.g. /IC:\libtool-1.5.8-lib\include (这里改成你自己的路径,我的是c盘)
LIBLTDL_LIB = C:\libtool-1.5.26-bin\lib\ltdl.lib    # E.g. C:\libtool-1.5.8-lib\lib\libltdl.lib(这里改成你自己的路径,我的是c盘)

OPENSC_FEATURES = pcsc
# If you want support for OpenSSL (needed for a.o. pkcs15-init tool and openssl engine):
# - download and build OpenSSL
# - uncomment the line starting with OPENSSL_DEF
# - set the OPENSSL_INCL_DIR below to your openssl include directory, preceded by "/I"
# - set the OPENSSL_LIB below to your openssl lib file
OPENSSL_DEF = /DENABLE_OPENSSL  #把这个选项打开,源代码中使用了openssl,不然会报错
!IF "$(OPENSSL_DEF)" == "/DENABLE_OPENSSL"
OPENSSL_INCL_DIR = /IE:\软件\加密库\openssl\openssl-0.9.7c\include      #改这里的路径
OPENSSL_LIB = E:\软件\加密库\openssl\openssl-0.9.7c\out32dll\Debug\libeay32.lib #指向编译好的libeay32.lib
PROGRAMS_OPENSSL = pkcs15-init.exe cryptoflex-tool.exe netkey-tool.exe piv-tool.exe
OPENSC_FEATURES = $(OPENSC_FEATURES) openssl
!ENDIF

# If you want support for zlib (Used for PIV, infocamere and actalis:
# - Download zlib and build
# - uncomment the line starting with ZLIB_DEF
# - set the ZLIB_INCL_DIR below to the zlib include lib proceeded by "/I"
# - set the ZLIB_LIB  below to your zlib lib file
#ZLIB_DEF = /DENABLE_ZLIB
!IF "$(ZLIB_DEF)" == "/DENABLE_ZLIB"
ZLIB_INCL_DIR = /IC:\ZLIB\INCLUDE
ZLIB_LIB = C:\ZLIB\LIB\zlib.lib
OPENSC_FEATURES = $(OPENSC_FEATURES) zlib
!ENDIF


COPTS = /D_CRT_SECURE_NO_DEPRECATE /Zi /MD /nologo /DHAVE_CONFIG_H /I$(TOPDIR)\src\include /I$(TOPDIR)\src\include\opensc /I$(TOPDIR)\src\common $(OPENSSL_INCL_DIR) $(ZLIB_INCL_DIR) $(LIBLTDL_INCL) /D_WIN32_WINNT=0x0400 /DWIN32_LEAN_AND_MEAN $(OPENSSL_DEF) $(ZLIB_DEF) /DOPENSC_FEATURES="\"$(OPENSC_FEATURES)\""
LINKFLAGS = /DEBUG /NOLOGO /INCREMENTAL:NO /MACHINE:IX86

install-headers:
@for %i in ( $(HEADERS) ) do \
  @xcopy /d /q /y %i $(HEADERSDIR) > nul
install-headers-dir:
@for %i in ( $(HEADERSDIRFROM2) ) do \
  @xcopy /d /q /y %i\*.h $(HEADERSDIR2)\*.h > nul
.c.obj::
cl $(COPTS) /c $<
.rc.res::
rc /l 0x0409 /r $<
clean::
del /Q *.obj *.dll *.exe *.pdb *.lib *.def

打开vistudio studio .net 2003 command prompt 窗口,然后在opensc根目录下执行 nmake -f Makefile.mak,编译成功!





(文/adylee  出处/博客园)

 您可能对 [Visual Studio.NET] 的这些文章也感兴趣:

COM组件开发实践(四)---From C++ to COM :Part 1
Window 消息大全使用详解
PDC大会学习记录
Ultimate List of Free Windows Software from Microsoft
VS2008 中文版安装ASP.NET MVC Beta
下载.NET 3.5 Enhancements Training Kit
在.net 1.x 中, 实现多语言功能
初探Visual Studio 2008 Shell
Lighter Weight Version of .NET for Clients
Log4net学习笔记
1
查看完整版本: 开源opensc工程windows平台下编译
Modify by pin5i DZNT_ExpandPackage 2.1.3258 2007-2008 pin5i.com
  Total Unique Visitors: