Python µ÷ÓÃCAPICOM ¶ÁÈ¡ USB KEYÊý×ÖÖ¤Êé
import win32com.client
store = win32com.client.Dispatch('CAPICOM.Store')
# ´ò¿ªÖ¤Êé´æ´¢Çø
# 2 -> CAPICOM_CURRENT_USER_STORE
# 0 -> CAPICOM_STORE_OPEN_READ_ONLY
store.Open(2, "My", 0)
# ²éÕÒÓÐЧ֤Êé
# 12 -> CAPICOM_CERTIFICATE_FIND_KEY_USAGE
# 0x00000080 -> CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE
# 9 -> CAPICOM_CERTIFICATE_FIND_TIME_VALID
# 6,6 -> CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,CERT_KEY_SPEC_PROP_ID
stores = store.Certificates.Find(12,0x00000080).Find(9).Find(6,6)
stores = store.Certificates.Find(0,szThumbprint) # szThumbprint -> °´ËõÂÔͼ²éѯ
# 0 -> CAPICOM_CERTIFICATE_FIND_SHA1_HASH
# ÕÒµ½Ö¤Êé¼ÆÊý
stores.Count
# »ñÈ¡Ö¤ÊéÐÅÏ¢
for data in stores:
data.GetInfo(0) # °ä·¢¸ø
data.GetInfo(1) # °ä·¢Õß
data.GetInfo(2) # Ö÷Ìâ(E) Email
data.GetInfo(3) # ''
data.GetInfo(4) # Ö÷ÒªÃû³Æ= RFC822 Name=
data.GetInfo(5) # ''
data.GetInfo(6) # Ö÷Ìâ(CN)
data.GetInfo(7) # °ä·¢Õß
data.Thumbprint # ËõÂÔͼ
»òÕß
stores.Item(idx).GetInfo(idx2) # idx 1-stores.Count
# idx2 0-7
# Ö¤ÊéÑ¡Ôñ
selCert = soters.Select()
selCert.GetInfo(0-7)
selCert.Thumbprint
# Êý¾ÝÇ©Ãû
SignedData = win32com.client.Dispatch('CAPICOM.SignedData')
Signer = win32com.client.Dispatch('CAPICOM.Signer')
TimeAttribute = win32com.client.Dispatch('CAPICOM.Attribute')
SignedData.Content = 'Test' # Ç©ÃûÄÚÈÝ
Signer.Certificate = ret.Item(1) # Ñ¡ÔñµÄÖ¤Êé
TimeAttribute.Name = 0 # 0 -> CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME
import datetime
TimeAttribute.Value = datetime.datetime('2010-04-22')
Signer.AuthenticatedAttributes.Add(TimeAttribute)
szSignature = SignedData.Sign(Signer, True, 0) # 0 -> CAPICOM_ENCODE_BASE64
# Ç©ÃûУÑé
SignedData.Content='Test';
SignedData.Verify(szSignature, true, 1); # 1 -> CAPICOM_VERIFY_SIGNATURE_AND_CERTIFIC
Ïà¹ØÎĵµ£º
¼ÈȻѡÔñÁËÔ¶·½£¬¾Í±ØÐëÈÕÒ¹¼æ³Ì http://wrsuifeng.javaeye.com
Python´úÂë
# Filename: excel.py
import os,sys,time
import win32com.client
import traceback
excel = win32com.client.Dispatch(" ......
ÀµÓºƣ¨http://laiyonghao.com£©
¹Ø¼ü×Ö£ºpython, easy_install, setuptools, myentunnel, polipo, windows, linux, socks5, http, proxy
ÒòΪһЩÖÚËùÖÜÖªµÄÔÒò£¬ÎÒÃÇÓÐЩÍøÕ¾ÎÞ·¨·ÃÎÊ£¬Ôì³ÉÉú»îºÍÉú²úµÄ¾Þ´ó²»±ã¡£ÆäÖжÔÎÒÓ°Ïì±È½Ï´óµÄÒ»¸ö¾ÍÊÇ°²×°Ä³Ð© Python Ä£¿éµÄʱºò£¬easy_install ÎÞ·¨·ÃÎʵ½ÍøÕ¾¡£ÔÚÕâÀï·ÖÏíÈ ......
ת×Ô£º
http://hi.baidu.com/feng2211/blog/item/8b86b6d9816a3f2710df9b79.html
ºÍ
http://i.19830102.com/archives/164
Python °æ±¾£º2.6
ÏÂÔصØÖ·£ºhttp://www.python.org/download/releases/2.6.1/
ÏÂÔØmsiÎļþ²¢°²×°
MySQLdb°æ±¾£º MySQL-python-1.2.2.win32-py2.6.exe
ÏÂÔصØÖ·£ºhttp://home.netimperia.com/ ......
ÎÊÌâÃèÊö
ÔÚC++ºÍPython»ìºÏ±à³ÌÖУ¬ÔÚÈí¼þ·¢²¼µÄʱºòÐèÒª½«pythonµÄ½âÊÍÆ÷´ò°üµ½°²×°³ÌÐòÖУ¬ÎªÁËÌá¸ßÓû§ÌåÑ飬ÎÒÃÇÐèÒªÈÃÓû§¸Ð¾õ²»µ½pythonµÄ°²×°£¬Èç¹ûÓû§ÒѾ°²×°ÓÐpythonµÄ»·¾³£¬ÎÒÃÇÒ²Òª±£Ö¤²»Ó°ÏìÏÖÓеÄϵͳ¡£
½â¾ö·½°¸
ÔÚPython2.5ÒÔºó£¬pythonÖ§³Ö´ÓzipÎļþÖжÁÈ¡python½Å±¾Îļþ£¬Ö§³Ö¶ÁÈ¡py£¬pyc£¬pyo£¬²»Ö ......
С°×ºÍС²ËÊÇ´óѧͬѧ£¬Õâ²»¿ìÒª±ÏÒµÁË£¬Á©ÈËÒ»ºÏ¼Æ£¬ÕÒ¸öÅàѵ°àѧµã¶«Î÷£¬Îä×°Ò»ÏÂÍ·ÄÔ£¬Ë³±ã½â¾ö¾ÍÒµÎÊÌâ¡£
“ÄãÃÇÒª±¨Äĸö°à°¡£¿”½Ó´ýËûÃǵÄÄêÇáС½ãÈÈÐĵØÎʵÀ¡£
“ÄãÃÇÕâÀïÄĸö°à×îºÃ£¿”С°×²»¼Ù˼Ë÷µØ˵£¬“µ±È»ÊDZ¨×îºÃµÄ°àÀ²¡£”
“ÎÒÃǹ«Ë¾µÄÅàѵÏîÄ¿¶¼ºÜºÃ”С½ãЦ ......