---
title: "net发送apns解决方案（iphone push）"
author: "notejs"
date: "2014-04-15T16:13:44Z"
tags: []
categories: ["互联网"]
slug: "net-apns-iphone-push"
draft: false
lastmod: "2014-03-31T20:00:18Z"
id: 2039003
url: "https://notejs.iteye.com/blog/2039003"
---

# [原文链接](http://mojijs.com/2014/03/131361/index.html) [net发送apns解决方案（iphone push）](http://mojijs.com/2014/03/131361/index.html)

[](http://mojijs.com/) 

到现在为止，我们已经生成了3个文件。

1、PushChat.certSigningRequest

2、PushChat.p12

3、aps\_developer\_identity.cer

从客户端得的deviceToken。

发送通知的.net应用程序出来需要知道deviceToken之外，还需要一个与APNS连接的证书。

这个证书可以通过我们前面生成的两个文件中得到。

使用OpenSSL生成.net和APNS通信的证书文件。

1、将aps\_developer\_identity.cer转换成aps\_developer\_identity.pem格式。

`openssl x509 -in aps_developer_identity.cer -inform DER -outaps_developer_identity.pem -outform PEM`

2、将p12格式的私钥转换成pem，需要设置4次密码，这里密码都设置为：abc123。

`openssl pkcs12 -nocerts -out PushChat_Noenc.pem -inPushChat.p12`

3、用certificate和the key创建PKCS#12格式的文件。

`openssl pkcs12 -export -in aps_developer_identity.pem -inkeyPushChat_Noenc.pem -certfile PushChat.certSigningRequest -name"aps_developer_identity" -out aps_developer_identity.p12`

`这样我们就得到了在.net应用程序中使用的证书文件：aps_developer_identity.p12。`

`net的生成证书就是这个样子。其他程序的方式会不一样。`