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
Unsupported algorithm #25
Comments
What sort of certificate are you using? Does it include the private key?
|
Thanks for the reply. I am using the .cer certificate downloaded from the Apple Developer portal. I tried both using the certificate generated with my Mac and the one generated with Windows, following the guide you provided on your blog. Unfortunately, neither seems to work. The certificate on my Mac is tested using Apple's signpass command line tool and works problem free there. Edit: I checked my certificate, it does not say that it has a private key. How do I obtain this? |
When you generate the certificate on a Mac, you need to export both the cert and key components. You do this by expanding the certificate row. You much then select both the cert and key, before choosing Export. It should read "Export 2 items" You can then generate a p12 file. This will include both parts of the key. If you've followed my guide about Windows certificates, you should end up with a PFX file containing both parts of the certificate. When performing the export it's important you choose to include the private key and to make the private key exportable. If you don't end up with a p12 or a pfx file, it won't include the private key. |
That's the problem! Don't know what happened the last time, but I re-did the certificate process, and now it works. However, the same line of code still gives me an error message: "Object reference not set to an instance of an object". I wrapped the line of code in "if (request != null && generator != null)" to be sure that the request or generator actually is not null, but the code is still executed with the same error message. |
There is something missing then within the generation method. If you've generated a new certificate, did you make sure you updated the thumbprint value? |
Yes, I checked the thumbprint value, I also checked that the new certificate in certmgr had the "This certificate has a private key ...". Do you have a list of everything that needs to be included in order for a proper pass to be generated? (for instance if some text fields are required, how many images and so on). Right now I have only included the Icon and IconRetina, but not thumbnail and other images. Are they required? |
No, the only image you need is the icon. From your sample above, did you replace the "TeamIdentifier"? |
Yep, the TeamIdentifier is replaced by a ten character string of numbers and letters. Is it possible to see exactly what it is expecting that is null? |
The easiest way is to connect it to a Mac and view the console for the phone. If you don't have a Mac, send me your PKPass file and I'll have a look. |
Thanks for all the support. However, since this error message is occurring when I try to generate the pass I never get to the point where I have a pass to investigate ... |
Ah, of course. There is nothing considered mandatory in the generator as it doesn't validate the request. Have you tried to debug it?
|
After a little bit of help from a more experienced Visual Studio user, I managed to find this: 'generator.Generate(request)' threw an exception of type 'Passbook.Generator.Exceptions.ManifestSigningException' byte[] Looks like something is still wrong with the signing process. Any idea what this can be caused by? Edit: Based on the Tracing in VS, it looks like the problem occurs when getting the Apple public certificate. That one should just be to add to the Windows Certificate store, right? |
Yes, you should be able to see where it's loading the Apple certificates and either load using the Thumbprint or load directly from the disk |
Loaded directly from disk, now it works! Thank you for all the help and support :-) |
Great. If you need any more help, please ask. |
Hi, I am able to generate a .pkpass file using C# code (thanks to the tutorials available). The pass which I generated works correct on Android device(installed an application Pass2U Wallet to open the pass) and MAC OS (through mail). But, the same pass does not open on an iOS device. Kindly help me. I have also attached the generated pkpass file for reference. Regards, |
The best thing to do is look at the log files produced by your device when you try to open the pass. Once you have the error message, please open a new issue and I'll review it. T |
Thank you. I opened a new issue for the same. "Unable to open pkpass on an iOS device #41" |
Hi Tomas |
Hi @tomasmcguinness I want to set 2 fields in a row and 3 rows with 2 fields and one last row with 3 fields. Below is my code snippet but it seems all fields are generating in one line. Please help me. PassGenerator generator = new PassGenerator();
PassGeneratorRequest request = new PassGeneratorRequest();
request.PassTypeIdentifier = "xxxxxxxxxxxxxxxx";
request.TeamIdentifier = "xxxxxxxxxxxxxxxxxxxx";
request.SerialNumber = Guid.NewGuid().ToString("N"); ;
request.Description = "My test pass";
request.OrganizationName = "Test";
request.LogoText = "My Logo Text";
request.BackgroundColor = "#19342f";
request.LabelColor = "#19342f";
request.ForegroundColor = "#FFFFFF";
request.AppleWWDRCACertificate = new X509Certificate2(Server.MapPath("~/Certificate/xxxxxxxxxxxx.cer"));
request.PassbookCertificate = new X509Certificate2(Server.MapPath("~/Certificate/xxxxxx.pfx"), "xxxxxxxx");
request.Images.Add(PassbookImage.Icon, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon.png")));
request.Images.Add(PassbookImage.Icon2X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon@2x.png")));
request.Images.Add(PassbookImage.Icon3X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/icon@2x.png")));
request.Images.Add(PassbookImage.Logo, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo.png")));
request.Images.Add(PassbookImage.Logo2X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo@2x.png")));
request.Images.Add(PassbookImage.Logo3X, System.IO.File.ReadAllBytes(Server.MapPath("~/Icons/logo@2x.png")));
request.Style = PassStyle.Generic;
request.AddPrimaryField(new StandardField("PharmacyName", "1991 Mountain Boulevard Oakland, Ca", "Walmart Pharmacy","TestAttr",DataDetectorTypes.PKDataDetectorTypeAddress));
request.AddSecondaryField(new StandardField("first", "First", "Test1"));
request.AddSecondaryField(new StandardField("second", "Second", "Test11"));
request.AddSecondaryField(new StandardField("third", "Third", "Test111"));
request.AddSecondaryField(new StandardField
{
Key = "field3",
Label = "Field 3",
Value = "Value 3",
});
request.AddSecondaryField(new StandardField
{
Key = "field32",
Label = "Field2",
Value = "Value 2",
});
request.LogoText = "Prescription Discount card";
byte[] generatedPass = generator.Generate(request);
return File(generatedPass, "application/vnd.apple.pkpass", request.SerialNumber+".pkpass");
```
Your small help will make my day
|
I have tried to implement this library and have used the following code (replacing "identifier", "thumbprint" and so on with my actual data):
When the last line of code is executed I get an ArgumentException saying "Unsupported algorithm specified". Any ida what I am doing wrong and how to fix it? The exception occurs in BountyCastle.Crypto.dll
The text was updated successfully, but these errors were encountered: