improved key retrieval for sending keys
This commit is contained in:
parent
59684e0a3a
commit
af328b8177
@ -20,7 +20,9 @@ user_name = ''.join(random.choice(string.ascii_uppercase) for _ in range(10))
|
|||||||
email = ''.join(random.choice(string.ascii_uppercase) for _ in range(10)) + "@"\
|
email = ''.join(random.choice(string.ascii_uppercase) for _ in range(10)) + "@"\
|
||||||
+ ''.join(random.choice(string.ascii_uppercase) for _ in range(5)) + domain
|
+ ''.join(random.choice(string.ascii_uppercase) for _ in range(5)) + domain
|
||||||
passphrase = ''.join(random.choice(string.ascii_uppercase) for _ in range(5))
|
passphrase = ''.join(random.choice(string.ascii_uppercase) for _ in range(5))
|
||||||
key_server = "eu.pool.sks-keyservers.net" #any key server is good as it will propogate world wide
|
|
||||||
|
#any key server is good as it will propogate world wide
|
||||||
|
key_server = "eu.pool.sks-keyservers.net"
|
||||||
|
|
||||||
#unattended key generation
|
#unattended key generation
|
||||||
p = subprocess.Popen('gpg2 --batch --pinentry-mode=loopback --passphrase ' + passphrase +\
|
p = subprocess.Popen('gpg2 --batch --pinentry-mode=loopback --passphrase ' + passphrase +\
|
||||||
@ -29,10 +31,10 @@ p = subprocess.Popen('gpg2 --batch --pinentry-mode=loopback --passphrase ' + pas
|
|||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
|
|
||||||
#get pub key
|
#get pub key
|
||||||
p = subprocess.Popen('gpg2 --list-key ' + email, shell=True, stdout=subprocess.PIPE)
|
p = subprocess.Popen('gpg2 --list-key --with-colons ' + email, shell=True, stdout=subprocess.PIPE)
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
|
# parse out the key id so we can use it to send keys to the key servers
|
||||||
key = out.split()[6] # parse out the key so we can use to send keys to the key servers
|
key = key = [x.replace(':', '').replace('fpr', '') for x in out.split() if "fpr" in x][0]
|
||||||
|
|
||||||
#open file in binary and break it up into 1305byte chunks
|
#open file in binary and break it up into 1305byte chunks
|
||||||
chunk_list = []
|
chunk_list = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user