What is the difference between GET and POST encryption?

What is the difference between GET and POST encryption?

问题

What is the difference when encrypting GET and POST data?

To be more specific: when https-SSL encrypts both of this methods, what is the difference in the way the browser does this; Which parts are encrypted and which are not?

I read somewhere that the destination url is not encrypted in POST, is that true? If it is true and same in GET, where are all the parameters?

When both methods are encrypted with same data, do they look the same when sniffed? What parts are encrypted and which are not?

 

回答

GET data is appended to the URL as a query string:

https://example.com/index.html?user=admin&password=whoops

Because the data is appended to the URL, there is a hard limit to the amount of data you can transfer. Different browsers have different limits, but you'll start to have problems around the 1KB-2KB mark.

POST data is included in the body of the HTTP request and isn't visible in the URL. As such, there's no limit to the amount of data you can transfer over POST.

If the HTTP connection is using SSL/TLS, then GET parameters are also encrypted but can show up in other places such as the web server logs and will be accessible to browser plugins and possibly other applications as well. POST data is encrypted and does not leak in any other way.

From a Google Discussion:

The data contained in the URL query on an HTTPS connection is encrypted. However it is very poor practice to include such sensitive data as a password in the a 'GET' request. While it cannot be intercepted, the data would be logged in plaintext serverlogs on the receiving HTTPS server, and quite possibly also in browser history. It is probably also available to browser plugins and possibly even other applications on the client computer.

Always use POST over HTTPS if you want to securely transfer information.

If you're using an encryption library to encrypt the data then you can use GET or POST, but this will be an added pain and you might not setup the encryption correctly, so I'd still recommend using POST over HTTPS, rather than rolling your own encryption setup. This problem has been solved already, don't re-invent the wheel.

Another option you might want to consider is using a secure cookie. A cookie that has the secure flag set is only sent over a secure channel, such as HTTPS, and isn't sniffable. This is a good way to persist information securely, such as a session ID.

评论: 

Wrong. GET requests are also encrypted, including the Query String - stackoverflow.com/questions/499591/are-https-urls-encrypted Jun 17 '10 at 16:36
 
 
 

 

 

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(28)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-12-22 What is the difference between customErrors and httpErrors?
2020-12-22 正则调试 how to debug regex https://regex101.com/debugger
2020-12-22 \d is less efficient than [0-9]
2020-12-22 How to navigate back to the last cursor position in Visual Studio Code?
2017-12-22 ROW_NUMBER (Transact-SQL)
点击右上角即可分享
微信分享提示