demoversion: encrypting - WeOnlyDo Discussion board

demoversion: encrypting (wodCrypt)

by MFC, Thursday, October 14, 2010, 21:28 (5154 days ago)

Hi,

is it also possible to encrypt some data correctly with the demoversion?

I saw your example in the Getting-Started-Guide, but if I use these params (secretkey and textmessage) I didn`t get the same decryption result.

[code]
Dim crypt As New wodCryptCom
Dim i_blob As New MemBlob
Dim o_blob As New MemBlob
i_blob.Text = this is text to be encrypted
crypt.Type = AES
crypt.SecretKey = my secret word
crypt.Encrypt i_blob, o_blob
Debug.Print o_blob.ToBase64

result:
xHBuQv8ae1vXCVA6/3/YCd5IUjL3lbnbzHDjlWt74fGfcNuS3osQtID1BMhepJI3
[/code]

I didn`t have any additional characters in the key as well as in the text message. My result will be:

[code]UrVASSj9kHMr3cNWKMf8OJ7IFMahdAFnOtR/7cGFipw=[/code]

best regards
Hans

Re: demoversion: encrypting

by wodDamir, Thursday, October 14, 2010, 21:42 (5154 days ago) @ MFC

Hans,

I'm not really sure what the second Code section represents. It looks to me like you basically encrypted again?

Did you try calling Decrypt method?

Also, if I'm correct, this is VB. If so, why don't you try the samples distributed along with the component?

We have a sample doing exactly what you're trying to do.

Regards,
Damba

Re: demoversion: encrypting

by MFC, Thursday, October 14, 2010, 21:59 (5154 days ago) @ wodDamir

wow, thanks for your fast reply:

messagetext: this is text to be encrypted
secretkey: my secret word
algorithm: AES

decryption: UrVASSj9kHMr3cNWKMf8OJ7IFMahdAFnOtR/7cGFipw=

I`m using your example code for VC (1. Simple MFC example). If I try to decrypt this code back, I`ll get the original message text. Which seams to be ok.

But in the Getting-STarted-Guide, using the same specifications, you get another decryption result (xHBuQv8ae1vXCVA6/3/YCd5IUjL3lbnbzHDjlWt74fGfcNuS3osQtID1BMhepJI3)

and that is a little bit strange to me... I thought the same secretkey as well as the same message text will produce the same decryption result.

Here is the page where I get your example in VB:
your-example

best regards
Hans

Re: demoversion: encrypting

by wodDamir, Thursday, October 14, 2010, 22:57 (5154 days ago) @ MFC

Hans,

The section of help files were written in the very begining of the component, so there is a chance that some default values were changed in the meantime, thus changing the result.

However, you should be getting bVKlVv07pDZSj84j9gQb2p/4dpCtg3tRFyhKiGJr0PE= as a result of the given encryption.

Are you sure that Optimized property is set to False?

Regards,
Damba