mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
break out jar signing into function so it can be reused
The new index format will also need to use jar signing
This commit is contained in:
parent
3afd6ca684
commit
b3a5db52f7
1 changed files with 24 additions and 12 deletions
|
|
@ -1330,18 +1330,7 @@ def make_index(apps, sortedids, apks, repodir, archive):
|
||||||
if os.path.exists(signed):
|
if os.path.exists(signed):
|
||||||
os.remove(signed)
|
os.remove(signed)
|
||||||
else:
|
else:
|
||||||
args = [config['jarsigner'], '-keystore', config['keystore'],
|
signjar(signed)
|
||||||
'-storepass:file', config['keystorepassfile'],
|
|
||||||
'-digestalg', 'SHA1', '-sigalg', 'SHA1withRSA',
|
|
||||||
signed, config['repo_keyalias']]
|
|
||||||
if config['keystore'] == 'NONE':
|
|
||||||
args += config['smartcardoptions']
|
|
||||||
else: # smardcards never use -keypass
|
|
||||||
args += ['-keypass:file', config['keypassfile']]
|
|
||||||
p = FDroidPopen(args)
|
|
||||||
if p.returncode != 0:
|
|
||||||
logging.critical("Failed to sign index")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Copy the repo icon into the repo directory...
|
# Copy the repo icon into the repo directory...
|
||||||
icon_dir = os.path.join(repodir, 'icons')
|
icon_dir = os.path.join(repodir, 'icons')
|
||||||
|
|
@ -1349,6 +1338,29 @@ def make_index(apps, sortedids, apks, repodir, archive):
|
||||||
shutil.copyfile(config['repo_icon'], iconfilename)
|
shutil.copyfile(config['repo_icon'], iconfilename)
|
||||||
|
|
||||||
|
|
||||||
|
def signjar(jar):
|
||||||
|
'''
|
||||||
|
sign a JAR file with Java's jarsigner.
|
||||||
|
|
||||||
|
This does use old hashing algorithms, i.e. SHA1, but that's not
|
||||||
|
broken yet for file verification. This could be set to SHA256,
|
||||||
|
but then Android < 4.3 would not be able to verify it.
|
||||||
|
https://code.google.com/p/android/issues/detail?id=38321
|
||||||
|
'''
|
||||||
|
args = [config['jarsigner'], '-keystore', config['keystore'],
|
||||||
|
'-storepass:file', config['keystorepassfile'],
|
||||||
|
'-digestalg', 'SHA1', '-sigalg', 'SHA1withRSA',
|
||||||
|
jar, config['repo_keyalias']]
|
||||||
|
if config['keystore'] == 'NONE':
|
||||||
|
args += config['smartcardoptions']
|
||||||
|
else: # smardcards never use -keypass
|
||||||
|
args += ['-keypass:file', config['keypassfile']]
|
||||||
|
p = FDroidPopen(args)
|
||||||
|
if p.returncode != 0:
|
||||||
|
logging.critical("Failed to sign index")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def make_categories_txt(repodir, categories):
|
def make_categories_txt(repodir, categories):
|
||||||
'''Write a category list in the repo to allow quick access'''
|
'''Write a category list in the repo to allow quick access'''
|
||||||
catdata = ''
|
catdata = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue