GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Sep-2008, 01:13
alanchan alanchan is offline
New Member
 
Join Date: Sep 2008
Location: China
Posts: 3
alanchan is on a distinguished road
Thumbs up

About 'CryptDestroyKey' function!


I have some questions about using Cavium CSP, which need your kindness help.

According to the explain in MSDN, the function 'CryptDestroyKey' of CRYPTAPI
will not only destory the key handle, but also free the memory that the key
occupied.

But using Cavium CSP, the function does not free the memory. What is the
problem?

It is my code below. This circle will only run 64 times around, then it
fails because of lack of memory in Card.

CPP / C++ / C Code:


while(1)
{
if(!CryptImportPublicKeyInfo(hCryptProv,
MY_ENCODING_TYPE,&(pCertContext->pCertInfo->SubjectPublicKeyInfo),&hPubKey))
{
cout<<hex<<GetLastError()<<endl;
break;
goto while_end;
}
else
{
bSuceess = TURE;
}



while_end:
if(hPubKey) CryptDestroyKey(hPubKey); 



if(bSuceess){iSuccess++;}
else{iFalse++;}
}
Thank you for your help!
Last edited by admin : 04-Sep-2008 at 05:48. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 04-Sep-2008, 06:33
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,141
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: About 'CryptDestroyKey' function!


Quote:
Originally Posted by alanchan
According to the explain in MSDN, the function 'CryptDestroyKey' of CRYPTAPI
will not only destory the key handle, but also free the memory that the key
occupied.
I don't know if that's entirely true based on the MSDN's information about that function:
Quote:
Originally Posted by MSDN
... However, the underlying public/private key pair is not destroyed by this function. Only the handle is destroyed.
Could that possibly be part of the problem? I haven't worked with this area myself, so I'm not 100% certain.

EDIT:
Since we don't have the full picture of the source, check this MSDN example in case it might have any relevance.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 04-Sep-2008, 20:28
alanchan alanchan is offline
New Member
 
Join Date: Sep 2008
Location: China
Posts: 3
alanchan is on a distinguished road
Smile

Re: About 'CryptDestroyKey' function!


Hi TurboPT, Thank you for your reply! I think if there is only Public Key, the function of 'CryptDestroyKey' can destroy the key handle and free the memory at the same time. On the other hand, if there is Public/Private key pair, the function just destroy only the handle.So I wanna know wheather any other function can free the memory of the accelerater card? I hope can get your advice. Thank you!
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
run script command on ns2.26 newbie06 Computer Software Forum - Linux 65 19-Aug-2009 08:50
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 08:44
Flex and bison coding lucky88star C++ Forum 5 24-Dec-2007 12:57
Need Help with input files. Efferus C++ Forum 2 24-Nov-2007 17:19
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 14:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:09.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.