本文整理汇总了C++中SecureVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ SecureVector::push_back方法的具体用法?C++ SecureVector::push_back怎么用?C++ SecureVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecureVector
的用法示例。
在下文中一共展示了SecureVector::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// encoding and decoding
SecureVector<byte> EC2OSP(const PointGFp& point, byte format)
{
if(point.is_zero())
return SecureVector<byte>(1); // single 0 byte
const size_t p_bytes = point.get_curve().get_p().bytes();
BigInt x = point.get_affine_x();
BigInt y = point.get_affine_y();
SecureVector<byte> bX = BigInt::encode_1363(x, p_bytes);
SecureVector<byte> bY = BigInt::encode_1363(y, p_bytes);
if(format == PointGFp::UNCOMPRESSED)
{
SecureVector<byte> result;
result.push_back(0x04);
result += bX;
result += bY;
return result;
}
else if(format == PointGFp::COMPRESSED)
{
SecureVector<byte> result;
result.push_back(0x02 | static_cast<byte>(y.get_bit(0)));
result += bX;
return result;
}
else if(format == PointGFp::HYBRID)
{
SecureVector<byte> result;
result.push_back(0x06 | static_cast<byte>(y.get_bit(0)));
result += bX;
result += bY;
return result;
}
else
throw Invalid_Argument("illegal point encoding format specification");
}
示例2:
/**
* Serialize a Certificate Verify message
*/
SecureVector<byte> Certificate_Verify::serialize() const
{
SecureVector<byte> buf;
const u16bit sig_len = signature.size();
buf.push_back(get_byte(0, sig_len));
buf.push_back(get_byte(1, sig_len));
buf += signature;
return buf;
}