本文整理汇总了C++中CKey::GetBigIntL方法的典型用法代码示例。如果您正苦于以下问题:C++ CKey::GetBigIntL方法的具体用法?C++ CKey::GetBigIntL怎么用?C++ CKey::GetBigIntL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKey
的用法示例。
在下文中一共展示了CKey::GetBigIntL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyL
// Public Decrypt
void RSAFunction::VerifyL(const CKey& aPublicKey,
const TInteger& aInput, RInteger& aOutput)
{
const TInteger& N = aPublicKey.GetBigIntL(KRsaKeyParameterNUid);
const TInteger& E = aPublicKey.GetBigIntL(KRsaKeyParameterEUid);
FunctionL(N, E, aInput, aOutput);
}
示例2: FunctionCRTL
// The CRT version of the RSA Trapdoor Function
void RSAFunction::FunctionCRTL(const CKey& aPrivateKey,
const TInteger& aInput, RInteger& aOutput)
{
const TInteger& N = aPrivateKey.GetBigIntL(KRsaKeyParameterNUid);
IsInputValidL(aInput, N);
const TInteger& P = aPrivateKey.GetBigIntL(KRsaKeyParameterPUid);
const TInteger& Q = aPrivateKey.GetBigIntL(KRsaKeyParameterQUid);
const TInteger& DP = aPrivateKey.GetBigIntL(KRsaKeyParameterDPUid);
const TInteger& DQ = aPrivateKey.GetBigIntL(KRsaKeyParameterDQUid);
const TInteger& QInv = aPrivateKey.GetBigIntL(KRsaKeyParameterQInvUid);
CMontgomeryStructure* montP = CMontgomeryStructure::NewLC(P);
CMontgomeryStructure* montQ = CMontgomeryStructure::NewLC(Q);
// m1 = c^(dP) mod(p)
RInteger inputReduced = aInput.ModuloL(P);
CleanupStack::PushL(inputReduced);
const TInteger& m1 = montP->ExponentiateL(inputReduced, DP);
CleanupStack::PopAndDestroy(&inputReduced);
// m2 = c^(dQ) mod(Q)
inputReduced = aInput.ModuloL(Q);
CleanupStack::PushL(inputReduced);
const TInteger& m2 = montQ->ExponentiateL(inputReduced, DQ);
CleanupStack::PopAndDestroy(&inputReduced);
// Calculate CRT
// h = (m1-m2) qInv mod(p)
RInteger h = m1.MinusL(m2);
CleanupStack::PushL(h);
h *= QInv;
h %= P;
// m = m2 + q * h
h *= Q;
h += m2;
aOutput = h;
CleanupStack::Pop(&h);
CleanupStack::PopAndDestroy(montQ);
CleanupStack::PopAndDestroy(montP);
}
示例3: ConstructL
void CRSAImpl::ConstructL(const CKey& aKey)
{
const TInteger& N = aKey.GetBigIntL(KRsaKeyParameterNUid);
TCrypto::IsAsymmetricWeakEnoughL(N.BitCount());
CAsymmetricCipherImpl::ConstructL(aKey);
if (! IsValidKeyLengthL(N.ByteCount()))
{
User::Leave(KErrKeySize);
}
}
示例4: SignL
// Private Encrypt
void RSAFunction::SignL(const CKey& aPrivateKey, const TInteger& aInput, RInteger& aOutput)
{
if (aPrivateKey.KeyProperty().iKeyType == KRsaPrivateKeyStandardUid)
{
const TInteger& N = aPrivateKey.GetBigIntL(KRsaKeyParameterNUid);
const TInteger& D = aPrivateKey.GetBigIntL(KRsaKeyParameterDUid);
FunctionL(N, D, aInput, aOutput);
}
else if (aPrivateKey.KeyProperty().iKeyType == KRsaPrivateKeyCRTUid)
{
FunctionCRTL(aPrivateKey, aInput, aOutput);
}
else
{
User::Leave(KErrNotSupported);
}
}