简体   繁体   English

Python服务器端推送iphone的通知

[英]Python Server side Push notification for iphone

I've read so many answers and tutorials and post about push notification, I've managed the registration, creating the certificates p12 and pem files as well as apple provisioning just fine so my application knows how to receive push notifications (or at least it looks like it does) 我已经阅读了很多答案和教程,并发布了关于推送通知的帖子,我已经管理了注册,创建了证书p12和pem文件以及苹果配置,所以我的应用程序知道如何接收推送通知(或者至少它看起来像它)

Now I'm trying to set my server side - python/django. 现在我正在尝试设置我的服务器端 - python / django。 I've uploaded the key & cert pem files into my server folder, following this answer here at SO. 我上传的关键和证书PEM文件到我的服务器文件夹中,以下在所以这里的答案。 I'm getting an error when i try to ssl_sock.connect( theHost ) since the pem has a paraphrase, I've read many people saying just to remove the paraphrase but then isn't the whole security public/ private key is out of the window? 当我尝试使用ssl_sock.connect( theHost )时我得到一个错误,因为pem有一个释义,我读过许多人说只是为了删除这个释义但是然后不是整个安全公钥/私钥都没有了窗户? and if using this approach do i need to remove the paraphrase from the pem file at apple as well? 如果使用这种方法,我还需要从苹果的pem文件中删除释义吗? or the one i've downloaded to my mac? 还是我下载到我的Mac的那个?

To expand on meda's answer - think about this: 为了扩展meda的答案 - 考虑一下:

  1. If you put a passphrase on certificate, you will need to hard-code the pass phrase somewhere in your django project, since it will need that passphrase to load the certificate. 如果你在证书上加密码,你需要在django项目的某个地方对密码进行硬编码,因为它需要密码来加载证书。

  2. If someone compromises your server, they have your certificate. 如果有人危及您的服务器,他们就会拥有您的证书。 "No problem!", you think. “没问题!”,你想。 You've got a pass phrase, so they can't do anything with it! 你有一个密码短语,所以他们无法用它做任何事情!

  3. Except they also have access to your source code. 除了他们也可以访问您的源代码。

  4. So now they have your pass phrase, and your certificate. 所以现在他们有你的密码和你的证书。

  5. So all you really did was add hassle for yourself, without any benefit. 所以你真正做的就是为自己增加麻烦,没有任何好处。

Pass phrases on certificates make sense if the certificate is being stored among other shared assets, for whatever reason, or for high encryption concerns where the private key will ONLY be used manually, by an individual or group. 如果证书存储在其他共享资产中,无论出于何种原因,或者对于私人密钥仅由个人或组手动使用的高加密问题,证书上的密码短语都是有意义的。

In all other cases, it's a complete waste of effort. 在所有其他情况下,这完全是浪费精力。

I used PHP to accomplish this but I can tell you about what I know: 我用PHP来完成这个,但我可以告诉你我所知道的:

  • Passphrase is just an additional encryption layer 密码短语只是一个额外的加密层
  • SSL encryption alone is really secure. 仅SSL加密确实很安全。
  • If you want to remove passphrase leave it blank when you are prompt to enter one. 如果要删除密码,请在提示输入密码时将其留空。

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

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