阳江seo网站推广,eclipse怎么做网站,上海市工程咨询协会,个人网站的优点设备认证证书也叫 DAC, 相当于每个已经认证的设备的标识。包含了 VID 和 PID. VID: Vendor ID #xff0c;标识厂商 PID: Product ID#xff0c; 标识设备的
根据 Matter 对于设备证书的规定#xff0c;DAC证书subject应该包含VID 和 PID. 可通过解析 X509 证书读取subject…设备认证证书也叫 DAC, 相当于每个已经认证的设备的标识。包含了 VID 和 PID. VID: Vendor ID 标识厂商 PID: Product ID 标识设备的
根据 Matter 对于设备证书的规定DAC证书subject应该包含VID 和 PID. 可通过解析 X509 证书读取subject 来获得信息。 1 通过 SPM 添加X509
git地址https://github.com/apple/swift-certificates.git 苹果开源库。
注意最低支持 iOS13系统。
2 项目实现了 MatterExtension
这个通过 Matter Support 配 Matter 必须实现的。
并从协议中获取设备相关证书。
class RequestHandler: MatterAddDeviceExtensionRequestHandler {let dataShare MatterSupportShare() // 数据共享 扩展和主 APP 共享数据通过 Group 来共享。override func validateDeviceCredential(_ deviceCredential: MatterAddDeviceExtensionRequestHandler.DeviceCredential) async throws {// Use this function to perform additional attestation checks if that is useful for your ecosystem.dataShare.matterDeviceCredentialDAC deviceCredential.deviceAttestationCertificate // 保存DAC 信息 }// 其他...
}3 解析 X509
import X509/// 从dacData中获取 vid 和 pidclass func getX509Info(dacData: Data) - (vid: String?, pid: String?) {let der Array(dacData)guard let cer try? Certificate(derEncoded: der) else {print(不存在 rdns)return (nil,nil)}let subject cer.subjectlet VIDType 1.3.6.1.4.1.37244.2.1let PIDType 1.3.6.1.4.1.37244.2.2var vid: String?var pid: String?for inex1 in subject.startIndex..subject.endIndex {let rdn subject[inex1]for inex2 in rdn.startIndex..rdn.endIndex {let attribute rdn[inex2]print(rdn:\(attribute))let type attribute.type.oidComponents.map { String($0) }.joined(separator: .)let value attribute.value.descriptionif typeVIDType {vid value} else if type PIDType {pid value}}}// 16进制return (vid,pid)}这样在 Matter Support 阶段就能读取设备的 VID 和 PID.
待解决问题
Swift Package Manager 怎么支持低版本项目使用高版本库比如我的项目最低支持 iOS12 但是X509这个库最低支持 iOS13 处理使用源代码还有没有其他解决方案