本文整理汇总了C++中rsa::PublicKey::GetModulus方法的典型用法代码示例。如果您正苦于以下问题:C++ PublicKey::GetModulus方法的具体用法?C++ PublicKey::GetModulus怎么用?C++ PublicKey::GetModulus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rsa::PublicKey
的用法示例。
在下文中一共展示了PublicKey::GetModulus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printPublicKey
static void printPublicKey(RSA::PublicKey key)
{
///////////////////////////////////////
// Generated Parameters
const Integer& n = key.GetModulus();
const Integer& e = key.GetPublicExponent();
cout << "RSA Parameters:" << endl;
cout << " n: " << n << endl;
cout << " e: " << e << endl;
cout << endl;
}
示例2: pubkey
int
main(int argc, char ** argv)
{
if (argc != 2) {
cout << "Usage: keygen <outputname>" << endl;
return -1;
}
AutoSeededRandomPool rng;
InvertibleRSAFunction params;
params.GenerateRandomWithKeySize(rng, 3072);
RSA::PublicKey pubkey(params);
RSA::PrivateKey privkey(params);
Integer m = params.GetModulus();
Integer p = params.GetModulus();
Integer q = params.GetModulus();
Integer priv = params.GetPrivateExponent();
Integer pub = params.GetPublicExponent();
string privname = string(argv[1]).append(".priv");
string pubname = string(argv[1]).append(".pub");
CryptoEngine::pubkeyToFile(pubkey, pubname);
CryptoEngine::privkeyToFile(privkey, privname);
cout << "Loading and verifying..." << endl;
RSA::PrivateKey newpriv = CryptoEngine::privkeyFromFile(privname);
RSA::PublicKey newpub = CryptoEngine::pubkeyFromFile(pubname);
cout << (m == newpriv.GetModulus() ? "TRUE" : "FALSE") << endl;
cout << (priv == newpriv.GetPrivateExponent() ? "TRUE" : "FALSE") << endl;
cout << (pub == newpriv.GetPublicExponent() ? "TRUE" : "FALSE") << endl;
cout << (m == newpub.GetModulus() ? "TRUE" : "FALSE") << endl;
cout << (pub == newpub.GetPublicExponent() ? "TRUE" : "FALSE") << endl;
return 0;
}
示例3: PrintPublicKey
void PrintPublicKey(const RSA::PublicKey& key)
{
cout << "n: " << key.GetModulus() << endl;
cout << "e: " << key.GetPublicExponent() << endl;
}