Exemplo n.º 1
0
 def _decrypt(self, element):
     if not element.text.strip():
         return
     passes = passphrases()
     try:
         passphrase = passes[element.get("encrypted")]
         try:
             return ssl_decrypt(element.text, passphrase)
         except EVPError:
             # error is raised below
             pass
     except KeyError:
         for passwd in passes.values():
             try:
                 return ssl_decrypt(element.text, passwd)
             except EVPError:
                 pass
     raise EVPError("Failed to decrypt")
Exemplo n.º 2
0
def decrypt(crypted):
    if not have_crypto:
        msg = "Cfg: M2Crypto is not available: %s" % entry.get("name")
        logger.error(msg)
        raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
    for passwd in passphrases().values():
        try:
            return ssl_decrypt(crypted, passwd)
        except EVPError:
            pass
    raise EVPError("Failed to decrypt")
Exemplo n.º 3
0
def decrypt(crypted):
    if not have_crypto:
        msg = "Cfg: M2Crypto is not available: %s" % entry.get("name")
        logger.error(msg)
        raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
    for passwd in passphrases().values():
        try:
            return ssl_decrypt(crypted, passwd)
        except EVPError:
            pass
    raise EVPError("Failed to decrypt")
Exemplo n.º 4
0
 def _decrypt(self, element):
     """ Decrypt a single encrypted properties file element """
     if not element.text.strip():
         return
     passes = get_passphrases(SETUP)
     try:
         passphrase = passes[element.get("encrypted")]
         try:
             return ssl_decrypt(element.text, passphrase,
                                algorithm=get_algorithm(SETUP))
         except EVPError:
             # error is raised below
             pass
     except KeyError:
         # bruteforce_decrypt raises an EVPError with a sensible
         # error message, so we just let it propagate up the stack
         return bruteforce_decrypt(element.text,
                                   passphrases=passes.values(),
                                   algorithm=get_algorithm(SETUP))
     raise EVPError("Failed to decrypt")
Exemplo n.º 5
0
 def _decrypt(self, element):
     """ Decrypt a single encrypted properties file element """
     if not element.text.strip():
         return
     passes = get_passphrases(SETUP)
     try:
         passphrase = passes[element.get("encrypted")]
         try:
             return ssl_decrypt(element.text,
                                passphrase,
                                algorithm=get_algorithm(SETUP))
         except EVPError:
             # error is raised below
             pass
     except KeyError:
         # bruteforce_decrypt raises an EVPError with a sensible
         # error message, so we just let it propagate up the stack
         return bruteforce_decrypt(element.text,
                                   passphrases=passes.values(),
                                   algorithm=get_algorithm(SETUP))
     raise EVPError("Failed to decrypt")