2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "commons/Buffer.h"
21 typedef CCryptoSession
* (*GET_CRYPTO_SESSION_INTERFACE_FN
)(const std::string
& UUID
, const std::string
& cipherAlgo
, const std::string
& hmacAlgo
);
26 // Interface registration
27 static CCryptoSession
* GetCryptoSession(const std::string
& UUID
, const std::string
& cipherAlgo
, const std::string
& macAlgo
);
28 virtual ~CCryptoSession() = default;
31 virtual XbmcCommons::Buffer
GetKeyRequest(const XbmcCommons::Buffer
& init
, const std::string
& mimeType
, bool offlineKey
, const std::map
<std::string
, std::string
>& parameters
) = 0;
32 virtual std::string
GetPropertyString(const std::string
& name
) = 0;
33 virtual std::string
ProvideKeyResponse(const XbmcCommons::Buffer
& response
) = 0;
34 virtual void RemoveKeys() = 0;
35 virtual void RestoreKeys(const std::string
& keySetId
) = 0;
36 virtual void SetPropertyString(const std::string
& name
, const std::string
& value
) = 0;
39 virtual XbmcCommons::Buffer
Decrypt(const XbmcCommons::Buffer
& cipherKeyId
, const XbmcCommons::Buffer
& input
, const XbmcCommons::Buffer
& iv
) = 0;
40 virtual XbmcCommons::Buffer
Encrypt(const XbmcCommons::Buffer
& cipherKeyId
, const XbmcCommons::Buffer
& input
, const XbmcCommons::Buffer
& iv
) = 0;
41 virtual XbmcCommons::Buffer
Sign(const XbmcCommons::Buffer
& macKeyId
, const XbmcCommons::Buffer
& message
) = 0;
42 virtual bool Verify(const XbmcCommons::Buffer
& macKeyId
, const XbmcCommons::Buffer
& message
, const XbmcCommons::Buffer
& signature
) = 0;
45 static void RegisterInterface(GET_CRYPTO_SESSION_INTERFACE_FN fn
);
48 static std::vector
<GET_CRYPTO_SESSION_INTERFACE_FN
> s_registeredInterfaces
;