trying to unravel an encrypted string that was encrypted in dotnet managed code.

I posted this yesterday in the security.crypto newsgroup but thought this
might be more appropriate.

if I were using WinCrypt.h, etc. how would the following have to change for
the decryption portion.
I will be encrypting in managed code and need to decrypt in a service
component that is unmanaged C++.  thank you. -Greg

arguments passed into this would be an encrypted xml string and two byte
arrays, one the key  and one the inititialization vector.

using System.Security.Cryptography;
using System.IO;

RC2CryptoServiceProvider rc2 = new RC2CryptoServiceProvider();
rc2.IV = iniitialization_vector_obtained_during_encryption;
rc2.Key = key_obtained_during_encryption;
MemoryStream ms=new MemoryStream();
CryptoStream encStream = new CryptoStream(ms, rc2.CreateDecryptor(),
CryptoStreamMode.Write);

encStream.Write(StringToByteArray(enctryped_string),0,encrcrypted_string.Len
gth);
encStream.FlushFinalBlock();
encStream.Flush();
encStream.Close();
string result= MemoryStreamToString(ms);
ms.Close();





0
hazz (7)
9/8/2004 1:11:05 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
488 Views

Similar Articles

[PageSpeed] 24

uh, oh.. obviously rushed into all this... there is the matter of the MD5
hashed password whose value needs to be available to the C++ code and that
hashed password was created in the dotnet managed code class. So not sure
how I would obtain that....

"hazz" <hazz@sonic.net> wrote in message
news:eWN3NValEHA.3544@TK2MSFTNGP15.phx.gbl...
> I posted this yesterday in the security.crypto newsgroup but thought this
> might be more appropriate.
>
> if I were using WinCrypt.h, etc. how would the following have to change
for
> the decryption portion.
> I will be encrypting in managed code and need to decrypt in a service
> component that is unmanaged C++.  thank you. -Greg
>
> arguments passed into this would be an encrypted xml string and two byte
> arrays, one the key  and one the inititialization vector.
>
> using System.Security.Cryptography;
> using System.IO;
>
> RC2CryptoServiceProvider rc2 = new RC2CryptoServiceProvider();
> rc2.IV = iniitialization_vector_obtained_during_encryption;
> rc2.Key = key_obtained_during_encryption;
> MemoryStream ms=new MemoryStream();
> CryptoStream encStream = new CryptoStream(ms, rc2.CreateDecryptor(),
> CryptoStreamMode.Write);
>
>
encStream.Write(StringToByteArray(enctryped_string),0,encrcrypted_string.Len
> gth);
> encStream.FlushFinalBlock();
> encStream.Flush();
> encStream.Close();
> string result= MemoryStreamToString(ms);
> ms.Close();
>
>
>
>
>


0
hazz (7)
9/8/2004 9:53:35 PM
Reply:

Similar Artilces:

trying this out
This is a test posting. On Tue, 13 Nov 2007 16:06:51 +0800, "hmmmm" <bobo123@dotdot.dyndns.org> wrote: >This is a test posting. > Please use microsoft.public.test or microsoft.public.test.here for your testing. This is a working newsgroup. If you have questions about an Access database, please post them. John W. Vinson [MVP] ...

USB root hub power management keeps resetting itself
I've got Vista SP2. When I choose "sleep" to put my desktop PC to sleep, it keeps waking up by itself after a couple hours. I suspected the problem was the power management for some of the devices. So I went into Device Manager, and for each USB root hub, I selected Power Management and I checked the box "Allow the computer to turn off this device to save power." But when I reboot my PC, I then find that this box is unchecked again! Why is Vista automatically resetting the Power Management policy on USB root hubs, and how can I stop this from happ...

I am trying to round up to the nearest 25 cents
I am trying to round a money value to the nearsest 25 cents and it keeps rounding to the nearest dollar HELP Try =CEILING(A1, 0.25) In article <2DB8F007-1E27-4A48-923B-C7D4D0238B5E@microsoft.com>, sypher <sypher@discussions.microsoft.com> wrote: > I am trying to round a money value to the nearsest 25 cents and it keeps > rounding to the nearest dollar HELP =ROUND(A1*4,0)/4 -- HTH Bob Phillips "sypher" <sypher@discussions.microsoft.com> wrote in message news:2DB8F007-1E27-4A48-923B-C7D4D0238B5E@microsoft.com... > I am trying to round a mone...

Interfund Management SQL Components missing?
When we log in as anyone but sa, we get a message saying our system has "Interfund Management SQL Components missing." We're on v8, SP5. The error states "Interfund Management will be disabled until it is initialized by the system administrator." Anybody know how to do this? ...

Trying to clear up Received but not invoiced report
I am trying to clean up the received not invoiced items. The problem began with entering a purchase order and then not matching the invoice to the items received agaisnt the purchase order. SO we thought that doing a returned transaction entery would solve the problem. The only thing is now the return shows up on our Received/ Not invoiced report. And the report is becoming a huge mess and difficult to use. What is the best way to clear up items that have been received but were not matched and already paid through the invoice entery? There is a knowledgebase article on this very thing av...

