Simple Question about the Buffers in cryptPopData

View: New views
1 Messages — Rating Filter:   Alert me  

Simple Question about the Buffers in cryptPopData

by BenjaminF :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Guys,

I got a real dumn question but I can't figure out how it works and the manual is not really helping at that point. I wrote a simple example to see how the system works:

                string message = "hallo Welt!";
                int bytescopied;
                crypt.Init();
                int cryptEnvelope = crypt.CreateEnvelope(crypt.UNUSED, crypt.FORMAT_CRYPTLIB);
                crypt.SetAttribute(cryptEnvelope, crypt.ENVINFO_DATASIZE, message.Length);
                bytescopied = crypt.PushData(cryptEnvelope, message);
                crypt.FlushData(cryptEnvelope);
                bytescopied = crypt.PopData(cryptEnvelope, envelopedData, message.Length);
               
                crypt.DestroyEnvelope(cryptEnvelope);
                Console.WriteLine(envelopedData);
                Console.WriteLine("fertig");
                crypt.End();

The thing is that I have no clue how to initialize the envelopedData. If I initialize it with
 byte[] envelopedData = ... then I have to set all dimensions and that stuff. Do I really have to do this? Also how can I get from there my String back? I was looking for Stringbuffers but found nothing.

Could you help me with this? :)

Thanks!

Benjamin