Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

OpenSSL::X509::CertificateError when i use mac ox keychain tools export .p12 file. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/apns/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ def self.open_connection
raise "The path to your pem file does not exist!" unless File.exist?(self.pem)

context = OpenSSL::SSL::SSLContext.new
context.cert = OpenSSL::X509::Certificate.new(File.read(self.pem))
context.key = OpenSSL::PKey::RSA.new(File.read(self.pem), self.pass)
# context.cert = OpenSSL::X509::Certificate.new(File.read(self.pem))
# context.key = OpenSSL::PKey::RSA.new(File.read(self.pem), self.pass)

# for mac os keychain export.
pkcs = OpenSSL::PKCS12.new(File.read(self.pem), self.pass)
context.cert = pkcs.certificate
context.key = pkcs.key

sock = TCPSocket.new(self.host, self.port)
ssl = OpenSSL::SSL::SSLSocket.new(sock,context)
Expand Down