Import Customer Address Codes
This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C4AF86.06A60AC0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0017_01C4AF86.06A60AC0" ------=_NextPart_001_0017_01C4AF86.06A60AC0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable BlankI was wondering if there is a way to import address codes for one = of our customers? Currently, for this customer I have one bill to = location and 2 ship to locations. But we just sold the account on a = national level and now 800 ship to locations....

Error Code :0x80040605
Outlook asked me to upgrade the Connector when i choose to repair, nothing happened except that my email account could not sign in and when i choose remove the outlook connector automatically removed. Troubleshooting Outlook Hotmail Connector - http://www.officeforlawyers.com/outlook/tsol.htm#hm -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com/outlook.htm Author: The Lawyer's Guide to Microsoft Outlook 2007: http://tinyurl.com/ol4law-amazon "Karen" <Karen@discussions.microsoft.com> wr...

send/receive (2nd try)
New computer. Microsoft XP Home. Microsoft Office XP Small Business 2002. Earthlink dial-up account. Two e- mail accounts. After opening Outlook, 1st send/receive (option 3, all accounts) usually prompts for both passwords, downloads messages, all good. Next time, though, no prompt for account 2, error cannot connect to server, account 1 usually gets messages. Every five minute send/receive option eventually degenerates to cannot connect to server errors for both accounts. Meanwhile internet browsing slows to a crawl. Any ideas? ...

How do I cancel a msg Outlook keeps trying to send unsuccessfully?
How do I cancel an "in process" email Outlook keeps trying to send unsuccessfully due to a huge email message I tried to send with way too many attachments? It's stuck in "send" mode, and as a result, I can't send any emails because Outlook cannot get past trying to send this message. How do I cancel a pending outbox transmission while it's trying to send? I've tried everything I can think of to no avail. Please help! Angelczech wrote on Fri, 12 March 2010 07:32 > How do I cancel an "in process" email Outlook keeps trying to send ...

trying to insert a 0 in front of zipcode
Hello, I do not use excel at all so i have no clue! I have a list of daycares that i want to create mailing labels with...about 700 of them but the problem is my zipcode column there needs to be a zero in front of all 700 zipcodes how to i insert a zero in front of them without having to type it into each box? the other question is can i print labels directly from excel or do i have to go thru ms word? thanks Greg One of these 1) format the cells with custom format 00000 2) format the cells with Special / Zip Codes 3) format the cells as Text 4) begin all zip codes with an sin...

Sort WBS Codes
I have WBS codes exported from project, how do I sort so that eg 1.8.3 comes before 1.8.10. Obviously text sorting will put the 1.8.10 first. If you add some columns after the column with the WBS codes, you ca select the WBS column and do a Text To Columns funtion from the dat menu. Choose delimited and select a period as the delimitor. The sort by the new columns. You can then delete these columns. You may want to copy the WBS column first so you don't have to paste i back together after the sort. -- Message posted from http://www.ExcelForum.com Hi John you may apply the proce...

error message when trying to install WMP 10 or 11
My operating system is Windows XP Home Edition 2002. I'm trying to download either WMP 10 or 11 and I get a message saying it was not possible to complete setup, see webhelp for more assistance, however there is no additional information when I click Web help. the Error message is 8007F0DA. Can anyone help me? Thanks. On Tue, 30 Mar 2010 07:54:01 -0700, Nate <Nate@discussions.microsoft.com> wrote: > >My operating system is Windows XP Home Edition 2002. I'm trying to download >either WMP 10 or 11 and I get a message saying it was not possible to &g...

Try or TRY
Hello, Will there be any opitmization or ... when we use INT or TRY macros instead of int or try ? Which one is better to be used? Thanks, JSmith "JSmith" <jsmithmitra@yahoo.com> wrote in message news:%23G1sOVdoEHA.692@TK2MSFTNGP12.phx.gbl... > > Hello, > > Will there be any opitmization or ... when we use INT or TRY macros instead > of int or try ? Which one is better to be used? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_exceptions.3a_.converting_from_mfc_exception_macros.asp -- Jeff Partch [VC++ MVP] FYI, TRY ...

Collections Management Automatic Mark as Paid
In Collections Management, an Action Item can be set to "Mark as Paid" Automatically when an item is paid and the action ID is "Promise to Pay." However, it marks items completed even when a partial payment is applied. This would appear to be a bug in the system. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based New...

Newseries; macro to code
Like a lot of stuff I do the macro thing first to get a general idea of the landscape. Here I'm up against the limits of my ability. This has been working just fine for a while myChart.SeriesCollection.NewSeries myChart.SeriesCollection(2).Values = "='HCLHotBath'! R75C107:R75C250" myChart.SeriesCollection(2).Name = "B2Alpha" Now, all of a sudden it bombs on the .Name =, the message is "Unable to set the Name property of the Series Class" I have this feeling that SeriesCollection(2) really isn't there. But, on the o...

error message when trying to delete messages in inbox
I cannot delete messages in my email inbox. When attempting to delete messages, Outlook says "The messaging interface has returned an unknown error. If the problem persists, restart Outlook. I continue to get the message even though I restarted Outlook. My mail works fine, but I just cannot delete anything. Does someone know a solution? Can you delete them if you hold shift as you delete? How many items are in the deleted items folder? Are you using any type of AV scanner on the message store? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coa...

Manage Calendar
Is it possible to manage somebody else's calendar? My boss wants his assistant to be able to manage his calendar from her desk. Is this possible? He wants her to have reminders pop up on her computer. Any ideas would be greatly appreciated! Thanks, Jasper The easiest way I know is to have your boss's assistant set up as his Delegate. Then she can manage his calandar as if it were her own. marx404 Does that give her access to everything in his mailbox also? Thanks, Jasper "marx404" <404@404.com> wrote in message news:MoCdnRtYxddb8_DdRVn-uw@adelphia.com... &...

Malicious Code error when opening a custom outlook form
After installing Visio 2003 on XP Professional with Microsoft Office 2002 installed, I get the following error when I launch a custom outlook form... "To help prevent malicious code from running, one or more objects in this form were not loaded. For more information, contact your administrator." Has anyone seen this or know how to address it? ...

Problem trying to export e-mail messages
When I go into Windows Mail and export my messages, the export completes but then I go and the folders don't match my existing e-mail folders. There are folders showing which I had deleted months ago. Could it be a corrupt file? How can I just transfer the e-mail messages I need to a new PC with Windows 7? Thanks> Windows Mail uses internal mail folder names that may not correspond exactly to the folder name in the user interface. What are you doing with your Windows Mail messages in Windows 7? Windows Mail was not designed to run on Windows 7. --=20 Gary VanderMole...

Install error data migration manager
Hi, It seems like the data migration manager cannot be installed on windows server 2008. When I select the program destination folder, "C:\Program Files (x86)\Microsoft Dynamics CRM Data Migration Manager" I get an error "The path is not of a legal form" and can not continue the installation. Can anyone give me some assistance? Hi; The credit for this goes to someone else, as I found it buried in a newsgroup, but it did help me get past your error a few weeks ago: See below. Dave Ireland I managed to sort this out, so hope this will help someone in future. As ...

how to proceed further after placing chunk code in GP folder?
Hi, I have placed chunk code in the folder where GP was there.Even i got message as "Do u want to include new code?". Next step is transferring third party resources. I was struck up here. While performing an update operation, I got an error as "Index file not found". I am not able to proceed further. Can someone help me out in this issue? Kiran Is this a file you created or got from somebody else? -- Charles Allen, MVP "Kiran" wrote: > Hi, > I have placed chunk code in the folder where GP was there.Even i got > message as &qu...

Help with code requiring last record
I am trying to perform an action based on weather the form is on the last record If this is the last record in the database then dosomething ... End If Define "last". Do you mean the record that was entered most recently? If so, how will Access know this? Do you have a "DateOfEntry" date/time field in your table? "Last" only makes sense when you sort by something. What are you sorting by? Regards Jeff Boyce Microsoft Office/Access MVP "Ayo" <Ayo@discussions.microsoft.com> wrote in message news:6F935741-AB78-48D4-8C24-A5B55CCDE1...

Windows update error code 80070652
This has been happening for quite some time. I have windows office both 2003 and 2007 School edition. These updates keep coming on my computer and fail, this time I only did one and got this code. How to fix, or is this for professional and if so how do I get rid of it? Hello Steven, 0x80070652 - ERROR_INSTALL_ALREADY_RUNNING Error 80070652 means that a previous installation has not been completed successfully. Restarting computer generally fixes this issue. If this doesn’t take you anywhere you may proceed with these Windows update troubleshooting steps. Method 1: Ch...

how do i find the manage list
By taking at least a fraction of the time to structure and proof-read the question as you would probably like someone to spend answering it. Regards Ken.................................. "excel" <excel@discussions.microsoft.com> wrote in message news:9816C0A1-D2B2-4B09-92A9-41F6411A93A3@microsoft.com... > ...

need help in managing my duplicate contacts
is there any utility out there that can help me in merging my duplicate contacts. I imported my old address book and it seem like it was not too successful in combining some of my address. I hate to do it manually. I need a utility that could help me in the cross checking and merge detected duplicate with ease. anyone seen such or am I wishing? thanks Steve In news:qavff.1005$rM2.872@newsread3.news.pas.earthlink.net, StvyLife <trial13@hotmail.com.no> typed: > is there any utility out there that can help me in merging my > duplicate contacts. I imported my old address book a...