Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added apple mdm push cert support #804

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
16 changes: 9 additions & 7 deletions PushSharp.Apple/ApnsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,17 @@ void CheckIsApnsCertificate ()
if (!issuerName.Contains ("Apple"))
throw new ArgumentOutOfRangeException ("Your Certificate does not appear to be issued by Apple! Please check to ensure you have the correct certificate!");

if (!Regex.IsMatch (commonName, "Apple.*?Push Services")
&& !commonName.Contains ("Website Push ID:"))
throw new ArgumentOutOfRangeException ("Your Certificate is not a valid certificate for connecting to Apple's APNS servers");
if (!commonName.Contains ("com.apple.mgmt.External")) {
if (!Regex.IsMatch (commonName, "Apple.*?Push Services")
&& !commonName.Contains ("Website Push ID:"))
throw new ArgumentOutOfRangeException ("Your Certificate is not a valid certificate for connecting to Apple's APNS servers");

if (commonName.Contains ("Development") && ServerEnvironment != ApnsServerEnvironment.Sandbox)
throw new ArgumentOutOfRangeException ("You are using a certificate created for connecting only to the Sandbox APNS server but have selected a different server environment to connect to.");
if (commonName.Contains ("Development") && ServerEnvironment != ApnsServerEnvironment.Sandbox)
throw new ArgumentOutOfRangeException ("You are using a certificate created for connecting only to the Sandbox APNS server but have selected a different server environment to connect to.");

if (commonName.Contains ("Production") && ServerEnvironment != ApnsServerEnvironment.Production)
throw new ArgumentOutOfRangeException ("You are using a certificate created for connecting only to the Production APNS server but have selected a different server environment to connect to.");
if (commonName.Contains ("Production") && ServerEnvironment != ApnsServerEnvironment.Production)
throw new ArgumentOutOfRangeException ("You are using a certificate created for connecting only to the Production APNS server but have selected a different server environment to connect to.");
}
} else {
throw new ArgumentOutOfRangeException ("You must provide a Certificate to connect to APNS with!");
}
Expand Down