本文整理汇总了C++中KeyChain::signWithSha256方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyChain::signWithSha256方法的具体用法?C++ KeyChain::signWithSha256怎么用?C++ KeyChain::signWithSha256使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyChain
的用法示例。
在下文中一共展示了KeyChain::signWithSha256方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemoryIdentityStorage
TEST_F(TestInterestMethods, VerifyDigestSha256)
{
// Create a KeyChain but we don't need to add keys.
ptr_lib::shared_ptr<MemoryIdentityStorage> identityStorage
(new MemoryIdentityStorage());
KeyChain keyChain
(ptr_lib::make_shared<IdentityManager>
(identityStorage, ptr_lib::make_shared<MemoryPrivateKeyStorage>()),
ptr_lib::make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
ptr_lib::shared_ptr<Interest> interest(new Interest(Name("/test/signed-interest")));
keyChain.signWithSha256(*interest);
VerifyCounter counter;
keyChain.verifyInterest
(interest, bind(&VerifyCounter::onVerified, &counter, _1),
// Cast to disambiguate from the deprecated OnVerifyInterestFailed.
(const OnInterestValidationFailed)bind
(&VerifyCounter::onInterestValidationFailed, &counter, _1, _2));
ASSERT_EQ(counter.onValidationFailedCallCount_, 0) << "Signature verification failed";
ASSERT_EQ(counter.onVerifiedCallCount_, 1) << "Verification callback was not used.";
}