コード例 #1
0
ファイル: manager.py プロジェクト: cfiehe/barbican
    def get_plugin_store_generate(self,
                                  type_needed,
                                  algorithm=None,
                                  bit_length=None,
                                  mode=None,
                                  project_id=None):
        """Gets a secret store or generate plugin that supports provided type.

        :param type_needed: PluginSupportTypes that contains details on the
        type of plugin required
        :returns: CryptoPluginBase plugin implementation
        """
        active_plugins = multiple_backends.get_applicable_crypto_plugins(
            self, project_id=project_id, existing_plugin_name=None)

        if not active_plugins:
            raise crypto.CryptoPluginNotFound()

        for generating_plugin in active_plugins:
            if generating_plugin.supports(type_needed, algorithm, bit_length,
                                          mode):
                break
        else:
            raise secret_store.SecretStorePluginNotFound()

        return generating_plugin
コード例 #2
0
ファイル: manager.py プロジェクト: nuxxer/barbican
    def get_plugin_retrieve(self, plugin_name_for_store):
        """Gets a secret retrieve plugin that supports the provided type.

        :param type_needed: PluginSupportTypes that contains details on the
        type of plugin required
        :returns: CryptoPluginBase plugin implementation
        """
        active_plugins = plugin_utils.get_active_plugins(self)

        if not active_plugins:
            raise crypto.CryptoPluginNotFound()

        for decrypting_plugin in active_plugins:
            plugin_name = utils.generate_fullname_for(decrypting_plugin)
            if plugin_name == plugin_name_for_store:
                break
        else:
            raise secret_store.SecretStorePluginNotFound()

        return decrypting_plugin
コード例 #3
0
    def get_plugin_retrieve(self, plugin_name_for_store):
        """Gets a secret retrieve plugin that supports the provided type.

        :param type_needed: PluginSupportTypes that contains details on the
        type of plugin required
        :returns: CryptoPluginBase plugin implementation
        """

        if len(self.extensions) < 1:
            raise crypto.CryptoPluginNotFound()

        for ext in self.extensions:
            decrypting_plugin = ext.obj
            plugin_name = utils.generate_fullname_for(decrypting_plugin)
            if plugin_name == plugin_name_for_store:
                break
        else:
            raise secret_store.SecretStorePluginNotFound()

        return decrypting_plugin
コード例 #4
0
    def get_plugin_store_generate(self,
                                  type_needed,
                                  algorithm=None,
                                  bit_length=None,
                                  mode=None):
        """Gets a secret store or generate plugin that supports provided type.

        :param type_needed: PluginSupportTypes that contains details on the
        type of plugin required
        :returns: CryptoPluginBase plugin implementation
        """

        if len(self.extensions) < 1:
            raise crypto.CryptoPluginNotFound()

        for ext in self.extensions:
            if ext.obj.supports(type_needed, algorithm, bit_length, mode):
                plugin = ext.obj
                break
        else:
            raise secret_store.SecretStorePluginNotFound()

        return plugin
コード例 #5
0
ファイル: manager.py プロジェクト: tzatti/barbican
    def get_plugin_store_generate(self,
                                  type_needed,
                                  algorithm=None,
                                  bit_length=None,
                                  mode=None):
        """Gets a secret store or generate plugin that supports provided type.

        :param type_needed: PluginSupportTypes that contains details on the
        type of plugin required
        :returns: CryptoPluginBase plugin implementation
        """
        active_plugins = plugin_utils.get_active_plugins(self)

        if len(active_plugins) < 1:
            raise crypto.CryptoPluginNotFound()

        for generating_plugin in active_plugins:
            if generating_plugin.supports(type_needed, algorithm, bit_length,
                                          mode):
                break
        else:
            raise secret_store.SecretStorePluginNotFound()

        return generating_plugin