AppAttest -- Can a Swift program that uses DCAppAttestService be run on Linux?
I need to be able to run the code that issues an Apple attest but preferably Linux. Or, at the very least, on an MacOS VPS.
I expect there to be new customers daily, therefore this code will be run regularly, for each new client. As such, using an Apple physical device for this, if indeed required, will inconvenient:
import DCAppAttest
func generateKeyAndAttestation() {
guard let attestationKey = DCAppAttestService.shared.generateKey() else {
print("Error generating attestation key.")
return
}
// Generate a nonce (you may need to use a more secure source for your actual use case)
let nonce = Data.random(count: 32)
// Prepare the data to be attested
let dataToAttest = "Data to be attested".data(using: .utf8)!
// Concatenate nonce and data
var attestationData = nonce
attestationData.append(dataToAttest)
// Use DCAppAttestService to attest the data
guard let attestation = DCAppAttestService.shared.attestData(attestationData, withKey: attestationKey) else {
print("Error generating attestation.")
return
}
// Print or use the attestation key and the resulting attestation
print("Attestation Key: \(attestationKey)")
print("Attestation: \(attestation)")
}
I haven't found a clear answer as to whether or not DCAppAttestService
can be run only on MacOS/iOS or any other Apple OS?
And whether or not it has to be a physical Apple device or will any VPS running one of the latest OSX do too?
I'm aware that validation, verification of attest-s can, indeed, be run on Linux. This will the 2nd step. My question, however, about the code that issues, generates attest-s initially -- the 1st step.
https://developer.apple.com/documentation/devicecheck/dcappattestservice
Comments
Post a Comment