return;
}
- if (dataType.isSKey())
+ if (dataType.isSymmetricKey())
m_observer->ReceivedKey(KeyAESImpl(rawData));
else if (dataType.isKey())
m_observer->ReceivedKey(KeyImpl(rawData));
if (retCode != CKM_API_SUCCESS)
return retCode;
- KeyShPtr keyParsed = recvDataType.isSKey() ? Key::createAES(rawData) : Key::create(rawData);
+ KeyShPtr keyParsed = recvDataType.isSymmetricKey() ? Key::createAES(rawData) : Key::create(rawData);
if (!keyParsed) {
LogDebug("Key empty - failed to parse!");
if (retCode != CKM_API_SUCCESS)
return retCode;
- if (dataTypeKey.isSKey()) {
+ if (dataTypeKey.isSymmetricKey()) {
keyType = KeyType::KEY_AES;
} else if (dataTypeKey.isKeyPrivate()) {
keyType = KeyType::KEY_RSA_PRIVATE;
return false;
}
-bool DataType::isSKey() const
+bool DataType::isSymmetricKey() const
{
return (KEY_AES == m_dataType);
}
operator int() const;
bool isKey() const;
-
- /*
- * Number of times someone mistook it for isKey() (or the opposite): 4
- * Increase the counter if it happened to you.
- * I will rename this function if the counter reaches 4.
- */
- bool isSKey() const;
+ bool isSymmetricKey() const;
bool isChainCert() const;
bool isKeyPrivate() const;
bool isKeyPublic() const;
if (!encrypted)
addSW();
- if (data.isBinaryData() || (data.isSKey() && !policy.extractable))
+ if (data.isBinaryData() || (data.isSymmetricKey() && !policy.extractable))
addTZ();
} else { // generate/derive
assert(!encrypted);
}
// validate the decrypted key
- if (wrappedKey.type.isSKey()) {
+ if (wrappedKey.type.isSymmetricKey()) {
auto tmp = CKM::Key::createAES(decrypted);
if (!tmp)
ThrowErr(Exc::Crypto::InputParam, "Wrapped data is not a valid AES key");
if (token.dataType.isKeyPrivate() || token.dataType.isKeyPublic())
return make<AKey>(std::move(data), token.dataType);
- if (token.dataType.isSKey())
+ if (token.dataType.isSymmetricKey())
return make<SKey>(std::move(data), token.dataType);
if (token.dataType.isCertificate() || token.dataType.isChainCert())
if (token.dataType.isKeyPrivate() || token.dataType.isKeyPublic())
return make<AKey>(scheme, std::move(id), Pwd(pass, iv, tag), token.dataType);
- if (token.dataType.isSKey())
+ if (token.dataType.isSymmetricKey())
return make<SKey>(scheme, std::move(id), Pwd(pass, iv, tag), token.dataType);
if (token.dataType.isCertificate() || token.dataType.isChainCert())
if (input.type.isKey()) {
KeyShPtr output_key;
- if (input.type.isSKey())
+ if (input.type.isSymmetricKey())
output_key = CKM::Key::createAES(input.data);
else
output_key = CKM::Key::create(input.data);
POSITIVE_TEST_CASE(UNARY_OPERATIONS)
{
- BOOST_REQUIRE(DataType(DataType::KEY_AES).isSKey());
- BOOST_REQUIRE(!DataType(DataType::KEY_RSA_PUBLIC).isSKey());
+ BOOST_REQUIRE(DataType(DataType::KEY_AES).isSymmetricKey());
+ BOOST_REQUIRE(!DataType(DataType::KEY_RSA_PUBLIC).isSymmetricKey());
BOOST_REQUIRE(DataType(DataType::DB_CHAIN_FIRST).isChainCert());
BOOST_REQUIRE(DataType(DataType::DB_CHAIN_LAST).isChainCert());
BOOST_REQUIRE(!data.empty());
KeyShPtr key;
- if (dataType.isSKey())
+ if (dataType.isSymmetricKey())
key = CKM::Key::createAES(data);
else
key = CKM::Key::create(data);