本文整理汇总了C++中SymmetricKey::data方法的典型用法代码示例。如果您正苦于以下问题:C++ SymmetricKey::data方法的具体用法?C++ SymmetricKey::data怎么用?C++ SymmetricKey::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymmetricKey
的用法示例。
在下文中一共展示了SymmetricKey::data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
OpenSSLSymmetricCipherContext OpenSSLSymmetricCipher::start(OpenSSLSymmetricCipher::Method method, const SymmetricKey& key, const InitializationVector& iv, bool padding)
{
OpenSSLSymmetricCipherContext context(method);
int r = 0;
const EVP_CIPHER* evpCipher = getEVPCipher(key);
EXCEPTION_ASSERT(evpCipher, std::invalid_argument, "No cipher found that can use the supplied key");
switch (context.method())
{
case M_ENCRYPT:
{
r = EVP_EncryptInit_ex(context.ctx(), evpCipher, NULL, &key.data()[0], &iv.data()[0]);
break;
}
case M_DECRYPT:
{
r = EVP_DecryptInit_ex(context.ctx(), evpCipher, NULL, &key.data()[0], &iv.data()[0]);
break;
}
default:
{
THROW_EXCEPTION_WITH_LOG(std::runtime_error, "Unhandled method");
}
}
EXCEPTION_ASSERT_WITH_LOG(r == 1, OpenSSLException, "");
context.data().clear();
context.setPadding(padding);
return context;
}
示例2: return
/**
* \brief Comparaison operator.
* \param lhs The left argument.
* \param rhs The right argument.
* \return true if lhs is less than rhs.
*/
inline bool operator<(const SymmetricKey& lhs, const SymmetricKey& rhs)
{
return (lhs.data() < rhs.data());
}