AS3:套接字和HTTPS/SSL
我在 AS3 中实现 Socket 类取得了相当大的成功,特别是在发出 HTTP 请求来检索二进制(图像)或 ascii (JSON) 数据方面。然而,我需要能够在 HTTP 和 HTTPS 之间保持灵活性 - 因此考虑到 AS3 的 Socket 类的当前状态,这成为一个问题。
我的问题不一定限于 AS3,但也许核心库中有一些我不知道的见解。显然,将 HTTP 请求的端口和协议更改为 443
和 ssl://
是不够的 - Apache(例如)会回应说你是个白痴(原文如此) )并且它不会通过 SSL 连接为您提供任何服务。
诚然,我不是 SSL 专家,但是它在 AS3 中可行吗?如果可以,那么与通过 HTTP 的标准连接相比,在套接字写入/读取方面有何不同?特别是,您将如何对发送和接收的信息进行编码/解码?任何想法将不胜感激。
I've had quite a bit of success implementing the Socket class in AS3, particularly with making HTTP requests to retrieve binary (images) or ascii (JSON) data. However, I need to be able to be flexible between HTTP and HTTPS - so given the current state of AS3's Socket class, this becomes a problem.
My question isn't necessarily limited to AS3, but maybe there's some insight in core lib that I'm not aware of. Obviously changing the port and protocol of a HTTP request to 443
and ssl://
is not sufficient - Apache (for example) will respond saying that you are a moron (sic) and it isn't going to serve you anything over an SSL connection.
So I referenced Bruce Wang's secure sockets in Flex blog post and attempted to implement some of those methods, particularly using Hurlant's crypto
classes, but even after the initial socket.sendBytes(rsaEncryptedPublicKey)
call, Apache returns an empty response body (including no response headers).
I'm admittedly not an SSL expert, but is it feasible within AS3, and if so, what would differ in writing to/reading from the socket versus a standard connection over HTTP? Particularly, how would you go about encoding/decoding information sent and received? Any thoughts would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Bruce 似乎制定了自己的协议,但该协议不是正确的 SSL/TLS。
as3crypto 似乎有一个 TLSSocket 类用于执行您想要的操作(请参阅此 testHost 函数用于 HTTPS 的使用示例)。
Bruce appears to have made up his own protocol that isn't proper SSL/TLS.
as3crypto appears to have a TLSSocket class for doing what you want (see this testHost function for usage example with HTTPS).