Skip to content

Commit 139bd5f

Browse files
Use openssl outside of Linux in local_provisioning_profile_finder.py (#2522)
Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent 00a5576 commit 139bd5f

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

tools/local_provisioning_profile_finder/local_provisioning_profile_finder.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
from typing import List, Optional, Tuple
88

9+
_USE_SECURITY = sys.platform == "darwin"
910

1011
def _build_parser() -> argparse.ArgumentParser:
1112
parser = argparse.ArgumentParser()
@@ -31,7 +32,23 @@ def _build_parser() -> argparse.ArgumentParser:
3132

3233

3334
def _profile_contents(profile: str) -> Tuple[str, datetime.datetime, str]:
34-
output = subprocess.check_output(["security", "cms", "-D", "-i", profile])
35+
if _USE_SECURITY:
36+
output = subprocess.check_output(
37+
["security", "cms", "-D", "-i", profile],
38+
)
39+
else:
40+
# We call it this way to silence the "Verification successful" message
41+
# for the non-error case
42+
try:
43+
output = subprocess.run(
44+
["openssl", "smime", "-inform", "der", "-verify", "-noverify", "-in", profile],
45+
check=True,
46+
stderr=subprocess.PIPE,
47+
stdout=subprocess.PIPE,
48+
).stdout
49+
except subprocess.CalledProcessError as e:
50+
print(e.stderr, file=sys.stderr)
51+
raise e
3552
plist = plistlib.loads(output)
3653
return plist["Name"], plist["UUID"], plist["CreationDate"], plist["TeamIdentifier"][0]
3754

0 commit comments

Comments
 (0)