小工具 创建随机android签名文件若干
import os
import string
import random
def randomStr():
data = string.ascii_letters+string.digits
random_length = 6
random_string = ''.join(random.sample(data, random_length))
return random_string
def creatJKS():
certAlias = randomStr()
certAlg = 'RSA'
certSigAlg = 'SHA1withRSA'
certExp = '36500'
certKeySize = '2048'
certKeyType = 'JKS'
certKeyPass = randomStr()
fileName = randomStr()
dname = 'CN='+certAlias
certFile = fileName + '.' + 'jks'
keytool = 'keytool -genkey -noprompt \
-alias ' + certAlias + ' \
-keypass ' + certKeyPass + ' \
-keyalg ' + certAlg + ' \
-sigalg ' + certSigAlg + '\
-validity ' + certExp + ' \
-dname ' + dname + ' \
-keysize ' + certKeySize + ' \
-keystore ' + certFile + ' \
-storepass '+ certKeyPass +' \
-storetype ' + certKeyType
lineStr = 'certFile = '+certFile +' '+'certAlias = ' + certAlias + ' ' +'certKeyPass = '+certKeyPass +'\n'
print(lineStr)
os.system(keytool)
return lineStr
file = open('sign.txt','w')
for index in range(0,30):
lineStr = creatJKS()
file.write(lineStr)
file.flush()
file.close()