简体   繁体   English

关于Android上的SSL的几个问题

[英]Few questions about SSL on Android

I write application which will need send very confidential data to HTTP server. 我编写了需要将非常机密的数据发送到HTTP服务器的应用程序。 Because of confidential of this data I need to secure connection as much as I can. 由于此数据是机密的,因此我需要尽可能地保护连接。 I decided to use SSL via HTTP POST. 我决定通过HTTP POST使用SSL。 My problem is that I'm really new in SSL securing and I have some doubt about the process of creating SSL app on Android. 我的问题是,我真的是SSL安全方面的新手,并对在Android上创建SSL应用程序的过程有些疑问。 Can anybody tell me if I do everything well? 谁能告诉我我一切都好吗?

To create my application I do following steps: 要创建我的应用程序,请执行以下步骤:

  1. I generate SSL key and certificate using OpenSSL and following this tutorial I need to give .key file to my team mate who write HTTP server so that he could configure apache and use this .key file to verify identity of the sender right? 我使用OpenSSL生成SSL密钥和证书,并且在本教程之后,我需要将.key文件提供给编写HTTP服务器的队友,以便他可以配置apache并使用此.key文件来验证发送者的身份,对吗?

  2. I create .bks keystore following this tutorial Then I read this keystore using the same tutorial and then I can connect to server. 我按照本教程创建.bks密钥库,然后使用同一教程阅读此密钥库,然后可以连接到服务器。 Then server can verify my identity using .key file right? 然后服务器可以使用.key文件验证我的身份,对吗?

Is this all what I need to create secure connection between my application and HTTP server? 这是我在应用程序和HTTP服务器之间创建安全连接所需的全部吗? Do this will work properly and safety already? 这样是否可以正常工作并且已经安全?

  1. Wrong. 错误。 You need to generate a key pair: keep the private key private, give your mate the public key. 你需要生成一个密钥对:保持私钥私人的,给你的伴侣的公钥

  2. You don't seem to have read the tutorial you cited. 您似乎还没有阅读您引用的教程。 It says there, correctly, that you can do the whole process with the keytool. 它正确地说明您可以使用keytool完成整个过程。 There's no need to bring OpenSSL into it at all. 根本不需要将OpenSSL引入其中。

However the statement in the tutorial about the Apache thing being faster is grade A nonsense. 但是,教程中有关Apache更快的说法是A级废话。 Both it and the HttpsURLConnection class use JSSE under the hood, which uses java.net.Socket under the hood, whose speed is network bound in the first place. 它和HttpsURLConnection类都在幕后使用JSSE,而在幕后使用java.net.Socket,其速度首先取决于网络。 It would be truly miraculous if it was faster. 如果速度更快,那将是真正的奇迹。 Or slower. 或更慢。 There might be other reasons to use it (I never have) but this isn't one of them. 使用它可能还有其他原因(我从来没有),但这不是其中之一。 IMHO what is faster is to set a couple of system properties and use the built in stuff, instead of writing several yards of code. 恕我直言,更快的方法是设置几个系统属性并使用内置的东西,而不是编写几码的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM