snnagar / apns-sharp

Automatically exported from code.google.com/p/apns-sharp
0 stars 0 forks source link

System.Security.Cryptography.CryptographicException was unhandled #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, i have a problem this line..

 NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1);

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JdSoft.Apple.Apns.Notifications;

namespace JdSoft.Apple.Apns.Test
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            bool sandbox = true;

            string testDeviceToken = "fe58fc8f527c363d1b775dca133e04bff24dc5032d08836992395cc56bfa62ef";
            string p12File = "HasanCanSaral.p12";
            string p12FilePassword = "ayhan123";
            int count = 3;
            int sleepBetweenNotifications = 15000;

            string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File);

            NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1);   

            service.SendRetries = 5; //5 retries before generating notificationfailed event
            service.ReconnectDelay = 5000; //5 seconds

            service.Error += new NotificationService.OnError(service_Error);
            service.NotificationTooLong += new NotificationService.OnNotificationTooLong(service_NotificationTooLong);

            service.BadDeviceToken += new NotificationService.OnBadDeviceToken(service_BadDeviceToken);
            service.NotificationFailed += new NotificationService.OnNotificationFailed(service_NotificationFailed);
            service.NotificationSuccess += new NotificationService.OnNotificationSuccess(service_NotificationSuccess);
            service.Connecting += new NotificationService.OnConnecting(service_Connecting);
            service.Connected += new NotificationService.OnConnected(service_Connected);
            service.Disconnected += new NotificationService.OnDisconnected(service_Disconnected);

            //The notifications will be sent like this:
            //      Testing: 1...
            //      Testing: 2...
            //      Testing: 3...
            // etc...

******************************Error Detail *****************************

System.Security.Cryptography.CryptographicException was unhandled
  Message=Parametre hatalı.

  Source=mscorlib
  StackTrace:
       konum: System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
       konum: System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
       konum: System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags)
       konum: System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
       konum: JdSoft.Apple.Apns.Notifications.NotificationConnection.start(String p12File, String p12FilePassword) C:\Users\Pc\Desktop\Apns-Sharp-1.0.3.0\apns-sharp\JdSoft.Apple.Apns.Notifications\NotificationConnection.cs içinde: satır 343
       konum: JdSoft.Apple.Apns.Notifications.NotificationConnection..ctor(String host, Int32 port, String p12File, String p12FilePassword) C:\Users\Pc\Desktop\Apns-Sharp-1.0.3.0\apns-sharp\JdSoft.Apple.Apns.Notifications\NotificationConnection.cs içinde: satır 160
       konum: JdSoft.Apple.Apns.Notifications.NotificationService.set_Connections(Int32 value) C:\Users\Pc\Desktop\Apns-Sharp-1.0.3.0\apns-sharp\JdSoft.Apple.Apns.Notifications\NotificationService.cs içinde: satır 238
       konum: JdSoft.Apple.Apns.Notifications.NotificationService..ctor(Boolean sandbox, String p12File, String p12FilePassword, Int32 connections) C:\Users\Pc\Desktop\Apns-Sharp-1.0.3.0\apns-sharp\JdSoft.Apple.Apns.Notifications\NotificationService.cs içinde: satır 133
       konum: JdSoft.Apple.Apns.Test.Program.Main(String[] args) C:\Users\Pc\Desktop\Apns-Sharp-1.0.3.0\apns-sharp\JdSoft.Apple.Apns.Notifications.Test\Program.cs içinde: satır 24
       konum: System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       konum: System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       konum: Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       konum: System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       konum: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       konum: System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Original issue reported on code.google.com by tusub...@gmail.com on 23 Nov 2011 at 12:31

Attachments: