将证书添加到Postman以连接到Go服务器

huangapple go评论91阅读模式
英文:

Add certificates to Postman to connect to Go server

问题

我按照教程进行操作。所以,我将server.crt和server.key添加到服务器初始化中。

err = r.RunTLS(":8080", "/users/myuser/server.crt", "/users/myuser/server.key")

然后我尝试向Postman发送请求。为此,我将证书添加到Postman中:

主机
localhost:8080
CRT文件
/Users/myuser/client.crt
KEY文件
/Users/myuser/client.key
密码
•••••

但是当我发送请求时,我收到了以下错误 - SSL错误:无法验证第一个证书。我知道我可以禁用SSL验证,但似乎应该有一种不禁用的选项来解决这个问题。你能帮助我吗?

英文:

I followed the following tutorial. So, I added server.crt and server.key to server initialization

err = r.RunTLS(":8080", "/users/myuser/server.crt", "/users/myuser/server.key")

Then I tried to send a request to Postman. For this purpose, I added certificate to Postman:

Host
localhost:8080
CRT file
/Users/myuser/client.crt
KEY file
/Users/myuser/client.key
Passphrase
•••••

But when I send the request I got this error - SSL Error: Unable to verify the first certificate. I know that I can disable SSL verification but it seems that there should be an option to do it without disabling it. Can you please help me

答案1

得分: 1

这是一个示例网站,链接为https://untrusted-root.badssl.com/。

客户端证书用于客户端身份验证,而CA证书用于验证服务器的身份。

在SSL证书的情况下,您只需要将正确的根CA添加到Postman中。

  1. 打开浏览器并访问该网站。

  2. 点击证书错误并点击查看证书。

  3. 点击证书路径,然后点击根证书并点击查看。

  4. 现在点击详细信息并选择复制到文件。

  5. 浏览并给新文件命名。

  6. 将创建的文件添加到Postman中。

**注意:**您还可以在设置中完全禁用SSL验证。

英文:

https://untrusted-root.badssl.com/

THis an example website ,

Client certificates are used for authentication of client, while CA certificates is to authenticate the identity of the server.

Incase of ssl certificate , you just need to add the correct Root CA to postman.

  1. TO do this open the website in browser:

  2. Click on the certificate error and click view certificate

将证书添加到Postman以连接到Go服务器

  1. CLick on cert path and click root cert and click view

将证书添加到Postman以连接到Go服务器

  1. Now click details and select copy to file

将证书添加到Postman以连接到Go服务器

  1. 将证书添加到Postman以连接到Go服务器

  2. browse and give a new file name

将证书添加到Postman以连接到Go服务器

  1. Add the created file to postman

将证书添加到Postman以连接到Go服务器

Note: you can also disable SSL validation all together from settings

huangapple
  • 本文由 发表于 2021年9月19日 00:58:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/69236734.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定