本文整理汇总了C++中SignatureLite::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ SignatureLite::getType方法的具体用法?C++ SignatureLite::getType怎么用?C++ SignatureLite::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignatureLite
的用法示例。
在下文中一共展示了SignatureLite::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtime_error
ptr_lib::shared_ptr<Signature>
Tlv0_2WireFormat::decodeSignatureInfoAndValue
(const uint8_t *signatureInfo, size_t signatureInfoLength,
const uint8_t *signatureValue, size_t signatureValueLength)
{
struct ndn_NameComponent keyNameComponents[100];
SignatureLite signatureLite
(keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
ndn_Error error;
if ((error = Tlv0_2WireFormatLite::decodeSignatureInfoAndValue
(signatureLite, signatureInfo, signatureInfoLength, signatureValue,
signatureValueLength)))
throw runtime_error(ndn_getErrorString(error));
ptr_lib::shared_ptr<Signature> result;
if (signatureLite.getType() == ndn_SignatureType_Sha256WithRsaSignature)
result.reset(new Sha256WithRsaSignature());
else if (signatureLite.getType() == ndn_SignatureType_Sha256WithEcdsaSignature)
result.reset(new Sha256WithEcdsaSignature());
else if (signatureLite.getType() == ndn_SignatureType_HmacWithSha256Signature)
result.reset(new HmacWithSha256Signature());
else if (signatureLite.getType() == ndn_SignatureType_DigestSha256Signature)
result.reset(new DigestSha256Signature());
else if (signatureLite.getType() == ndn_SignatureType_Generic)
result.reset(new GenericSignature());
else
// We don't expect this to happen.
throw runtime_error("signatureStruct.type has an unrecognized value");
result->set(signatureLite);
return result;
}
示例2: validityPeriod
// Check signatureLite.getType() and imitate
// Sha256WithRsaSignature::set(const SignatureLite& signatureLite), etc.
static void
setSignature(PyObject* signature, const SignatureLite& signatureLite)
{
if (signatureLite.getType() == ndn_SignatureType_Sha256WithRsaSignature ||
signatureLite.getType() == ndn_SignatureType_Sha256WithEcdsaSignature) {
setSignatureWithKeyLocator(signature, signatureLite);
PyObjectRef validityPeriod(PyObject_CallMethodObjArgs
(signature, str.getValidityPeriod, NULL));
setValidityPeriod(validityPeriod, signatureLite.getValidityPeriod());
}
else if (signatureLite.getType() == ndn_SignatureType_HmacWithSha256Signature)
setSignatureWithKeyLocator(signature, signatureLite);
else if (signatureLite.getType() == ndn_SignatureType_DigestSha256Signature)
setSignatureWithSignatureOnly(signature, signatureLite);
else if (signatureLite.getType() == ndn_SignatureType_Generic)
setGenericSignature(signature, signatureLite);
else
// We don't expect this to happen if the caller used getSignatureClassName.
return;
}