本文整理汇总了C++中botan::SecureVector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ SecureVector::clear方法的具体用法?C++ SecureVector::clear怎么用?C++ SecureVector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botan::SecureVector
的用法示例。
在下文中一共展示了SecureVector::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: htonl
void ne7ssh_crypt::computeMac (Botan::SecureVector<Botan::byte> &hmac, Botan::SecureVector<Botan::byte> &packet, uint32 seq)
{
SecureVector<Botan::byte> macStr;
uint32 nSeq = htonl (seq);
if (hmacIn)
{
macStr = Botan::SecureVector<Botan::byte>((Botan::byte*)&nSeq, 4);
macStr += packet;
hmac = hmacIn->process (macStr);
}
else hmac.clear();
}
示例2:
void ne7ssh_string::bn2vector(Botan::SecureVector<Botan::byte>& result, const Botan::BigInt& bi)
{
int high;
Botan::byte zero = '\0';
SecureVector<Botan::byte> strVector = BigInt::encode(bi);
high = (*(strVector.begin()) & 0x80) ? 1 : 0;
if (high)
{
result = SecureVector<Botan::byte>(&zero, 1);
}
else
{
result.clear();
}
result += strVector;
}
示例3: localAlgos
bool ne7ssh_crypt::agree (Botan::SecureVector<Botan::byte> &result, const char* local, Botan::SecureVector<Botan::byte> &remote)
{
ne7ssh_string localAlgos (local, 0);
ne7ssh_string remoteAlgos (remote, 0);
char* localAlgo, *remoteAlgo;
bool match;
size_t len;
localAlgos.split (',');
localAlgos.resetParts();
remoteAlgos.split (',');
remoteAlgos.resetParts();
match = false;
while ((localAlgo = localAlgos.nextPart()))
{
len = strlen(localAlgo);
while ((remoteAlgo = remoteAlgos.nextPart()))
{
if (!memcmp (localAlgo, remoteAlgo, len))
{
match = true;
break;
}
}
if (match) break;
remoteAlgos.resetParts();
}
if (match)
{
result = Botan::SecureVector<Botan::byte>((Botan::byte*)localAlgo, (uint32_t) len);
return true;
}
else
{
result.clear();
return false;
}
}