Giter Site home page Giter Site logo

apns_cer_build's Introduction

readme

  • 目的 : 一切都為了簡化 APNS 憑證,建立的問題,因 php/python 需用 .pem 來與 APNS 進行驗證,故利用簡易的 tool 透過 openssl 將 .p12 -> .pem,並達到基本測試效果
  • 可與 apnsReceiver 聯合測試
    • 接收訊息
    • 判斷此 token 是哪一種憑證建立,並對應到適當的 pem,進行發送

img4

required

  • openssl 1.0.1 or later : openssl version
  • curl support http2 : curl -V

解決問題

  1. 收納憑證
  2. 建立憑證
  3. 測試憑證
    • Apple Push Notification service SSL (Sandbox)
    • Apple Push Notification service SSL (Sandbox & Production) : 新的 production 的 apns cer 包含 Sandbox & Production
  4. 測試 apns server
  5. 測試推播 : 要求安裝 curl with http2
    • install(mac) :
      • brew install curl --with-nghttp2
      • brew link curl --force

How to use

  1. 專案環境建立,可參考 /drawer/sample 檔案內容
    1. drawer/,建立 [專案名稱]
    2. 在 [專案名稱] 下,建立 dev 與 pro 資料夾
    3. 在 dev / pro 放入檔案
      • dev -> save as developKey.p12
      • pro -> save as proKey.p12
      • from keychain, output p12 file from Apple Developemnt IOS Push Service: [bundle_id] img
  2. 開啟 cmd,執行 sh main.sh
  3. 選擇 (1) : Create 'PEM'
    1. 輸入專案名稱
    2. 輸入 dev 或 pro

How to TEST the created PEM

  1. sh main.sh
  2. 選擇 2(dev) or 3(pro)
  3. 若錯誤,則會產生錯誤訊息
    • ex : 憑證錯誤,無法跟伺服器產生交握 => unable to load client certificate private key file or unable to load certificate
    • ex : 將 dev 的憑證,丟給 api.push.apple.com:443 => 錯誤訊息 {"reason":"BadCertificateEnvironment"}
  4. 若正確,則最後只會出現 ?@@DONE

Feature

  1. 根據分類的專案,來進行 pem 憑證的建立
  2. 根據 sandbox pem 的建立後,進行 openssl 的測試連接
  3. 根據 production pem 的建立後,進行 openssl 的測試連接
  4. Test your computer to connect APNS, the channel is working
  5. If you don't know how to create 'APNS certificate', check out!(website)
  6. Troubleshooting Push Notifications(website)
  7. 產生 curl 測試 push 指令

產生憑證指令

method_1

  1. develop.cer : from develop center, download SSL Certificate file from Push Notifications
  2. developKey.p12 : from keychain
openssl x509 -in [develop].cer -inform der -out [cer].pem
openssl pkcs12 -nocerts -out [key].pem -in [developKey].p12
cat [cer].pem [key].pem > [final].pem

method_2

  1. output key : from keychain img

  2. 產生憑證

    openssl pkcs12 -in [developKey].p12 -out [cer].pem -nodes -clcerts
    

apns_cer_build's People

Contributors

jhaoheng avatar

Watchers

 avatar

apns_cer_build's Issues

curl 7.47 check api response

把這個 feature 加入到 main 的功能中

curl -d '{"aps":{"alert":"hi","sound":"default"}}' --cert <憑證>:<密碼> -H "apns-topic: <你的 bundle id>" --http2 https://api.development.push.apple.com/3/device/<你的 token>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.