11

使用該link用於生成推送通知PEM文件,但我不明白以下步驟......如何在iPhone中爲推送通知生成pem文件?

安裝SSL證書和密鑰的服務器上

您應該安裝SSL分發證書和私人密鑰 您之前在服務器計算機上獲得的密鑰,其中 供應商代碼運行並從中連接到沙箱或 生產版本的APN。爲此,請完成以下步驟:

  1. 打開鑰匙串訪問實用程序,然後單擊左窗格中的我的證書類別。

  2. 找到您要安裝的證書並公開其內容。 您將看到證書和私鑰。

  3. 選擇證書和密鑰,選擇文件>導出項目,然後將它們導出爲個人信息交換(.p12)文件。

  4. 以Ruby和Perl等語言實現的服務器通常能夠更好地處理個人信息交換格式中的證書。將證書轉換爲這種格式,完整 以下步驟:

    • 在鑰匙串訪問,選擇證書,然後選擇文件>導出項目。選擇個人信息交換(.p12)選項 選擇保存位置,然後單擊保存。

    • 啓動Terminal應用程序並在提示符後輸入以下命令:openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes。

  5. 將.pem證書複製到新計算機並將其安裝在適當的位置。

+0

其中兩個證書中步驟3公司名片? –

+0

pem文件加APNS代碼:https://iosdevcenters.blogspot.com/2017/09/how-to-create-pem-file-for-apns-ios.html –

回答

10

最後我sloved產生推送通知榮譽證書用於生成推送通知證書

完整步驟.....

1)打開鍵鏈和請求證書顯示在下面的圖像。

enter image description here

2)更改通用名稱爲您PROJECT_NAME。

enter image description here

3)在鑰匙鏈上的OPEN鍵可以顯示兩個主要公共和私人

enter image description here

4)收件點擊私鑰和導出。

enter image description here

5)使名稱project_name_key.p12

6)加密碼的前1234

7)進入系統登錄密碼並保存。現在你有以下證書。

enter image description here

8)現在轉到顯影劑帳戶(https://developer.apple.com/devcenter/ios/index.action)和GOTO標識符創建新如果不退出。和編輯設置。

enter image description here enter image description here

如果推送通知禁用然後編輯啓用它。

enter image description here

9)發展,你可以創建你可以選擇最後一個第一個和分佈。

enter image description here enter image description here

10)後選擇並生成下載APNS證書並投入桌面並雙擊它。

11)然後打開鑰匙鏈並轉到證書。並且您可以顯示您的推送服務,然後顯示私鑰。

用1234密碼輸出它。

enter image description here

12)現在你有以下文件。

enter image description here

13)的開路端和GOTO桌面。

enter image description here

14)使用下面的行爲push_cert.p12文件

openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in push_cert.p12 

然後輸入密碼生成的.pem文件:-1234

enter image description here

15)生成的.pem文件使用project_name_key的以下行。P12文件

openssl pkcs12 -nocerts -out apns-dev-key.pem -in project_name_key.p12 

然後輸入密碼:-1234 輸入PEM通行短語:1234 驗證 - 輸入PEM通行短語:1234

enter image description here

16)進入下列在終端

3線
openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem 

爲apns-dev-key.pem輸入密碼短語:1234

cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem 

enter image description here

17)你有以下證書。

enter image description here

18)APNS-dev.pem發送文件在服務器上,並將它傳遞是1234

19),您必須使用開發gateway.sandbox.push.apple.com服務器。 和發行版可以使用gateway.push.apple.com服務器。

+0

對不起,但我不清楚什麼意思**'在服務器上發送.pem文件'**。我將不得不使用PHP從Apache服務器生成推送通知。我必須把這個文件放在我的服務器目錄中,並從我的php代碼中引用它嗎? – Nowdeen

6

這裏是你必須選擇在第3步這不是兩個證書什麼的截圖。這是一個證書+密鑰。

enter image description here

+0

在導出密鑰和證書.p12後,我將通過使用終端 – shakti

+0

@Shakti生成.pem我從來沒有嘗試過它,但是您是否嘗試過'openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes'? – Eran

+0

是的,我試圖通過導入證書和密鑰。一旦我得到mypushdev.p12 cerificate,然後我打開終端,並寫這個代碼openssl pkcs12 -in mypushdev.p12 -out mypushdev.pem -nodes。 – shakti

