You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this package from solution targeting .Net core 2.1 with p12 certificate. It is throwing error: Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters'
to type 'Org.BouncyCastle.Crypto.Parameters.ECPrivateKeyParameters'.
It is throwing error from below lines of codes in ApnsClient, since target framework is not NET46 it's going into this, does it have something to do with p12( as it is with RSA signed)?:
#if !NET46 certContent = $"-----BEGIN PRIVATE KEY-----\n{certContent}\n-----END PRIVATE KEY-----"; var ecPrivateKeyParameters = (ECPrivateKeyParameters)new PemReader(new StringReader(certContent)).ReadObject(); // See https://github.com/dotnet/core/issues/2037#issuecomment-436340605 as to why we calculate q ourselves // TL;DR: we don't have Q coords in ecPrivateKeyParameters, only G ones. They won't work.
The text was updated successfully, but these errors were encountered:
Thank you Alex for responding but I really need to get it work. I am passing the certcontent(cert Private key) instead of certpath , will that also won't work? What is the alternative in this case then (how APNS will establish the connection)? Please guide.
var options = new ApnsJwtOptions()
{
BundleId = "com.kisjay.XXXX",
CertContent = @"-----BEGIN PRIVATE KEY-----\r\n\XXXX\r\n-----END PRIVATE KEY-----",
KeyId = "XXXXXXXXXX",
TeamId = "YYYYYYYYYY"
};
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
var push = new ApplePush(ApplePushType.Background)
.AddContentAvailable()
.AddToken("dbcde31aXXXXXXXXXXXXXXXXXXXXXXXX.....d6d");
var response = _apnsService.SendPush(push, options);
It seems that you're trying to use p12 certificate for token-based authorization. This will not work. p12 is used for certificate-based authorization.
For token-based authorization please use p8 certificate. You may follow this manual to get one.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am using this package from solution targeting .Net core 2.1 with p12 certificate. It is throwing error: Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters'
to type 'Org.BouncyCastle.Crypto.Parameters.ECPrivateKeyParameters'.
It is throwing error from below lines of codes in ApnsClient, since target framework is not NET46 it's going into this, does it have something to do with p12( as it is with RSA signed)?:
#if !NET46 certContent = $"-----BEGIN PRIVATE KEY-----\n{certContent}\n-----END PRIVATE KEY-----"; var ecPrivateKeyParameters = (ECPrivateKeyParameters)new PemReader(new StringReader(certContent)).ReadObject(); // See https://github.com/dotnet/core/issues/2037#issuecomment-436340605 as to why we calculate q ourselves // TL;DR: we don't have Q coords in ecPrivateKeyParameters, only G ones. They won't work.
The text was updated successfully, but these errors were encountered: