Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalarrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 3:14
(Steven Hicks)n+11-Dec-03 3:14 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 8:26
igor19601-Dec-03 8:26 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 10:03
(Steven Hicks)n+11-Dec-03 10:03 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 10:10
igor19601-Dec-03 10:10 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 10:21
(Steven Hicks)n+11-Dec-03 10:21 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 10:58
igor19601-Dec-03 10:58 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 11:16
(Steven Hicks)n+11-Dec-03 11:16 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 11:29
igor19601-Dec-03 11:29 
But according to your code with m_tContents="asdf":

dwLength= _tcslen(m_tContents); // <= will give you 4
pbBuffer=(BYTE*)malloc(dwLength); // <= pbBuffer should be allocated with 4 bytes
if (pbBuffer != NULL)
{
memcpy(pbBuffer, m_tContents, dwLength);

if (CryptEncrypt(hKey, 0, true, 0, pbBuffer, &dwLength, dwLength)) // <= should encrypt just 4 bytes

How you get 25, and if dwLength=25 after the call your pbBuffer is overrun!
However you passed dwLength = 4, your CryptEncrypt either should fail or your pbBuffer should be overrun

How are you getting 25?...
Could you be more specific?

"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 11:33
(Steven Hicks)n+11-Dec-03 11:33 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 11:42
igor19601-Dec-03 11:42 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 11:50
(Steven Hicks)n+11-Dec-03 11:50 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
igor19601-Dec-03 12:20
igor19601-Dec-03 12:20 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 13:17
(Steven Hicks)n+11-Dec-03 13:17 
GeneralRe: arrrruuugghhhhh cyrptoapi again Pin
(Steven Hicks)n+11-Dec-03 10:04
(Steven Hicks)n+11-Dec-03 10:04 
Generalmem leak detection Pin
GDavy1-Dec-03 3:07
GDavy1-Dec-03 3:07 
GeneralRe: mem leak detection Pin
Antti Keskinen1-Dec-03 10:04
Antti Keskinen1-Dec-03 10:04 
Generalitoa Pin
styve1-Dec-03 2:55
styve1-Dec-03 2:55 
GeneralRe: itoa Pin
GDavy1-Dec-03 2:58
GDavy1-Dec-03 2:58 
GeneralRe: itoa Pin
Michael P Butler1-Dec-03 3:20
Michael P Butler1-Dec-03 3:20 
GeneralForm Designer Pin
Luiz Antonio Picanço1-Dec-03 2:41
Luiz Antonio Picanço1-Dec-03 2:41 
GeneralRe: Form Designer Pin
Antti Keskinen1-Dec-03 10:12
Antti Keskinen1-Dec-03 10:12 
GeneralRe: Form Designer Pin
Luiz Antonio Picanço2-Dec-03 0:45
Luiz Antonio Picanço2-Dec-03 0:45 
Questionnot stops Wait Cursor - why? Pin
vgrigor1-Dec-03 2:41
vgrigor1-Dec-03 2:41 
AnswerRe: not stops Wait Cursor - why? Pin
David Crow1-Dec-03 3:29
David Crow1-Dec-03 3:29 
GeneralRe: not stops Wait Cursor - why? Pin
vgrigor1-Dec-03 3:37
vgrigor1-Dec-03 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.