1

只需添加@ Nitin非常好描述的答案。創建pem之後,您可以使用 openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert MyKey.pem -key MyKey.pem 進行驗證,其中MyKey是您的pem文件的名稱。

將gateway.sandbox.push.apple.com替換爲gateway.push.apple.com,以連接到實時APNS。

7

對於**

  • 生產推送通知

**

我參考了從this link

要啓用推送通知到您的iOS應用程序,你會需要創建並上傳Apple推送通知證書(.pem fi le)給我們,這樣我們就可以代表您連接到Apple Push Server。

步驟1(已更新,更新的屏幕截圖這裏http://www.apptuitions.com/generate-pem-file-for-push-notification/版本):登錄到iOS Provisioning Portal中,單擊左側導航欄上的 「證書」。然後,點擊「+」按鈕。

enter image description here

enter image description here

enter image description here

步驟2:選擇蘋果推送通知服務SSL(生產)條件下的分配部分的選項,然後單擊 「繼續」 按鈕。 enter image description here

步驟3:選擇要使用你的BYO應用(如何創建一個應用程序ID)的應用ID,然後點擊「繼續」進入下一步。

enter image description here

第4步:按照以下步驟 「關於創建證書籤名請求(CSR)」 創建證書籤名請求。 enter image description here

補充Apple提供的說明。以下是一些額外的屏幕截圖,可幫助您完成所需的步驟:

步驟4補充屏幕截圖1:導航到Mac上的鑰匙串訪問的證書助理。

enter image description here

步驟4補充截圖2:填充證書信息英寸點擊繼續。

enter image description here

步驟5:上傳其在步驟4中產生的 「.certSigningRequest」 文件,然後點擊 「生成」 按鈕。 enter image description here

步驟6:點擊「完成」即可完成註冊,iOS的部署門戶頁面將會被刷新,看起來像下面的屏幕: enter image description here

然後點擊「下載」按鈕下載證書(.cer文件)您剛剛創建。 - 雙擊下載的文件將證書安裝到Mac上的Keychain Access中。

第7步:在您的Mac上,轉到「鑰匙串」,查找您剛剛安裝的證書。如果不確定哪個證書是正確的,那麼它應該以「Apple Production IOS Push Services:」開頭,然後是應用程序的捆綁ID。 enter image description here

步驟8:展開證書,你應該看到無論是您的姓名或公司名稱的私鑰。通過使用「選擇」鍵盤上的鍵,右鍵單擊選擇兩個項目(如果你使用一個按鈕鼠標或CMD-點擊),選擇「導出2項」,如下圖所示: enter image description here

然後保存P12文件名爲「pushcert.p12」到您的桌面 - 現在系統會提示您輸入密碼以保護它,您可以單擊Enter跳過密碼或輸入您想要的密碼。

步驟9:現在最困難的部分 - 開放Mac上的 「終端」,並運行以下命令:

cd 
cd Desktop 
openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts 

步驟10:使用this link(click here)

你可以檢查天氣的.PEM文件是否有效--->如果它是有效的,你會得到成功消息與通知如: enter image description here

對於**

  • 發展推送通知

**

只是看下面的Youtube鏈接Click here和享受..

0
  1. 鼠標右鍵點擊你的APN證書並點擊導出。這將產生對桌面
  2. 開放終端CD桌面中.P12證書並進行轉換的.p12成。質子交換膜下面的命令

    OpenSSL的PKCS12 -in Certificates.p12退房手續Certificates.pem -nodes -clcerts

    as shown in picture

4

我會建議一個更簡單的解決方案。只需使用Certifire
Certifire是一個macOS應用程序,只需在幾秒鐘內點擊一次即可生成Apple推送通知證書。

以下是步驟:
1.下載應用程序。
2.使用Apple開發者帳戶憑據登錄。
3.選擇應用程序ID
4.單擊「生成」按鈕
5.完成!

您將獲得.pem格式以及.p12格式的APN證書。 更多的,你也會得到.pem和.p12的組合(key + cert)!
更重要的是,您還將獲得所有這些證書的非密碼版本!

enter image description here

enter image description here

+1

這太棒了! ! ! –