Fix subjectAttribute escape parsing

This commit is contained in:
Kabir Oberai
2024-12-31 02:36:45 +05:30
Unverified
parent 2d70d156aa
commit 2713905b61
+2 -2
View File
@@ -44,8 +44,8 @@ public struct Certificate: Codable, Sendable {
private func subjectAttribute(_ attribute: ASN1ObjectIdentifier) throws -> String {
let commonName = raw.subject.lazy.flatMap { $0 }.first { $0.type == attribute }
guard let commonName else { throw Error.invalidCertificate }
return "\(commonName.value)"
guard let commonName, let parsed = String(commonName.value) else { throw Error.invalidCertificate }
return parsed
}
public func developerIdentity() throws -> String {