SlideShare a Scribd company logo
1 of 15
憑證與簽章
 howard
guideline
   憑證是什麼
   如何產生憑證
   如何簽章
憑證是什麼
   大部分常用的憑證是以 X.509 v3 憑證標準為基準。
   通常憑證包含下列資訊:
       主體的公開金鑰值。
       主體識別元資訊 ( 如名稱及電子郵件位址 ) 。
       有效期間 ( 憑證有效的時間長度 ) 。
       簽發者識別元資訊。
       使用簽發者的數位簽章,可驗證主體公開金鑰及主體識
        別元資訊之間連結的有效性。
如何產生憑證
   Open Visual Studio Command Prompt
   C:> makecert -pe -ss My -sr LocalMachine -n CN="YOUR_CERT_NAME"
    -sky exchange -len 2048

   C:> mmc
   Add Certificates snap-in in MMC console, choose computer
    accounts
   expand Personal/Certificate folder, then export which you
    want.
如何產生憑證
   開啟主控台
如何產生憑證
   在主控台加入憑證嵌入式管理單位
如何產生憑證
   檢視已建立過的憑證
如何產生憑證
   匯出含 private key 的 pfx 檔
如何產生憑證
   匯出含 private key 的 pfx 檔
如何產生憑證
   匯出含 private key 的 pfx 檔
如何產生憑證
   匯出含 public key 的 cer 檔

如何產生憑證

如何簽章
   var pfxFileName = @"C:.....*.pfx";

   var password = @”#########";

   var cert = new X509Certificate2(pfxFileName, password);

   var rsa = (RSACryptoServiceProvider)cert.PrivateKey;

   var dataBytes = getDataBytes(…);

   var signData = rsa.SignData(dataBytes, new MD5CryptoServiceProvider());
如何驗證簽章
   var certFileName = @“C:......*.cer";
   var verifyCert = new X509Certificate2(certFileName);
   var rsaPublicCryptor =
    (RSACryptoServiceProvider)verifyCert.PublicKey.Key;
   var isValid = rsaPublicCryptor.VerifyData(dataBytes,
    new MD5CryptoServiceProvider(), signData);
References
   http://msdn.microsoft.com/en-us/library/9tsc5d0z

More Related Content

Viewers also liked

Find the jquery bug ii
Find the jquery bug iiFind the jquery bug ii
Find the jquery bug iiLearningTech
 
Css3 Flexible Box Layout
Css3 Flexible Box LayoutCss3 Flexible Box Layout
Css3 Flexible Box LayoutLearningTech
 
20130510 assembly binding
20130510 assembly binding20130510 assembly binding
20130510 assembly bindingLearningTech
 
20120525 equal identically_equal
20120525 equal identically_equal20120525 equal identically_equal
20120525 equal identically_equalLearningTech
 
Exception handling in asp.net
Exception handling in asp.netException handling in asp.net
Exception handling in asp.netLearningTech
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805LearningTech
 
Intro to trigger and constraint
Intro to trigger and constraintIntro to trigger and constraint
Intro to trigger and constraintLearningTech
 
Introduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderIntroduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderLearningTech
 

Viewers also liked (12)

linq 動動腦
 linq 動動腦 linq 動動腦
linq 動動腦
 
Model binding
Model bindingModel binding
Model binding
 
Find the jquery bug ii
Find the jquery bug iiFind the jquery bug ii
Find the jquery bug ii
 
Css3 Flexible Box Layout
Css3 Flexible Box LayoutCss3 Flexible Box Layout
Css3 Flexible Box Layout
 
Mvc3 razor
Mvc3 razorMvc3 razor
Mvc3 razor
 
20130510 assembly binding
20130510 assembly binding20130510 assembly binding
20130510 assembly binding
 
20120525 equal identically_equal
20120525 equal identically_equal20120525 equal identically_equal
20120525 equal identically_equal
 
Exception handling in asp.net
Exception handling in asp.netException handling in asp.net
Exception handling in asp.net
 
expression tree
expression treeexpression tree
expression tree
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805
 
Intro to trigger and constraint
Intro to trigger and constraintIntro to trigger and constraint
Intro to trigger and constraint
 
Introduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderIntroduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builder
 

Similar to 憑證

利用OpenSSL创建并验证证书
利用OpenSSL创建并验证证书利用OpenSSL创建并验证证书
利用OpenSSL创建并验证证书Water Sky
 
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制Timothy Chen
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全bruce761207
 
Internet Security
Internet SecurityInternet Security
Internet Securitybruce761207
 
Laradebut #7 - Laravel AUTH
Laradebut #7 - Laravel AUTHLaradebut #7 - Laravel AUTH
Laradebut #7 - Laravel AUTHSzuping Wang
 
如何使用JCE和CAPICOM进行加密和签名
如何使用JCE和CAPICOM进行加密和签名如何使用JCE和CAPICOM进行加密和签名
如何使用JCE和CAPICOM进行加密和签名Zac John
 
資訊安全筆記 2023_0129_0205.docx
資訊安全筆記 2023_0129_0205.docx資訊安全筆記 2023_0129_0205.docx
資訊安全筆記 2023_0129_0205.docxssuser9026c8
 
20201006 meta_coin 六角學院
20201006 meta_coin 六角學院20201006 meta_coin 六角學院
20201006 meta_coin 六角學院Hu Kenneth
 
Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_akaWASecurity
 
技术交流 支付二代信息安全及其代收付实现
技术交流 支付二代信息安全及其代收付实现技术交流 支付二代信息安全及其代收付实现
技术交流 支付二代信息安全及其代收付实现Banned Li
 
[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACK[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACKAj MaChInE
 
浅谈前端安全与规范(渔隐)
浅谈前端安全与规范(渔隐)浅谈前端安全与规范(渔隐)
浅谈前端安全与规范(渔隐)tbmallf2e
 
Puppet安装测试
Puppet安装测试Puppet安装测试
Puppet安装测试Yiwei Ma
 
Session1(更新20230205).pdf
Session1(更新20230205).pdfSession1(更新20230205).pdf
Session1(更新20230205).pdfssuser9026c8
 
淘宝开放产品前端实践
淘宝开放产品前端实践淘宝开放产品前端实践
淘宝开放产品前端实践taobao.com
 

Similar to 憑證 (20)

利用OpenSSL创建并验证证书
利用OpenSSL创建并验证证书利用OpenSSL创建并验证证书
利用OpenSSL创建并验证证书
 
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全
 
網路安全
網路安全網路安全
網路安全
 
網路安全
網路安全網路安全
網路安全
 
Internet Security
Internet SecurityInternet Security
Internet Security
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
 
Ssl
SslSsl
Ssl
 
Laradebut #7 - Laravel AUTH
Laradebut #7 - Laravel AUTHLaradebut #7 - Laravel AUTH
Laradebut #7 - Laravel AUTH
 
如何使用JCE和CAPICOM进行加密和签名
如何使用JCE和CAPICOM进行加密和签名如何使用JCE和CAPICOM进行加密和签名
如何使用JCE和CAPICOM进行加密和签名
 
資訊安全筆記 2023_0129_0205.docx
資訊安全筆記 2023_0129_0205.docx資訊安全筆記 2023_0129_0205.docx
資訊安全筆記 2023_0129_0205.docx
 
20201006 meta_coin 六角學院
20201006 meta_coin 六角學院20201006 meta_coin 六角學院
20201006 meta_coin 六角學院
 
Web security
Web securityWeb security
Web security
 
Pki guide v1.0a_aka
Pki guide v1.0a_akaPki guide v1.0a_aka
Pki guide v1.0a_aka
 
技术交流 支付二代信息安全及其代收付实现
技术交流 支付二代信息安全及其代收付实现技术交流 支付二代信息安全及其代收付实现
技术交流 支付二代信息安全及其代收付实现
 
[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACK[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACK
 
浅谈前端安全与规范(渔隐)
浅谈前端安全与规范(渔隐)浅谈前端安全与规范(渔隐)
浅谈前端安全与规范(渔隐)
 
Puppet安装测试
Puppet安装测试Puppet安装测试
Puppet安装测试
 
Session1(更新20230205).pdf
Session1(更新20230205).pdfSession1(更新20230205).pdf
Session1(更新20230205).pdf
 
淘宝开放产品前端实践
淘宝开放产品前端实践淘宝开放产品前端实践
淘宝开放产品前端实践
 

More from LearningTech

More from LearningTech (20)

vim
vimvim
vim
 
PostCss
PostCssPostCss
PostCss
 
ReactJs
ReactJsReactJs
ReactJs
 
Docker
DockerDocker
Docker
 
Semantic ui
Semantic uiSemantic ui
Semantic ui
 
node.js errors
node.js errorsnode.js errors
node.js errors
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
 
Expression tree
Expression treeExpression tree
Expression tree
 
SQL 效能調校
SQL 效能調校SQL 效能調校
SQL 效能調校
 
flexbox report
flexbox reportflexbox report
flexbox report
 
Vic weekly learning_20160504
Vic weekly learning_20160504Vic weekly learning_20160504
Vic weekly learning_20160504
 
Reflection & activator
Reflection & activatorReflection & activator
Reflection & activator
 
Peggy markdown
Peggy markdownPeggy markdown
Peggy markdown
 
Node child process
Node child processNode child process
Node child process
 
20160415ken.lee
20160415ken.lee20160415ken.lee
20160415ken.lee
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Expression tree
Expression treeExpression tree
Expression tree
 
Vic weekly learning_20160325
Vic weekly learning_20160325Vic weekly learning_20160325
Vic weekly learning_20160325
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
 
git command
git commandgit command
git command
 

憑證

  • 2. guideline  憑證是什麼  如何產生憑證  如何簽章
  • 3. 憑證是什麼  大部分常用的憑證是以 X.509 v3 憑證標準為基準。  通常憑證包含下列資訊:  主體的公開金鑰值。  主體識別元資訊 ( 如名稱及電子郵件位址 ) 。  有效期間 ( 憑證有效的時間長度 ) 。  簽發者識別元資訊。  使用簽發者的數位簽章,可驗證主體公開金鑰及主體識 別元資訊之間連結的有效性。
  • 4. 如何產生憑證  Open Visual Studio Command Prompt  C:> makecert -pe -ss My -sr LocalMachine -n CN="YOUR_CERT_NAME" -sky exchange -len 2048  C:> mmc  Add Certificates snap-in in MMC console, choose computer accounts  expand Personal/Certificate folder, then export which you want.
  • 5. 如何產生憑證  開啟主控台
  • 6. 如何產生憑證  在主控台加入憑證嵌入式管理單位
  • 7. 如何產生憑證  檢視已建立過的憑證
  • 8. 如何產生憑證  匯出含 private key 的 pfx 檔
  • 9. 如何產生憑證  匯出含 private key 的 pfx 檔
  • 10. 如何產生憑證  匯出含 private key 的 pfx 檔
  • 11. 如何產生憑證  匯出含 public key 的 cer 檔 
  • 13. 如何簽章  var pfxFileName = @"C:.....*.pfx";  var password = @”#########";  var cert = new X509Certificate2(pfxFileName, password);  var rsa = (RSACryptoServiceProvider)cert.PrivateKey;  var dataBytes = getDataBytes(…);  var signData = rsa.SignData(dataBytes, new MD5CryptoServiceProvider());
  • 14. 如何驗證簽章  var certFileName = @“C:......*.cer";  var verifyCert = new X509Certificate2(certFileName);  var rsaPublicCryptor = (RSACryptoServiceProvider)verifyCert.PublicKey.Key;  var isValid = rsaPublicCryptor.VerifyData(dataBytes, new MD5CryptoServiceProvider(), signData);
  • 15. References  http://msdn.microsoft.com/en-us/library/9tsc5d0z