Example #1
0
        public async Task RunAsync()
        {
            // Fetch file
            var enclaveInfo = EnclaveInfo.CreateFromFile(this.fileName);

            // Send to service for attestation
            var maaService      = new MaaService(this.attestDnsName);
            var serviceJwtToken = await maaService.AttestOpenEnclaveAsync(enclaveInfo.GetMaaBody());

            // Dump JWT only?
            if (this.dumpJWTOnly)
            {
                var jwtBody = JoseHelper.ExtractJosePart(serviceJwtToken, 1);
                Console.WriteLine($"{jwtBody.ToString()}");
                Directory.CreateDirectory("./maa-jwt");
                File.WriteAllText($"./maa-jwt/{DateTime.Now.Ticks}.json", jwtBody.ToString());
            }
            else
            {
                // Analyze results
                Logger.WriteBanner("VALIDATING MAA JWT TOKEN - BASICS");
                JwtValidationHelper.ValidateMaaJwt(attestDnsName, serviceJwtToken, this.includeDetails);

                Logger.WriteBanner("VALIDATING MAA JWT TOKEN - MATCHES CLIENT ENCLAVE INFO");
                enclaveInfo.CompareToMaaServiceJwtToken(serviceJwtToken, this.includeDetails);
            }

            Logger.WriteLine("\n\n");
        }
        public async Task RunAsync()
        {
            // Fetch file
            var enclaveInfo = EnclaveInfo.CreateFromFile(this.fileName);

            // Send to service for attestation
            var maaService      = new MaaService(this.attestDnsName);
            var serviceJwtToken = await maaService.AttestOpenEnclaveAsync(enclaveInfo.GetMaaBody());

            // Analyze results
            Logger.WriteBanner("VALIDATING MAA JWT TOKEN - BASICS");
            JwtValidationHelper.ValidateMaaJwt(attestDnsName, serviceJwtToken, this.includeDetails);

            Logger.WriteBanner("VALIDATING MAA JWT TOKEN - MATCHES CLIENT ENCLAVE INFO");
            enclaveInfo.CompareToMaaServiceJwtToken(serviceJwtToken, this.includeDetails);

            Logger.WriteLine("\n\n");
        }