简体   繁体   English

Rails Apnotic OpenSSL 警报证书过期错误

[英]Rails Apnotic OpenSSL alert certificate expired error

I'm trying to send Apple Push Notifications from a Rails app using the Apnotic gem.我正在尝试使用 Apnotic gem 从 Rails 应用程序发送 Apple 推送通知。

I get the following error when I run @ios_client.push(note) .运行@ios_client.push(note)时出现以下错误。

Traceback (most recent call last):
    5: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:114:in `block (2 levels) in ensure_open'
    4: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `socket_loop'
    3: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `loop'
    2: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:145:in `block in socket_loop'
    1: from /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/openssl/buffering.rb:182:in `read_nonblock'
/app/vendor/ruby-2.6.5/lib/ruby/2.6.0/openssl/buffering.rb:182:in `sysread_nonblock': SSL_read: sslv3 alert certificate expired (OpenSSL::SSL::SSLError)

I believe my certificate that I obtained from the Apple Developer account is not expired (I tested by creating a new one), so is there something wrong with my OpenSSL installation?我相信我从 Apple Developer 帐户获得的证书没有过期(我通过创建一个新的证书进行了测试),那么我的 OpenSSL 安装有问题吗?

I get the same error locally and on Heroku.我在本地和 Heroku 上遇到了同样的错误。 How can I fix this?我怎样才能解决这个问题?

Check your certificate, open it by your desktop environment and see if the date is between not valid before and not valid after .检查您的证书,在您的桌面环境中打开它,查看日期是否介于not valid beforenot valid after之间。

将密钥粘贴到文件并使用 .pem 保存

First save your key with .pem首先使用 .pem 保存您的密钥

关键细节 If you are using mac, click the file just saved and press space bar to check valid date如果您使用的是 mac,请单击刚刚保存的文件并按空格键检查有效日期

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

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