#endif
}
+tz_data_type toTzDataType(const CKM::DataType dataType) {
+ switch (int(dataType)) {
+ case CKM::DataType::Type::BINARY_DATA: return TYPE_GENERIC_SECRET;
+ case CKM::DataType::Type::KEY_AES: return TYPE_SKEY;
+ case CKM::DataType::Type::KEY_DSA_PRIVATE: return TYPE_AKEY_PRIVATE_DSA;
+ case CKM::DataType::Type::KEY_RSA_PRIVATE: return TYPE_AKEY_PRIVATE_RSA;
+ case CKM::DataType::Type::KEY_DSA_PUBLIC: return TYPE_AKEY_PUBLIC_DSA;
+ case CKM::DataType::Type::KEY_RSA_PUBLIC: return TYPE_AKEY_PUBLIC_RSA;
+ default:
+ ThrowErr(CKM::Exc::Crypto::DataTypeNotSupported,
+ "Data type could not be imported by tz-backend");
+ }
+}
+
} // namespace
namespace CKM {
RawBuffer &tag)
{
- uint32_t dataType;
-
- if (data.type.isSKey()) {
- dataType = TYPE_SKEY;
- } else if (data.type.isBinaryData()) {
- dataType = TYPE_GENERIC_SECRET;
- } else if (data.type.isKeyPrivate()) {
- dataType = TYPE_AKEY_PRIVATE;
- } else if (data.type.isKeyPublic()) {
- dataType = TYPE_AKEY_PUBLIC;
- } else {
- ThrowErr(Exc::Crypto::DataTypeNotSupported,
- "Data type could not be imported by tz-backend");
- }
-
+ const auto dataType = toTzDataType(data.type);
RawBuffer result;
RawBuffer pwdBuf(pwd.begin(), pwd.end());
getAlgType(algo),
key,
pwd,
- unpack<RawBuffer>(alg, ParamName::ED_IV),
+ result, // unused dummy
data,
result);
return result;
getAlgType(algo),
key,
pwd,
- unpack<RawBuffer>(alg, ParamName::ED_IV),
+ result, // unused dummy
cipher,
result);
return result;
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018-2019 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.
" -a|--accessors <accessor1>[,<accessor2>[,...]]" << std::endl <<
" A list of key-manager clients allowed to access given initial" << std::endl <<
" value separated by commas." << std::endl <<
- " -b|--backend <backend> A key-manager's backed to use when saving the initial values." << std::endl <<
+ " -b|--backend <backend> A key-manager's backend to use when saving the initial values." << std::endl <<
" Allowed values: 'software' and 'hardware'." << std::endl;
}