- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to find some easy-to-follow RSA key-generation, encryption/decryption examples.
What I've found are
http://software.intel.com/en-us/node/503498
and
http://software.intel.com/en-us/node/503457
Firstly, I'm not sure why (for example)
// Q prime factor BigNumber Q("0xC97FB1F027F453F6341233EAAAD1D9353F6C42D08866B1D05A0F2035028B9D86" "9840B41666B42E92EA0DA3B43204B5CFCE3352524D0416A5A441E700AF461503");
This appear to be constants -- I'm assuming that these values are created by the RSA key generation procedure?
I can't get the samples to build as they are on the Intel site (I'm using IPP 8.1 on Windows FYI). I get the following errors:
error C2660: 'ippsPrimeGen' : function does not take 1 arguments
IppsPrimeState* pPrimeG = ippsPrimeGen(P.BitSize());
and
1>rsa.cpp(83): error C3861: 'deletePrimeGen': identifier not found
deletePrimeGen(pPrimeG);
Am I using the right samples for 8.1?
Are there better examples available -- I'm trying to find a good example that shows the end-to-end process or creating private/public key, using keys for encyption and decryption...
Any pointers greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi Paul,
- “This appear to be constants -- I'm assuming that these values are created by the RSA key generation procedure?”
Definitely RSA parameters were generated by some RSA key generation procedure.
- “I get the following errors: error C2660: 'ippsPrimeGen' : function does not take 1 arguments IppsPrimeState* pPrimeG = ippsPrimeGen(P.BitSize()); “
I see the typo: ippsPrimeGen instead of newPrimeGen
- “rsa.cpp(83): error C3861: 'deletePrimeGen': identifier not found deletePrimeGen(pPrimeG);”
Agree. No deletePrimeGen() propotype. I’ve send an update to the manual - will be available in the next release
- “Am I using the right samples for 8.1?”
Samples are working in general.
- “I'm trying to find a good example that shows the end-to-end process or creating private/public key, using keys for encyption and decryption...”
Use ippCP manual and try something like the following to generate RSA-1024 (it's just a scheme - haven't tried to compile)
int factorP_bits = 512;
int factorP_bits = 1024;
int rsa_bits = factorP_bits + factorQ_bits;
// random generator
IppsPRNGState* pRand = newPRNG();
// prime generator
IppsPrimeState* pPrimeG = newPrimeGen(factorP_bits);
// RSA modulus and public exponent
BigNumber N(0, BITSIZE_WORD(rsa_bits));
BigNumber E;
// private type2 RSA
int prvSize;
ippsRSA_GetSizePrivateKeyType2(factorP_bits, factorQ_bits, &prvSize);
IppsRSAPrivateKeyState* pPrvKey = (IppsRSAPrivateKeyState*)(new Ipp8u [prvSize]);
ippsRSA_InitPrivateKeyType2(factorP_bits, factorQ_bits, pPrvKey, prvSize);
// scratch buffer
int bufSize;
ippsRSA_GetBufferSizePrivateKey(&bufSize, pPrvKey);
Ipp8u* pBuffer = new Ipp8u [bufSize];
// init value of the public exponent
BigNumber E0(3);
// generate RSA system
do {
sts = ippsRSA_GenerateKeys(E0, N, E, NULL,
pPrvKey,
pBuffer,
50,
pPrimeGen,
ippsPRNGen, pPRNG)
} while(sts!=ippStsNoErr);
regards, Igor
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi Paul,
- “This appear to be constants -- I'm assuming that these values are created by the RSA key generation procedure?”
Definitely RSA parameters were generated by some RSA key generation procedure.
- “I get the following errors: error C2660: 'ippsPrimeGen' : function does not take 1 arguments IppsPrimeState* pPrimeG = ippsPrimeGen(P.BitSize()); “
I see the typo: ippsPrimeGen instead of newPrimeGen
- “rsa.cpp(83): error C3861: 'deletePrimeGen': identifier not found deletePrimeGen(pPrimeG);”
Agree. No deletePrimeGen() propotype. I’ve send an update to the manual - will be available in the next release
- “Am I using the right samples for 8.1?”
Samples are working in general.
- “I'm trying to find a good example that shows the end-to-end process or creating private/public key, using keys for encyption and decryption...”
Use ippCP manual and try something like the following to generate RSA-1024 (it's just a scheme - haven't tried to compile)
int factorP_bits = 512;
int factorP_bits = 1024;
int rsa_bits = factorP_bits + factorQ_bits;
// random generator
IppsPRNGState* pRand = newPRNG();
// prime generator
IppsPrimeState* pPrimeG = newPrimeGen(factorP_bits);
// RSA modulus and public exponent
BigNumber N(0, BITSIZE_WORD(rsa_bits));
BigNumber E;
// private type2 RSA
int prvSize;
ippsRSA_GetSizePrivateKeyType2(factorP_bits, factorQ_bits, &prvSize);
IppsRSAPrivateKeyState* pPrvKey = (IppsRSAPrivateKeyState*)(new Ipp8u [prvSize]);
ippsRSA_InitPrivateKeyType2(factorP_bits, factorQ_bits, pPrvKey, prvSize);
// scratch buffer
int bufSize;
ippsRSA_GetBufferSizePrivateKey(&bufSize, pPrvKey);
Ipp8u* pBuffer = new Ipp8u [bufSize];
// init value of the public exponent
BigNumber E0(3);
// generate RSA system
do {
sts = ippsRSA_GenerateKeys(E0, N, E, NULL,
pPrvKey,
pBuffer,
50,
pPrimeGen,
ippsPRNGen, pPRNG)
} while(sts!=ippStsNoErr);
regards, Igor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are several problems in the above approximation. It would be nice to have a working example posted here, or at least a link to one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page