@@ -103,28 +103,34 @@ public struct PassBuilder: Sendable {
103
103
try FileManager . default. createDirectory ( at: dir, withIntermediateDirectories: true )
104
104
defer { try ? FileManager . default. removeItem ( at: dir) }
105
105
106
- try manifest. write ( to: dir. appendingPathComponent ( Self . manifestFileName) )
107
- try self . pemWWDRCertificate. write ( to: dir. appendingPathComponent ( " wwdr.pem " ) , atomically: true , encoding: . utf8)
108
- try self . pemCertificate. write ( to: dir. appendingPathComponent ( " certificate.pem " ) , atomically: true , encoding: . utf8)
109
- try self . pemPrivateKey. write ( to: dir. appendingPathComponent ( " private.pem " ) , atomically: true , encoding: . utf8)
106
+ let manifestURL = dir. appendingPathComponent ( Self . manifestFileName)
107
+ let wwdrURL = dir. appendingPathComponent ( " wwdr.pem " )
108
+ let certificateURL = dir. appendingPathComponent ( " certificate.pem " )
109
+ let privateKeyURL = dir. appendingPathComponent ( " private.pem " )
110
+ let signatureURL = dir. appendingPathComponent ( Self . signatureFileName)
111
+
112
+ try manifest. write ( to: manifestURL)
113
+ try self . pemWWDRCertificate. write ( to: wwdrURL, atomically: true , encoding: . utf8)
114
+ try self . pemCertificate. write ( to: certificateURL, atomically: true , encoding: . utf8)
115
+ try self . pemPrivateKey. write ( to: privateKeyURL, atomically: true , encoding: . utf8)
110
116
111
117
let process = Process ( )
112
118
process. currentDirectoryURL = dir
113
119
process. executableURL = self . openSSLURL
114
120
process. arguments = [
115
121
" smime " , " -binary " , " -sign " ,
116
- " -certfile " , dir . appendingPathComponent ( " wwdr.pem " ) . path,
117
- " -signer " , dir . appendingPathComponent ( " certificate.pem " ) . path,
118
- " -inkey " , dir . appendingPathComponent ( " private.pem " ) . path,
119
- " -in " , dir . appendingPathComponent ( Self . manifestFileName ) . path,
120
- " -out " , dir . appendingPathComponent ( Self . signatureFileName ) . path,
122
+ " -certfile " , wwdrURL . path,
123
+ " -signer " , certificateURL . path,
124
+ " -inkey " , privateKeyURL . path,
125
+ " -in " , manifestURL . path,
126
+ " -out " , signatureURL . path,
121
127
" -outform " , " DER " ,
122
128
" -passin " , " pass: \( pemPrivateKeyPassword) " ,
123
129
]
124
130
try process. run ( )
125
131
process. waitUntilExit ( )
126
132
127
- return try Data ( contentsOf: dir . appendingPathComponent ( Self . signatureFileName ) )
133
+ return try Data ( contentsOf: signatureURL )
128
134
} else {
129
135
let signature = try CMS . sign (
130
136
manifest,
0 commit comments