Skip to content

Commit

Permalink
Use openssl outside of Linux in local_provisioning_profile_finder.py
Browse files Browse the repository at this point in the history
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
brentleyjones committed Sep 14, 2024
1 parent 00a5576 commit 7c8f180
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
from typing import List, Optional, Tuple

_USE_SECURITY = sys.platform == "darwin"

def _build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
Expand All @@ -31,7 +32,23 @@ def _build_parser() -> argparse.ArgumentParser:


def _profile_contents(profile: str) -> Tuple[str, datetime.datetime, str]:
output = subprocess.check_output(["security", "cms", "-D", "-i", profile])
if _USE_SECURITY:
output = subprocess.check_output(
["security", "cms", "-D", "-i", profile],
)
else:
# We call it this way to silence the "Verification successful" message
# for the non-error case
try:
output = subprocess.run(
["openssl", "smime", "-inform", "der", "-verify", "-noverify", "-in", profile],
check=True,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
).stdout
except subprocess.CalledProcessError as e:
print(e.stderr, file=sys.stderr)
raise e
plist = plistlib.loads(output)
return plist["Name"], plist["UUID"], plist["CreationDate"], plist["TeamIdentifier"][0]

Expand Down

0 comments on commit 7c8f180

Please sign in to comment.