mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Show key fingerprint when signing index
This commit is contained in:
parent
f6b8c6825d
commit
6ae6c23295
1 changed files with 16 additions and 0 deletions
16
update.py
16
update.py
|
|
@ -246,7 +246,18 @@ repoel = doc.createElement("repo")
|
||||||
repoel.setAttribute("name", repo_name)
|
repoel.setAttribute("name", repo_name)
|
||||||
repoel.setAttribute("icon", os.path.basename(repo_icon))
|
repoel.setAttribute("icon", os.path.basename(repo_icon))
|
||||||
repoel.setAttribute("url", repo_url)
|
repoel.setAttribute("url", repo_url)
|
||||||
|
|
||||||
if repo_keyalias != None:
|
if repo_keyalias != None:
|
||||||
|
|
||||||
|
# Generate a certificate fingerprint the same way keytool does it
|
||||||
|
# (but with slightly different formatting)
|
||||||
|
def cert_fingerprint(data):
|
||||||
|
digest = hashlib.sha1(data).digest()
|
||||||
|
ret = []
|
||||||
|
for i in range(4):
|
||||||
|
ret.append(":".join("%02X" % ord(b) for b in digest[i*5:i*5+5]))
|
||||||
|
return " ".join(ret)
|
||||||
|
|
||||||
def extract_pubkey():
|
def extract_pubkey():
|
||||||
p = subprocess.Popen(['keytool', '-exportcert',
|
p = subprocess.Popen(['keytool', '-exportcert',
|
||||||
'-alias', repo_keyalias,
|
'-alias', repo_keyalias,
|
||||||
|
|
@ -257,8 +268,12 @@ if repo_keyalias != None:
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print "ERROR: Failed to get repo pubkey"
|
print "ERROR: Failed to get repo pubkey"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
global repo_pubkey_fingerprint
|
||||||
|
repo_pubkey_fingerprint = cert_fingerprint(cert)
|
||||||
return "".join("%02x" % ord(b) for b in cert)
|
return "".join("%02x" % ord(b) for b in cert)
|
||||||
|
|
||||||
repoel.setAttribute("pubkey", extract_pubkey())
|
repoel.setAttribute("pubkey", extract_pubkey())
|
||||||
|
|
||||||
addElement('description', repo_description, doc, repoel)
|
addElement('description', repo_description, doc, repoel)
|
||||||
root.appendChild(repoel)
|
root.appendChild(repoel)
|
||||||
|
|
||||||
|
|
@ -397,6 +412,7 @@ if repo_keyalias != None:
|
||||||
|
|
||||||
if not options.quiet:
|
if not options.quiet:
|
||||||
print "Creating signed index."
|
print "Creating signed index."
|
||||||
|
print "Key fingerprint:", repo_pubkey_fingerprint
|
||||||
|
|
||||||
#Create a jar of the index...
|
#Create a jar of the index...
|
||||||
p = subprocess.Popen(['jar', 'cf', 'index.jar', 'index.xml'],
|
p = subprocess.Popen(['jar', 'cf', 'index.jar', 'index.xml'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue