听雨

专,静,谦,筹,悟,慎,透,恒
  博客园  :: 首页  :: 新随笔  :: 管理

.Net SignCode

Posted on 2008-05-07 14:28  听雨  阅读(469)  评论(0编辑  收藏  举报

How to Exporting a code signing certificate to a PVK
'========================================
'   http://www.tech-pro.net/export-to-pvk-spc.html
'   http://www.slproweb.com/products/Win32OpenSSL.html
'   http://www.globalsign.com/support/code-signing/pvk-spc.html
'   PVK.exe                                                   http://www.tech-pro.net/files/pvktool.zip
'   Win32OpenSSL_Light-0_9_8g.exe           http://www.slproweb.com/download/Win32OpenSSL-0_9_8g.exe 
'========================================
Step 1:
Install Win32OpenSSL_Light-0_9_8g.exe to C:\Program Files\OpenSSL
// when installing , maybe overwrite 2 system files.

Step 2:
Copy pvk.exe to C:\Program Files\OpenSSL\Bin , the path of pvk.exe file is as same as openssl.exe file.

Step 3:
Import certificate file . for example, the certificate file is F2156972.p12 , the userName is ZhouFuqiang , Import password is 123456 .
Step 3.1:   double click F2156972.p12 , input the Import password 123456 when system issue.
Step 3.2    Setting Private Password is 654321
Step 3.3    Next...Finish.

Step 4:
Export certificate "ZhouFuqiang" to  pfx file.
Step 4.1 :  Run  IE(Internet Explorer) , tools --->content(內容)--->certificate(憑証) , Select "ZhouFuqiang" , Click "Export" Button, Next...
Step 4.2 :  When issue Export Private Key,Select it (YES!)
Step 4.3 :  Input Private password is 654321
Step 4.4 :  Set export  file path and filename,for example C:\Program Files\OpenSSL\Bin\F2156972.pfx , Next... Finish.

Step 5:
Run  Visual Studio .NET Command Prompt , set current directory to C:\Program Files\OpenSSL\Bin , run command:
openssl.exe pkcs12 -in F2156972.pfx -nocerts -nodes -out F2156972.pem
// system issue password ,input 654321,enter

pvk.exe -in F2156972.pem -topvk -strong -out F2156972.pvk
// system issue password ,input 654321,enter,maybe twice.

OK, the pvk file had generated.

 


==================================================================
How to add signcode to EXE or DLL
==================================================================

Step0: Run  IE(Internet Explorer) , tools --->content(內容)--->certificate(憑証) , Select "ZhouFuqiang" , Click "Export" Button, Next...
           don't export Private Key(Only Public Key) ,export " DER X.509(*.cer) " and Save as "F2156972Public.cer"
Step1: Run  Visual Studio .NET Command Prompt,input SIGNCODE ,enter.
Step2: Select  Exe or DLL file
Step3: Select "Custom Mode"
Step4: Select "From File" (Find Public Key File)  , find  the F2156972Public.cer file, Next...
Step5: Select Private Key File(pvk File)
NOTE: pvk File see to <<How to Exporting a code signing certificate to a PVK>>
Step6: Input Private password
Step7: Next ... Finish.