#include<bits/stdc++.h>
using std::cout;
using std::endl;
#include <cryptopp/ecp.h>
#include <cryptopp/asn.h>
#include <cryptopp/integer.h>
using CryptoPP::Integer;
#include <cryptopp/eccrypto.h>
using CryptoPP::ECP; // Prime field
using CryptoPP::ECPPoint;
using CryptoPP::DL_GroupParameters_EC;
#include <cryptopp/asn.h>
#include <cryptopp/oids.h>
namespace ASN1 = CryptoPP::ASN1;
int main()
{
DL_GroupParameters_EC<ECP> groupParameter = ASN1::secp160r1();
cout << "Modulus: "<< groupParameter.GetCurve().GetField().GetModulus() << endl;
cout << "Cofactor: "<< groupParameter.GetCofactor() << endl;
cout << "Coefficients" << endl;
cout << " A: "<< groupParameter.GetCurve().GetA() << endl;
cout << " B: "<< groupParameter.GetCurve().GetB() << endl;
ECP curve=groupParameter.GetCurve();
Integer y = groupParameter.GetSubgroupGenerator().x;
Integer x = groupParameter.GetSubgroupGenerator().y;
ECPPoint P=ECPPoint(x,y);
cout<<"P = "<<P.x<<" , "<<P.y<<endl;
return 0;
}
Tuesday, 20 June 2017
Basic Elliptic Curve Parameters in Crypto++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment