我正在为我们的应用程序实现存折,它在 Android 上运行良好,但现在在 iOS 和 Mac OS 上运行良好,可能是由于其签名或认证。
我有 2 个证书文件:
- company.pfx(有效期至 2021 年)
- AppleWWDRCA.cer(最新的)
还有那个 .pfx 文件的密码。
我正在使用 dotnet-passbook .NET MVC Webapi 中的框架,您也可以在存储库 here 中找到我的问题.
我正在使用以下代码生成 de .pkpass 文件:
public static byte[] Generate(Models.PassKey.PassBookTicketData data)
{
// Generator to get the passkey
var generator = new PassGenerator();
string appleCertPath = (HttpContext.Current.Server.MapPath("~/Certificates/AppleWWDRCA.cer"));
string companyCertPath = (HttpContext.Current.Server.MapPath("~/Certificates/company.pfx"));
// Request to send
var request = new PassGeneratorRequest()
{
PassTypeIdentifier = "pass.com.company",
TeamIdentifier = "TEAM",
Certificate = File.ReadAllBytes(companyCertPath),
CertificatePassword = ConfigurationManager.AppSettings["PASSBOOK_PASSWORD"],
AppleWWDRCACertificate = File.ReadAllBytes(appleCertPath),
SerialNumber = Guid.NewGuid().ToString(),
Description = data.Description,
OrganizationName = "some organization",
BackgroundColor = ColorHexToPassBookColor("#00517c"),
ForegroundColor = ColorHexToPassBookColor("#f68700"),
LabelColor = ColorHexToPassBookColor("#ffffff"),
LogoText = "some text",
GroupingIdentifier = data.EventCode
};
// .... images, icons, fields, etc
return generator.Generate(request);
}
它缺少您添加字段、图像、图标的部分,但现在不相关,我创建了一个 Gist 如果需要,请提供完整代码。
我是否需要在发送证书时制作一个新证书才能使其生效?
最佳答案
我是 dotnet-passbook 的开发者,我在 Github 上帮助 Emiliano 解决了这个问题。
问题在于用于签署 list 的 pfx 证书。
此证书不是从 Apple Developer 门户生成的,因此缺少必需的信息。我通过我的验证工具 ( https://pkpassvalidator.azurewebsites.net ) 运行了传递,这让我了解了问题所在。在确定通行证类型标识符和团队标识符值不同后,我进一步调查了证书。
您可以在此处阅读问题的完整历史记录 - https://github.com/tomasmcguinness/dotnet-passbook/issues/69
关于ios - list 签名未验证成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51439685/