Beispiel #1
0
def get_gpg_keys():
    """
    Returns the GPG keys in the config directory specified by PI_GNUPG_HOME.
    
    :return: A json list of the public GPG keys 
    """
    GPG = GPGImport(current_app.config)
    keys = GPG.get_publickeys()
    g.audit_object.log({"success": True})
    return send_result(keys)
    def test_00_gpg_decrypt(self):
        GPG = GPGImport({"PI_GNUPG_HOME": "tests/testdata/gpg"})
        pubkeys = GPG.get_publickeys()
        self.assertEqual(len(pubkeys), 1)
        self.assertTrue("2F25BAF8645350BB" in pubkeys)

        r = GPG.decrypt(str(HALLO_PAYLOAD))
        self.assertEqual(r, "Hallo\n")

        self.assertRaises(Exception, GPG.decrypt, WRONG_PAYLOAD)
    def test_00_gpg_decrypt(self):
        GPG = GPGImport({"PI_GNUPG_HOME": "tests/testdata/gpg"})
        pubkeys = GPG.get_publickeys()
        self.assertEqual(len(pubkeys), 1)
        self.assertTrue("2F25BAF8645350BB" in pubkeys)

        r = GPG.decrypt(HALLO_PAYLOAD)
        self.assertEqual(r, b"Hallo\n")

        self.assertRaises(Exception, GPG.decrypt, WRONG_PAYLOAD)
Beispiel #4
0
def get_gpg_keys():
    """
    Returns the GPG keys in the config directory specified by PI_GNUPG_HOME.
    
    :return: A json list of the public GPG keys 
    """
    GPG = GPGImport(current_app.config)
    keys = GPG.get_publickeys()
    g.audit_object.log({"success": True})
    return send_result(keys)