${KEY_MANAGER_PATH}/service/key-provider.cpp
${KEY_MANAGER_PATH}/service/ocsp.cpp
${KEY_MANAGER_PATH}/service/crypto-logic.cpp
- ${KEY_MANAGER_PATH}/service/CryptoService.cpp
${KEY_MANAGER_PATH}/service/file-system.cpp
${KEY_MANAGER_PATH}/service/db-crypto.cpp
${KEY_MANAGER_PATH}/service/ocsp-service.cpp
${KEY_MANAGER_PATH}/dpl/db/src/sql_connection.cpp
${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
${KEY_MANAGER_PATH}/sqlcipher/sqlcipher.c
+ ${KEY_MANAGER_PATH}/crypto/sw-backend/key.cpp
+ ${KEY_MANAGER_PATH}/crypto/sw-backend/store.cpp
+ ${KEY_MANAGER_PATH}/crypto/sw-backend/crypto-service.cpp
+ ${KEY_MANAGER_PATH}/crypto/platform/decider.cpp
)
# -fPIE and -pie flag is added for ASLR
${KEY_MANAGER_PATH}/dpl/core/include
${KEY_MANAGER_PATH}/dpl/log/include
${KEY_MANAGER_PATH}/dpl/db/include
+ ${KEY_MANAGER_PATH}/crypto
)
ADD_EXECUTABLE(${TARGET_KEY_MANAGER} ${KEY_MANAGER_SOURCES})
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file exception.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+
+#include <dpl/exception.h>
+
+namespace CKM {
+namespace Crypto {
+namespace Exception {
+
+DECLARE_EXCEPTION_TYPE(CKM::Exception, Base)
+DECLARE_EXCEPTION_TYPE(Base, InternalError)
+DECLARE_EXCEPTION_TYPE(Base, KeyNotSupported)
+DECLARE_EXCEPTION_TYPE(Base, OperationNotSupported)
+DECLARE_EXCEPTION_TYPE(Base, WrongBackend)
+
+} // namespace Exception
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file gkey.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+#include <memory>
+
+#include <ckm/ckm-raw-buffer.h>
+#include <ckm/ckm-type.h>
+
+#include <generic-backend/exception.h>
+
+namespace CKM {
+namespace Crypto {
+
+class GKey {
+protected:
+ GKey(){}
+public:
+ virtual RawBuffer getBinary() {
+ Throw(Exception::OperationNotSupported);
+ }
+
+ virtual RawBuffer encrypt(const CryptoAlgorithm &, const RawBuffer &) {
+ Throw(Exception::OperationNotSupported);
+ }
+
+ virtual RawBuffer decrypt(const CryptoAlgorithm &, const RawBuffer &) {
+ Throw(Exception::OperationNotSupported);
+ }
+
+ virtual RawBuffer sign(const CryptoAlgorithm &, const RawBuffer &) {
+ Throw(Exception::OperationNotSupported);
+ }
+
+ virtual bool verify(const CryptoAlgorithm &, const RawBuffer &, const RawBuffer &) {
+ Throw(Exception::OperationNotSupported);
+ }
+
+ virtual ~GKey () {}
+};
+
+typedef std::shared_ptr<GKey> GKeyShPtr;
+
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file gstore.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+
+#include <memory>
+
+#include <generic-backend/exception.h>
+#include <generic-backend/gkey.h>
+#include <generic-backend/id.h>
+#include <generic-backend/token.h>
+#include <ckm/ckm-type.h>
+
+namespace CKM {
+namespace Crypto {
+
+class GStore {
+protected:
+ GStore(){}
+public:
+ virtual Id getBackendId() const { Throw(Exception::OperationNotSupported); }
+ virtual GKeyShPtr getKey(const Token &) { Throw(Exception::OperationNotSupported); }
+ virtual TokenPair generateAKey(const CryptoAlgorithm &) { Throw(Exception::OperationNotSupported); }
+ virtual Token generateSKey(const CryptoAlgorithm &) { Throw(Exception::OperationNotSupported); }
+ virtual Token import(KeyType, const RawBuffer &) { Throw(Exception::OperationNotSupported); }
+ virtual void destroy(const Token &) { Throw(Exception::OperationNotSupported); }
+ virtual ~GStore() {}
+};
+
+typedef std::shared_ptr<GStore> GStoreShPtr;
+
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file id.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+
+namespace CKM {
+namespace Crypto {
+
+enum class Id {
+ OpenSSL = 0,
+ TrustZone = 1
+};
+
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file gstore.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+
+#include <utility>
+
+#include <ckm/ckm-raw-buffer.h>
+#include <ckm/ckm-type.h>
+
+#include <generic-backend/id.h>
+
+namespace CKM {
+namespace Crypto {
+
+struct Token {
+ RawBuffer buffer;
+ Id backendId;
+ KeyType keyType;
+};
+
+typedef std::pair<Token,Token> TokenPair;
+
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+#include <platform/decider.h>
+
+#include <sw-backend/store.h>
+
+namespace CKM {
+namespace Crypto {
+
+Decider::Decider()
+ : m_store(new SW::Store)
+{}
+
+GStoreShPtr Decider::getStore(const Token &) {
+ // This the place where we should choose backend bases on token information.
+ return m_store;
+};
+
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+#pragma once
+
+#include <memory>
+
+#include <generic-backend/gstore.h>
+#include <generic-backend/token.h>
+
+namespace CKM {
+namespace Crypto {
+
+class Decider {
+public:
+ Decider();
+ GStoreShPtr getStore(const Token &token);
+ virtual ~Decider(){}
+private:
+ GStoreShPtr m_store;
+};
+
+} // Crypto
+} // CKM
+
#include <ckm/ckm-error.h>
#include <ckm/ckm-type.h>
#include <key-impl.h>
-#include <CryptoService.h>
+#include <sw-backend/crypto-service.h>
#include <assert.h>
#include <dpl/log/log.h>
#define OPENSSL_FAIL 0 // DO NOTCHANGE THIS VALUE
namespace CKM {
+namespace Crypto {
+namespace SW {
CryptoService::CryptoService(){
}
return ret;
}
-}
+
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
#define NOT_DEFINED -1
namespace CKM {
+namespace Crypto {
+namespace SW {
// typedef std::vector<unsigned char> RawData; this must be defined in common header.
// This is internal api so all functions should throw exception on errors.
const EVP_MD *md_algo,
const int rsa_padding);
};
-}
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
*/
#pragma once
-#include <dpl/log/log.h>
+#include <vector>
#include <openssl/evp.h>
-#include <vector>
-#include <dpl/exception.h>
+#include <dpl/log/log.h>
#include <dpl/raw-buffer.h>
+#include <generic-backend/exception.h>
+
// TODO move it to static const int
#define AES_GCM_TAG_SIZE 16
namespace CKM {
-
namespace Crypto {
-
-class Exception
-{
-public:
- DECLARE_EXCEPTION_TYPE(CKM::Exception, Base)
- DECLARE_EXCEPTION_TYPE(Base, InternalError)
-};
-
+namespace SW {
namespace Cipher {
template<class T>
#undef DEFINE_CIPHER
} // namespace Cipher
+} // namespace SW
} // namespace Crypto
} // namespace CKM
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file key.cpp
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#include <memory>
+
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+
+#include <dpl/log/log.h>
+
+#include <generic-backend/exception.h>
+#include <sw-backend/key.h>
+
+#define EVP_SUCCESS 1 // DO NOTCHANGE THIS VALUE
+#define EVP_FAIL 0 // DO NOTCHANGE THIS VALUE
+
+namespace CKM {
+namespace Crypto {
+namespace SW {
+
+typedef std::unique_ptr<BIO, std::function<void(BIO*)>> BioUniquePtr;
+
+RawBuffer AKey::sign(
+ const CryptoAlgorithm &alg,
+ const RawBuffer &message)
+{
+ (void) alg;
+ (void) message;
+
+ auto key = getEvpShPtr();
+ return RawBuffer();
+}
+
+bool AKey::verify(const CryptoAlgorithm &alg, const RawBuffer &message, const RawBuffer &sign) {
+ (void) alg;
+ (void) message;
+ (void) sign;
+
+ auto key = getEvpShPtr();
+ return false;
+}
+
+EvpShPtr AKey::getEvpShPtr() {
+ if (m_evp)
+ return m_evp;
+
+ EVP_PKEY *pkey = NULL;
+ BioUniquePtr bio(BIO_new(BIO_s_mem()), BIO_free_all);
+
+ LogDebug("Start to parse key:");
+
+ if (!pkey) {
+ (void)BIO_reset(bio.get());
+ BIO_write(bio.get(), m_key.data(), m_key.size());
+ pkey = d2i_PrivateKey_bio(bio.get(), NULL);
+ LogDebug("Trying d2i_PrivateKey_bio Status: " << (void*)pkey);
+ }
+
+ if (!pkey) {
+ (void)BIO_reset(bio.get());
+ BIO_write(bio.get(), m_key.data(), m_key.size());
+ pkey = d2i_PUBKEY_bio(bio.get(), NULL);
+ LogDebug("Trying d2i_PUBKEY_bio Status: " << (void*)pkey);
+ }
+
+ if (!pkey) {
+ LogError("Failed to parse key");
+ ThrowMsg(Exception::InternalError, "Failed to parse key");
+ }
+
+ m_evp.reset(pkey, EVP_PKEY_free);
+ return m_evp;
+}
+
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file key.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+#include <memory>
+
+#include <openssl/evp.h>
+
+#include <generic-backend/gkey.h>
+
+namespace CKM {
+namespace Crypto {
+namespace SW {
+
+typedef std::unique_ptr<EVP_PKEY_CTX,std::function<void(EVP_PKEY_CTX*)>> ContextUPtr;
+typedef std::shared_ptr<EVP_PKEY> EvpShPtr;
+
+class SKey : public GKey {
+public:
+ SKey(RawBuffer buffer, KeyType keyType)
+ : m_key(std::move(buffer))
+ , m_type(keyType)
+ {}
+protected:
+ RawBuffer m_key;
+ KeyType m_type;
+};
+
+class AKey : public GKey {
+public:
+ AKey(RawBuffer buffer, KeyType keyType)
+ : m_key(std::move(buffer))
+ , m_type(keyType)
+ {}
+ virtual RawBuffer sign(const CryptoAlgorithm &alg, const RawBuffer &message);
+ virtual bool verify(const CryptoAlgorithm &alg, const RawBuffer &message, const RawBuffer &sign);
+ virtual ~AKey(){}
+protected:
+ virtual EvpShPtr getEvpShPtr();
+
+ EvpShPtr m_evp;
+ RawBuffer m_key;
+ KeyType m_type;
+};
+
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file store.cpp
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#include <memory>
+
+#include <dpl/log/log.h>
+
+#include <generic-backend/exception.h>
+#include <sw-backend/key.h>
+#include <sw-backend/store.h>
+
+namespace CKM {
+namespace Crypto {
+namespace SW {
+
+Id Store::getBackendId() const { return Id::OpenSSL; }
+
+GKeyShPtr Store::getKey(const Token &token) {
+ if (token.backendId != getBackendId()) {
+ LogDebug("Decider choose wrong backend!");
+ ThrowMsg(Exception::WrongBackend, "Decider choose wrong backend!");
+ }
+
+ switch (token.keyType) {
+ case KeyType::KEY_RSA_PUBLIC:
+ case KeyType::KEY_RSA_PRIVATE:
+ case KeyType::KEY_DSA_PUBLIC:
+ case KeyType::KEY_DSA_PRIVATE:
+ case KeyType::KEY_ECDSA_PUBLIC:
+ case KeyType::KEY_ECDSA_PRIVATE:
+ return std::make_shared<AKey>(token.buffer, token.keyType);
+ case KeyType::KEY_AES:
+ return std::make_shared<SKey>(token.buffer, token.keyType);
+ default:
+ LogDebug(
+ "This type of key is not supported by openssl backend: " << (int)token.keyType);
+ ThrowMsg(Exception::KeyNotSupported,
+ "This type of key is not supported by openssl backend: " << (int)token.keyType);
+ }
+
+}
+
+Token Store::import(KeyType keyType, const RawBuffer &buffer) {
+ Token token;
+ token.buffer = buffer;
+ token.keyType = keyType;
+ token.backendId = getBackendId();
+ return token;
+}
+
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
+
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file store.h
+ * @author Bartłomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version 1.0
+ */
+#pragma once
+
+#include <generic-backend/gkey.h>
+#include <generic-backend/gstore.h>
+#include <generic-backend/id.h>
+
+namespace CKM {
+namespace Crypto {
+namespace SW {
+
+class Store : public GStore {
+public:
+ virtual Id getBackendId() const;
+ virtual GKeyShPtr getKey(const Token &token);
+ virtual Token import(KeyType keyType, const RawBuffer &buffer);
+ virtual void destroy(const Token &){}
+};
+
+} // namespace SW
+} // namespace Crypto
+} // namespace CKM
+
#include <ocsp-service.h>
#include <key-provider.h>
-#include <CryptoService.h>
#include <file-system.h>
+/* TODO remove this include */
+#include <sw-backend/crypto-service.h>
+
#define REGISTER_SOCKET_SERVICE(manager, service) \
registerSocketService<service>(manager, #service)
OPENSSL_config(NULL);
CKM::KeyProvider::initializeLibrary();
- CKM::CryptoService::initialize();
+
+ /* ToDO remove it */
+ CKM::Crypto::SW::CryptoService::initialize();
{
LogInfo("Start!");
#include <ckm/ckm-type.h>
#include <key-provider.h>
#include <file-system.h>
-#include <CryptoService.h>
#include <ckm-logic.h>
#include <key-impl.h>
#include <certificate-config.h>
#include <certificate-store.h>
+#include <sw-backend/crypto-service.h>
+
namespace {
const char * const CERT_SYSTEM_DIR = "/etc/ssl/certs";
{
case KeyType::KEY_RSA_PUBLIC:
case KeyType::KEY_RSA_PRIVATE:
- retCode = CryptoService::createKeyPairRSA(additional_param, prv, pub);
+ retCode = Crypto::SW::CryptoService::createKeyPairRSA(additional_param, prv, pub);
break;
case KeyType::KEY_DSA_PUBLIC:
case KeyType::KEY_DSA_PRIVATE:
- retCode = CryptoService::createKeyPairDSA(additional_param, prv, pub);
+ retCode = Crypto::SW::CryptoService::createKeyPairDSA(additional_param, prv, pub);
break;
case KeyType::KEY_ECDSA_PUBLIC:
case KeyType::KEY_ECDSA_PRIVATE:
- retCode = CryptoService::createKeyPairECDSA(static_cast<ElipticCurve>(additional_param), prv, pub);
+ retCode = Crypto::SW::CryptoService::createKeyPairECDSA(static_cast<ElipticCurve>(additional_param), prv, pub);
break;
default:
const RSAPaddingAlgorithm padding)
{
DB::Row row;
- CryptoService cs;
+ Crypto::SW::CryptoService cs;
RawBuffer signature;
int retCode = CKM_API_SUCCESS;
try {
do {
- CryptoService cs;
+ Crypto::SW::CryptoService cs;
DB::Row row;
KeyImpl key;
retCode = cs.verifySignature(key, message, signature, hash, padding);
} while(0);
- } catch (const CryptoService::Exception::Crypto_internal &e) {
+ } catch (const Crypto::SW::CryptoService::Exception::Crypto_internal &e) {
LogError("KeyProvider failed with message: " << e.GetMessage());
retCode = CKM_API_ERROR_SERVER_ERROR;
- } catch (const CryptoService::Exception::opensslError &e) {
+ } catch (const Crypto::SW::CryptoService::Exception::opensslError &e) {
LogError("KeyProvider failed with message: " << e.GetMessage());
retCode = CKM_API_ERROR_SERVER_ERROR;
} catch (const KeyProvider::Exception::Base &e) {
#include <base64.h>
#include <digest.h>
-#include <crypto.h>
#include <crypto-logic.h>
+#include <sw-backend/crypto.h>
+
#define AES_CBC_KEY_SIZE 32
namespace CKM {
const RawBuffer &key,
const RawBuffer &iv) const
{
- Crypto::Cipher::AesCbcEncryption enc(key, iv);
+ Crypto::SW::Cipher::AesCbcEncryption enc(key, iv);
RawBuffer result = enc.Append(data);
RawBuffer tmp = enc.Finalize();
std::copy(tmp.begin(), tmp.end(), std::back_inserter(result));
const RawBuffer &key,
const RawBuffer &iv) const
{
- Crypto::Cipher::AesCbcDecryption dec(key, iv);
+ Crypto::SW::Cipher::AesCbcDecryption dec(key, iv);
RawBuffer result = dec.Append(data);
RawBuffer tmp = dec.Finalize();
std::copy(tmp.begin(), tmp.end(), std::back_inserter(result));
const RawBuffer &iv) const
{
RawBuffer tag(AES_GCM_TAG_SIZE);
- Crypto::Cipher::AesGcmEncryption enc(key, iv);
+ Crypto::SW::Cipher::AesGcmEncryption enc(key, iv);
RawBuffer result = enc.Append(data);
RawBuffer tmp = enc.Finalize();
std::copy(tmp.begin(), tmp.end(), std::back_inserter(result));
const RawBuffer &iv,
const RawBuffer &tag) const
{
- Crypto::Cipher::AesGcmDecryption dec(key, iv);
+ Crypto::SW::Cipher::AesGcmDecryption dec(key, iv);
if (tag.size() < AES_GCM_TAG_SIZE) {
LogError("Error in decryptDataAesGcm. Tag is too short.");
ThrowMsg(Exception::DecryptDBRowError, "Error in decryptDataAesGcm. Tag is too short");