batcave: Update retrieve-security-question for python3-gpg
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
parent
59a84365da
commit
ce00260e19
1 changed files with 5 additions and 6 deletions
|
@ -4,7 +4,7 @@
|
||||||
# Author: Patrick Uiterwijk <puiterwijk@fedoraproject.org>
|
# Author: Patrick Uiterwijk <puiterwijk@fedoraproject.org>
|
||||||
#
|
#
|
||||||
# Copyright 2012 Patrick Uiterwijk. All rights reserved.
|
# Copyright 2012 Patrick Uiterwijk. All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
#
|
#
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
import os
|
import os
|
||||||
import getpass
|
import getpass
|
||||||
import sys
|
import sys
|
||||||
import gpgme
|
import gpg.core
|
||||||
from fedora.client import AccountSystem
|
from fedora.client import AccountSystem
|
||||||
from fedora.client import AuthError
|
from fedora.client import AuthError
|
||||||
from fedora.client import ServerError
|
from fedora.client import ServerError
|
||||||
|
@ -98,10 +98,9 @@ if not args.no_answer:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print('Decrypting answer...')
|
print('Decrypting answer...')
|
||||||
cipher = BytesIO(details.security_answer.encode('utf-8'))
|
cipher = BytesIO(details.security_answer.encode('utf-8'))
|
||||||
plain = BytesIO()
|
ctx = gpg.core.Context()
|
||||||
ctx = gpgme.Context()
|
plain = ctx.decrypt(cipher)[0].decode('utf8')
|
||||||
ctx.decrypt(cipher, plain)
|
details.security_answer = plain
|
||||||
details.security_answer = plain.getvalue()
|
|
||||||
|
|
||||||
print('Security question: %(question)s' % {'question': details.security_question})
|
print('Security question: %(question)s' % {'question': details.security_question})
|
||||||
if not args.no_answer:
|
if not args.no_answer:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue