dotnet-passbook: Can't get the pass to be signed

Hi, I can’t get the pass to be signed by the certificates and I’m at a loss of what to do next and what I’m doing wrong. Can anyone help point me to a direction please? I have the following code (copied straight from the example provided)

I’ve confirmed that my certificate is valid and contains the private key and I’ve downloaded and tried every apple wwdr certificate.

            PassGenerator generator = new PassGenerator();

            PassGeneratorRequest request = new PassGeneratorRequest();
            request.PassTypeIdentifier = "pass.com.varyan.0exqz";
            request.TeamIdentifier = "RW121242";
            request.SerialNumber = "121212";
            request.Description = "My first pass";
            request.OrganizationName = "0EXQ";
            request.LogoText = "0EXQZ Pass";

            request.BackgroundColor = "#FFFFFF";
            request.LabelColor = "#000000";
            request.ForegroundColor = "#000000";

            var fileName = _env.WebRootPath + "AppleWWDRCA.cer";
            var applecertbytes = await System.IO.File.ReadAllBytesAsync(fileName);
            request.AppleWWDRCACertificate = new X509Certificate2(applecertbytes);

            fileName = _env.WebRootPath + "pass_nocommon.p12";
            var passCertbytes = await System.IO.File.ReadAllBytesAsync(fileName);
            request.PassbookCertificate = new X509Certificate2(passCertbytes, "Test123!@#");

            request.Images.Add(PassbookImage.Icon, System.IO.File.ReadAllBytes(_env.WebRootPath + ("icon.png")));
            request.Images.Add(PassbookImage.Icon2X, System.IO.File.ReadAllBytes(_env.WebRootPath + ("icon@2x.png")));
            request.Images.Add(PassbookImage.Icon3X, System.IO.File.ReadAllBytes(_env.WebRootPath + ("icon@3x.png")));

            request.Style = PassStyle.Generic;
            request.AddPrimaryField(new StandardField("origin", "San Francisco", "SFO"));
            request.AddPrimaryField(new StandardField("destination", "London", "LDN"));

            request.AddSecondaryField(new StandardField("boarding-gate", "Gate", "A55"));

            request.AddAuxiliaryField(new StandardField("seat", "Seat", "G5"));
            request.AddAuxiliaryField(new StandardField("passenger-name", "Passenger", "Thomas Anderson"));
            request.AddBarcode(BarcodeType.PKBarcodeFormatPDF417, "01927847623423234234", "ISO-8859-1", "01927847623423234234");

            byte[] generatedPass = generator.Generate(request);

            Debug.WriteLine(generatedPass);
            
            var contentType = "APPLICATION/octet-stream";
            var rfileName = "vnd.apple.pkpass";
            return File(generatedPass, contentType, rfileName);

It generates a pass but it doesn’t sign it. I get the following validation result. Screen Shot 2022-06-06 at 8 33 16 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

are you kidding, this troubleshooting pales in comparison to how much time you saved us with this awesome nugget package!!! Deeply thankful 😃