码迷,mamicode.com
首页 > 其他好文 > 详细

在Postman中使用自签的SSL证书(转)

时间:2014-08-08 17:50:46      阅读:7755      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   使用   os   io   strong   for   

add by zhj: 如果是自签的SSL证书,Postman会出现图1的错误,这时我们需要直接在Chrome的地址栏目输入该root URL,出现图2,选择“继续”。

这样,再用Postman就OK了,但是当关闭Chrome后,又出现同样的问题,所以终极解决办法是把证书导出,然后将证书的颁发机构(其实就是用putty生

成证书请求时填写的Common Name,即服务器域名或IP)添加到受信任的根证书颁发机构,这样就OK了。在Win7上用Chrome试验过,成功。

 

原文:http://blog.getpostman.com/index.php/2014/01/28/using-self-signed-certificates-with-postman/

Self-signed certificates are often used in testing and development environments to provide a layer of security for an API.

As they are not verified by a trusted authority, accessing  an API endpoint with something like https://<ip> through Postman, would throw up an error like this:

bubuko.com,布布扣

With the legacy app, you could go to the root URL in Chrome and allow the browser to access URLs with self-signed certificates. But this doesn’t work with the new packaged app.

If you try to hit a URL with a self-signed SSL certificate, you would get a 500 error as Chrome would decline the certificate:

bubuko.com,布布扣

Turns out that there is a better solution to solve this a problem, and it also avoids adding an exception to Chrome every time you start the browser. This is how you do it:

1. Go to the root URL in your browser. For ex. https://localhost
2. Click on the lock icon on the top left in the URL bar.
3. Open the Connection tab in the dropdown that comes up
4. Click on certificate information

The dialog that comes up now depends on the operating system you are on. Chrome uses the underlying OS layer to handle SSL certificates.

Mac OS X

1. In the dialog that comes up, click and drag the certificate icon to your desktop to create a *.cer file

bubuko.com,布布扣
2. Double click on the file to open the OS X Keychain Access tool.
3. Add the certificate to the System keychain and select “Always trust”

bubuko.com,布布扣
4. Once the certificate is added, double click it to open more details

bubuko.com,布布扣
5. Expand the Trust item
6. Select “Always trust”

bubuko.com,布布扣
7. Close Keychain Access and restart Chrome

Windows

1. In the certificates window, go to the Details tab

bubuko.com,布布扣
2. Select Copy to File
3. Save the certificate file on your disk. Close the certificate window.

bubuko.com,布布扣
4. Go to Chrome > Settings, search for SSL (chrome://settings/search#ssl) and click on Manage certificates

bubuko.com,布布扣
5. Go to the Trusted Root Certification Authorities tab and click on import
6. Select the file you saved on your disk in step 3.

bubuko.com,布布扣
7. Close this window and restart Chrome.

Linux

1. Go to the Details tab

bubuko.com,布布扣
2. Select Export and save the file on your disk

bubuko.com,布布扣bubuko.com,布布扣
3. Go to Chrome > Settings, search for SSL (chrome://settings/search#ssl) and click on Manage certificates
4. Go into the Authorities tab

bubuko.com,布布扣
5. Import the certificate
6. Restart Chrome

You should be able to fire requests to the endpoints validated by this certificate. The SSL warning will not show up in Chrome even if you restart the browser.

Do make sure that you have verified the IP where the certificate comes from. This should only be done for verified IP addresses.

This method also works for certificates for localhost. Make sure that the common name of the certificate while generating the certificate is localhost.

Let me know in the comments if you face any problems with this.

 

 

在Postman中使用自签的SSL证书(转),布布扣,bubuko.com

在Postman中使用自签的SSL证书(转)

标签:des   blog   http   使用   os   io   strong   for   

原文地址:http://www.cnblogs.com/ajianbeyourself/p/3899729.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!