How to commit unsigned char* data to CContactDataBase?
| Thu, 2007-11-08 13:06 | |
|
TPtrC16 name = _L(""); TInt FieldTextLength = name.Length(); TBuf<2000>DataBuf16; DataBuf16.Copy(name); TInt iFieldDatalen = DataBuf16.Length(); unsigned char *encryptdata = NULL; encryptdata = new unsigned char[100]; for(TInt i=0;i encryptdata[i]=DataBuf16[i]; } encryptdata[iFieldDatalen]=0; //Encrypt the Data Encrypt(encryptdata,dwDataLength,DKey); //Now How to commit this Encrypted data to CContactDataBase? Pls help me.Its not understanding for me. |
|






Forum posts: 982
What exactly you don't understand?
encryptdata is a pointer to char so you can't commit that in contact database since contact database stores contact items.
You can change the contact item and commit the contact item....
To change the contact item you do this:
- read contact item
- if you want to add a new item field; you create a new item field, set the field with your encrypted data (you can do this since you work with descriptors....which are able to handle binary data)
- add new item field
- commit contact item
- if you want to change an existing field item; read that field item, set the field with encrypted data (again you can do this since you work with descriptors....which are able to handle binary data)
- commit contact item
pirosl
Forum posts: 65
Hai pirosl,
Thanks for ur reply.
Iam doing the following steps.Are they correct?
1.Getting the text of each field and encrypting that field text.
2.Storing the encrypted text in TBuf .
3.Setting TBuf Text to ContactItem
pls help me.
Forum posts: 982
Seems rigth to me.....
One single comment....be sure your encrypted text is encoded in 16 bytes not in 8....(or compile everything on 8 bytes)
pirosl