Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/extensions/utils.py

Issue 6282067956465664: Issue 399 - Added support for Safari to updateDownloadLinks (Closed)
Patch Set: Addressed comments Created April 30, 2014, 12:21 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/extensions/bin/updateDownloadLinks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/utils.py
===================================================================
--- a/sitescripts/extensions/utils.py
+++ b/sitescripts/extensions/utils.py
@@ -196,3 +196,22 @@
repositoryName = re.sub(r'_repository$', '', key)
if repositoryName:
yield Configuration(config, nightlyConfig, repositoryName, value)
+
+def getSafariCertificateID(keyFile):
+ import M2Crypto
+
+ bio = M2Crypto.BIO.openfile(keyFile)
+ try:
+ while True:
+ try:
+ cert = M2Crypto.X509.load_cert_bio(bio)
+ except M2Crypto.X509.X509Error:
+ raise Exception('No safari developer certificate found in chain')
+
+ subject = cert.get_subject()
+ for entry in subject.get_entries_by_nid(subject.nid['CN']):
+ m = re.match(r'Safari Developer: \((.*?)\)', entry.get_data().as_text())
+ if m:
+ return m.group(1)
+ finally:
+ bio.close()
« no previous file with comments | « sitescripts/extensions/bin/updateDownloadLinks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld