public EnclaveReport(byte[] payload) { Size = payload.Length; int offset = 0; ReportSize = BitConverter.ToUInt32(payload, offset); offset += sizeof(uint); ReportVersion = BitConverter.ToUInt32(payload, offset); offset += sizeof(uint); EnclaveData = payload.Skip(offset).Take(EnclaveDataLength).ToArray(); offset += EnclaveDataLength; Identity = new EnclaveIdentity(payload.Skip(offset).ToArray()); offset += Identity.GetSizeInPayload(); }
// Verifies the enclave policy matches expected policy. private void VerifyEnclavePolicy(EnclaveReportPackage enclaveReportPackage) { EnclaveIdentity identity = enclaveReportPackage.Report.Identity; VerifyEnclavePolicyProperty("OwnerId", identity.OwnerId, ExpectedPolicy.OwnerId); VerifyEnclavePolicyProperty("AuthorId", identity.AuthorId, ExpectedPolicy.AuthorId); VerifyEnclavePolicyProperty("FamilyId", identity.FamilyId, ExpectedPolicy.FamilyId); VerifyEnclavePolicyProperty("ImageId", identity.ImageId, ExpectedPolicy.ImageId); VerifyEnclavePolicyProperty("EnclaveSvn", identity.EnclaveSvn, ExpectedPolicy.EnclaveSvn); VerifyEnclavePolicyProperty("SecureKernelSvn", identity.SecureKernelSvn, ExpectedPolicy.SecureKernelSvn); VerifyEnclavePolicyProperty("PlatformSvn", identity.PlatformSvn, ExpectedPolicy.PlatformSvn); // This is a check that the enclave is running without debug support or not. // if (identity.Flags != ExpectedPolicy.Flags) { throw new InvalidOperationException(SR.VerifyEnclaveDebuggable); } }