Example #1
0
        static string FindCodeSigningDevelopmentTeam()
        {
            // Can only run on Mac
            if (!PlatformDetection.IsMac)
            {
                Log.Default.Warning("Finding a development team for signing failed: This operation is only supported on macOS.");
                return(null);
            }

            // Avoid getting SIGSEGV when not running a 64-bit process.
            if (IntPtr.Size != 8)
            {
                Log.Default.Warning("Finding a development team for signing failed: This operation requires running in 64-bit mode ");
                return(null);
            }

            try
            {
                var res = new DevelopmentTeamExtractor().FindAllDevelopmentTeams();
                return(res
                       ?.FirstOrDefault(x =>
                                        x.OrganizationalUnit != null &&
                                        x.OrganizationalUnit.All(char.IsLetterOrDigit))
                       ?.OrganizationalUnit);
            }
            catch (DevelopmentTeamExtractorFailure e)
            {
                Log.Default.Warning("Finding a development team for signing failed: " + e);
                return(null);
            }
        }
Example #2
0
        static string FindCodeSigningDevelopmentTeam()
        {
#if UNIX
            // Avoid getting SIGSEGV when not running a 64-bit process.
            if (IntPtr.Size != 8)
            {
                Log.Default.Warning("Finding a development team for signing failed: This operation requires running in 64-bit mode ");
                return(null);
            }

            try
            {
                var res = new DevelopmentTeamExtractor().FindAllDevelopmentTeams();
                return(res
                       ?.FirstOrDefault(x =>
                                        x.OrganizationalUnit != null &&
                                        x.OrganizationalUnit.All(char.IsLetterOrDigit))
                       ?.OrganizationalUnit);
            }
            catch (DevelopmentTeamExtractorFailure e)
            {
                Log.Default.Warning("Finding a development team for signing failed: " + e);
                return(null);
            }
#else
            return(null);
#endif
        }