Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"Unknown problem while verifying signature")
# contains verbose human readable GPG information
gpg_output_stderr = str(gpg_output_stderr, encoding='utf8')
print(gpg_output_stderr)
gpg_output = gpg_output.decode(encoding='UTF-8')
if gpg_output.count('[GNUPG:] GOODSIG'):
pass
elif gpg_output.count('[GNUPG:] BADSIG'):
raise ChangesFileException("Bad signature")
elif gpg_output.count('[GNUPG:] ERRSIG'):
raise ChangesFileException("Error verifying signature")
elif gpg_output.count('[GNUPG:] NODATA'):
raise ChangesFileException("No signature on")
else:
raise ChangesFileException(
"Unknown problem while verifying signature"
)
key = None
for line in gpg_output.split("\n"):
if line.startswith('[GNUPG:] VALIDSIG'):
key = line.split()[2]
return key
# contains verbose human readable GPG information
gpg_output_stderr = str(gpg_output_stderr, encoding='utf8')
print(gpg_output_stderr)
gpg_output = gpg_output.decode(encoding='UTF-8')
if gpg_output.count('[GNUPG:] GOODSIG'):
pass
elif gpg_output.count('[GNUPG:] BADSIG'):
raise ChangesFileException("Bad signature")
elif gpg_output.count('[GNUPG:] ERRSIG'):
raise ChangesFileException("Error verifying signature")
elif gpg_output.count('[GNUPG:] NODATA'):
raise ChangesFileException("No signature on")
else:
raise ChangesFileException(
"Unknown problem while verifying signature"
)
key = None
for line in gpg_output.split("\n"):
if line.startswith('[GNUPG:] VALIDSIG'):
key = line.split()[2]
return key
if pipe.returncode != 0:
raise ChangesFileException(
"Unknown problem while verifying signature")
# contains verbose human readable GPG information
gpg_output_stderr = str(gpg_output_stderr, encoding='utf8')
print(gpg_output_stderr)
gpg_output = gpg_output.decode(encoding='UTF-8')
if gpg_output.count('[GNUPG:] GOODSIG'):
pass
elif gpg_output.count('[GNUPG:] BADSIG'):
raise ChangesFileException("Bad signature")
elif gpg_output.count('[GNUPG:] ERRSIG'):
raise ChangesFileException("Error verifying signature")
elif gpg_output.count('[GNUPG:] NODATA'):
raise ChangesFileException("No signature on")
else:
raise ChangesFileException(
"Unknown problem while verifying signature"
)
key = None
for line in gpg_output.split("\n"):
if line.startswith('[GNUPG:] VALIDSIG'):
key = line.split()[2]
return key
print(gpg_output)
if pipe.returncode != 0:
raise ChangesFileException(
"Unknown problem while verifying signature")
# contains verbose human readable GPG information
gpg_output_stderr = str(gpg_output_stderr, encoding='utf8')
print(gpg_output_stderr)
gpg_output = gpg_output.decode(encoding='UTF-8')
if gpg_output.count('[GNUPG:] GOODSIG'):
pass
elif gpg_output.count('[GNUPG:] BADSIG'):
raise ChangesFileException("Bad signature")
elif gpg_output.count('[GNUPG:] ERRSIG'):
raise ChangesFileException("Error verifying signature")
elif gpg_output.count('[GNUPG:] NODATA'):
raise ChangesFileException("No signature on")
else:
raise ChangesFileException(
"Unknown problem while verifying signature"
)
key = None
for line in gpg_output.split("\n"):
if line.startswith('[GNUPG:] VALIDSIG'):
key = line.split()[2]
return key
if changed_files['name'] == os.path.basename(filename):
break
else:
assert(
"get_files() returns different files than Files: knows?!")
with open(os.path.join(self._directory, filename), "rb") as fc:
while True:
chunk = fc.read(131072)
if not chunk:
break
hash_type.update(chunk)
fc.close()
if not hash_type.hexdigest() == changed_files[field_name]:
raise ChangesFileException(
"Checksum mismatch for file %s: %s != %s" % (
filename,
hash_type.hexdigest(),
changed_files[field_name]
))
else:
logger.debug("%s Checksum for file %s matches",
field_name, filename)
def validate_signature(self, check_signature=True):
"""
Validate the GPG signature of a .changes file.
Throws a :class:`dput.exceptions.ChangesFileException` if there's
an issue with the GPG signature. Returns the GPG key ID.
"""
pipe = subprocess.Popen(
["gpg", "--status-fd", "1", "--verify", "--batch",
self.get_changes_file()],
shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gpg_output, gpg_output_stderr = pipe.communicate()
print(gpg_output)
if pipe.returncode != 0:
raise ChangesFileException(
"Unknown problem while verifying signature")
# contains verbose human readable GPG information
gpg_output_stderr = str(gpg_output_stderr, encoding='utf8')
print(gpg_output_stderr)
gpg_output = gpg_output.decode(encoding='UTF-8')
if gpg_output.count('[GNUPG:] GOODSIG'):
pass
elif gpg_output.count('[GNUPG:] BADSIG'):
raise ChangesFileException("Bad signature")
elif gpg_output.count('[GNUPG:] ERRSIG'):
raise ChangesFileException("Error verifying signature")
elif gpg_output.count('[GNUPG:] NODATA'):
raise ChangesFileException("No signature on")
``string``
*changes* file in a string to parse.
"""
if (filename and string) or (not filename and not string):
raise TypeError
if filename:
self._absfile = os.path.abspath(filename)
self._directory = os.path.dirname(self._absfile)
self._data = deb822.Changes(open(filename, encoding='utf-8'))
self.basename = os.path.basename(filename)
else:
self._data = deb822.Changes(string)
if len(self._data) == 0:
raise ChangesFileException('Changes file could not be parsed.')