Exemple #1
0
def import_key(filename, gnupgdir):
    '''Given a local filename that contains a gnupg key and the dictionary
    in which the keyring is stored, import key into keyring.'''
    if os.path.isfile(filename):
        try:
            import gpg
            (retval, output) = gpg.import_key(filename, gnupgdir)
            sys.stdout.write("Import of key(s) succeded.\n")
        except gpg.key_import_failure, errmsg:
            raise ImportKeyException, errmsg
Exemple #2
0
def import_key(filename, gnupgdir):
    """Given a local filename that contains a gnupg key and the dictionary
    in which the keyring is stored, import key into keyring."""
    if os.path.isfile(filename):
        try:
            import gpg

            (retval, output) = gpg.import_key(filename, gnupgdir)
            sys.stdout.write("Import of key(s) succeded.\n")
        except gpg.key_import_failure, errmsg:
            raise ImportKeyException, errmsg
Exemple #3
0
 def post(self):
     if 'pubkey' not in self.request.files:
         # Invalid POST
         self.write(INVALID)
         return
     data = self.request.files['pubkey'][0]
     body = data['body'].strip()
     if len(body) > 1024 * 128:
         self.write("Data too large, limit: 128 KiB")
         return
     err = gpg.import_key(body)
     if err:
         self.write("GPG failed to import the data")
         return
     self.redirect('/')